core.components.calculate.phonon_runner#

Copyright (c) Meta Platforms, Inc. and affiliates.

This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.

Classes#

MDRPhononRunner

Calculate elastic tensor for a set of structures.

Functions#

get_mdr_phonon_data_list(index_df_path, phonon_file_path)

Module Contents#

core.components.calculate.phonon_runner.get_mdr_phonon_data_list(index_df_path, phonon_file_path, debug=False)#
class core.components.calculate.phonon_runner.MDRPhononRunner(calculator, input_data, displacement: float = 0.01)#

Bases: fairchem.core.components.calculate.CalculateRunner

Calculate elastic tensor for a set of structures.

result_glob_pattern: ClassVar[str] = 'mdr_phonon_dist*_*-*.json.gz'#
displacement#
calculate(job_num: int = 0, num_jobs: int = 1) list[dict[str, Any]]#

Run any calculation using an ASE like Calculator.

Parameters:
  • job_num (int, optional) – Current job number in array job. Defaults to 0.

  • num_jobs (int, optional) – Total number of jobs in array. Defaults to 1.

Returns:

Results of the calculation

Return type:

R

write_results(results: list[dict[str, Any]], results_dir: str, job_num: int = 0, num_jobs: int = 1) None#

Write results to file in results_dir.

Parameters:
  • results (R) – Results from the calculation

  • results_dir (str) – Directory to write results to

  • job_num (int, optional) – Current job number in array job. Defaults to 0.

  • num_jobs (int, optional) – Total number of jobs in array. Defaults to 1.

save_state(checkpoint_location: str, is_preemption: bool = False) bool#

Save the current state of the calculation to a checkpoint.

Parameters:
  • checkpoint_location (str) – Location to save the checkpoint

  • is_preemption (bool, optional) – Whether this save is due to preemption. Defaults to False.

Returns:

True if state was successfully saved, False otherwise

Return type:

bool

load_state(checkpoint_location: str | None) None#

Load a previously saved state from a checkpoint.

Parameters:

checkpoint_location (str | None) – Location of the checkpoint to load, or None if no checkpoint