core.components.calculate.single#
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.
Submodules#
- core.components.calculate.single.adsorbml_runner
- core.components.calculate.single.adsorption_runner
- core.components.calculate.single.adsorption_singlepoint_runner
- core.components.calculate.single.elasticity_runner
- core.components.calculate.single.kappa_runner
- core.components.calculate.single.nve_md_runner
- core.components.calculate.single.omol_runner
- core.components.calculate.single.pairwise_ct_runner
- core.components.calculate.single.phonon_runner
- core.components.calculate.single.relaxation_runner
- core.components.calculate.single.singlepoint_runner
Classes#
Run the AdsorbML pipeline to identify the global minima adsorption energy. |
|
Relax an adsorbate+surface configuration to compute the adsorption energy. |
|
Singlepoint evaluator for OC20 Adsorption systems |
|
Calculate elastic tensor for a set of structures. |
|
Calculate elastic tensor for a set of structures. |
|
Perform a single point calculation of several structures/molecules. |
|
Runner for OMol's evaluation tasks. |
|
Perform a single point calculation of several structures/molecules. |
|
Calculate elastic tensor for a set of structures. |
|
Relax a sequence of several structures/molecules. |
|
Perform a single point calculation of several structures/molecules. |
Package Contents#
- class core.components.calculate.single.AdsorbMLRunner(calculator: ase.calculators.calculator.Calculator, input_data_path: str, place_on_relaxed_slab: bool = False, save_relaxed_atoms: bool = True, adsorption_energy_model: bool = False, num_placements: int = 100, optimizer_cls: type[ase.optimize.Optimizer] = LBFGS, fmax: float = 0.02, steps: int = 300)#
Bases:
fairchem.core.components.calculate.CalculateRunner
Run the AdsorbML pipeline to identify the global minima adsorption energy. The option to also relax a clean surface is also provided.
This class handles the relaxation of atomic structures using a specified calculator, processes the input data in chunks, and saves the results.
- result_glob_pattern: ClassVar[str] = 'adsorbml_*-*.json.gz'#
- _save_relaxed_atoms#
- place_on_relaxed_slab#
- adsorption_energy_model#
- num_placements#
- fmax#
- steps#
- optimizer_cls#
- calculate(job_num: int = 0, num_jobs: int = 1) list[dict[str, Any]] #
Perform relaxation calculations on a subset of structures.
Splits the input data into chunks and processes the chunk corresponding to job_num.
- 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:
list[dict[str, Any]] - List of dictionaries containing calculation results
- write_results(results: list[dict[str, Any]], results_dir: str, job_num: int = 0, num_jobs: int = 1) None #
Write calculation results to a compressed JSON file.
- Parameters:
results – List of dictionaries containing elastic properties
results_dir – Directory path where results will be saved
job_num – Index of the current job
num_jobs – Total number of jobs
- 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
- class core.components.calculate.single.AdsorptionRunner(calculator: ase.calculators.calculator.Calculator, input_data: fairchem.core.datasets.atoms_sequence.AtomsSequence, save_relaxed_atoms: bool = True, relax_surface: bool = False, optimizer_cls: type[ase.optimize.Optimizer] = LBFGS, fmax: float = 0.05, steps: int = 300)#
Bases:
fairchem.core.components.calculate.CalculateRunner
Relax an adsorbate+surface configuration to compute the adsorption energy. The option to also relax a clean surface is also provided.
This class handles the relaxation of atomic structures using a specified calculator, processes the input data in chunks, and saves the results.
Input data is an AseDBDataset where each atoms object is organized as follows:
atoms: adsorbate+surface configuration atoms.info = {
gas_ref: float, dft_relaxed_adslab_energy: float, dft_relaxed_slab_energy: float, initial_slab_atoms: ase.Atoms, # Required if relax_surface=True
}
- result_glob_pattern: ClassVar[str] = 'adsorption_*-*.json.gz'#
- _save_relaxed_atoms#
- fmax#
- steps#
- relax_surface#
- optimizer_cls#
- calculate(job_num: int = 0, num_jobs: int = 1) list[dict[str, Any]] #
Perform relaxation calculations on a subset of structures.
Splits the input data into chunks and processes the chunk corresponding to job_num.
- 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:
list[dict[str, Any]] - List of dictionaries containing calculation results
- write_results(results: list[dict[str, Any]], results_dir: str, job_num: int = 0, num_jobs: int = 1) None #
Write calculation results to a compressed JSON file.
- Parameters:
results – List of dictionaries containing elastic properties
results_dir – Directory path where results will be saved
job_num – Index of the current job
num_jobs – Total number of jobs
- 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
- class core.components.calculate.single.AdsorptionSinglePointRunner(calculator: ase.calculators.calculator.Calculator, input_data: fairchem.core.datasets.atoms_sequence.AtomsSequence, evaluate_total_energy: bool = False, adsorption_energy_model: bool = False)#
Bases:
fairchem.core.components.calculate.CalculateRunner
Singlepoint evaluator for OC20 Adsorption systems
OC20 originally reported adsorption energies. This runner provides the ability to compute adsorption energy S2EF numbers by referencing to the provided slab atoms object. Total energy S2EF evaluations are also possible.
- result_glob_pattern: ClassVar[str] = 'adsorption-singlepoint_*-*.json.gz'#
- evaluate_total_energy#
- adsorption_energy_model#
- calculate(job_num: int = 0, num_jobs: int = 1) list[dict[str, Any]] #
- 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:
list[dict[str, Any]] - List of dictionaries containing calculation results
- write_results(results: list[dict[str, Any]], results_dir: str, job_num: int = 0, num_jobs: int = 1) None #
Write calculation results to a compressed JSON file.
- Parameters:
results – List of dictionaries containing elastic properties
results_dir – Directory path where results will be saved
job_num – Index of the current job
num_jobs – Total number of jobs
- 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
- class core.components.calculate.single.ElasticityRunner(calculator: ase.calculators.calculator.Calculator, input_data: fairchem.core.datasets.atoms_sequence.AtomsSequence)#
Bases:
fairchem.core.components.calculate.CalculateRunner
Calculate elastic tensor for a set of structures.
- result_glob_pattern: ClassVar[str] = 'elasticity_*-*.json.gz'#
- calculate(job_num: int = 0, num_jobs: int = 1) list[dict[str, Any]] #
Calculate elastic properties for a batch of structures.
- 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:
List of dictionaries containing elastic properties for each structure
- write_results(results: list[dict[str, Any]], results_dir: str, job_num: int = 0, num_jobs: int = 1) None #
Write calculation results to a compressed JSON file.
- Parameters:
results – List of dictionaries containing elastic properties
results_dir – Directory path where results will be saved
job_num – Index of the current job
num_jobs – Total number of jobs
- 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
- class core.components.calculate.single.KappaRunner(calculator, input_data, displacement: float = 0.03)#
Bases:
fairchem.core.components.calculate.CalculateRunner
Calculate elastic tensor for a set of structures.
- result_glob_pattern: ClassVar[str] = 'kappa103_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
- class core.components.calculate.single.NVEMDRunner(calculator: ase.calculators.calculator.Calculator, input_data: fairchem.core.datasets.atoms_sequence.AtomsSequence, time_step: float, steps: float, save_frequency: int = 10)#
Bases:
fairchem.core.components.calculate.CalculateRunner
Perform a single point calculation of several structures/molecules.
This class handles the single point calculation of atomic structures using a specified calculator, processes the input data in chunks, and saves the results.
- result_glob_pattern: ClassVar[str] = 'thermo_*-*.log'#
- time_step#
- steps#
- save_frequency#
- calculate(job_num: int = 0, num_jobs: int = 1) list[dict[str, Any]] #
Perform singlepoint calculations on a subset of structures.
Splits the input data into chunks and processes the chunk corresponding to job_num.
- 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:
list[dict[str, Any]] - List of dictionaries containing calculation results
- write_results(results: list[dict[str, Any]], results_dir: str, job_num: int = 0, num_jobs: int = 1) None #
Write calculation results to a compressed JSON file.
- Parameters:
results – List of dictionaries containing energy and forces results
results_dir – Directory path where results will be saved
job_num – Index of the current job
num_jobs – Total number of jobs
- 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
- class core.components.calculate.single.OMolRunner(calculator: ase.calculators.calculator.Calculator, input_data: dict, benchmark_name: str, benchmark: Callable)#
Bases:
fairchem.core.components.calculate.CalculateRunner
Runner for OMol’s evaluation tasks.
- result_glob_pattern#
- benchmark_name#
- benchmark#
- input_keys#
- calculate(job_num: int = 0, num_jobs: int = 1) list[dict[str, Any]] #
Perform calculations on a subset of structures.
Splits the input data into chunks and processes the chunk corresponding to job_num.
- 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:
list[dict[str, Any]] - List of dictionaries containing calculation results
- write_results(results: list[dict[str, Any]], results_dir: str, job_num: int = 0, num_jobs: int = 1) None #
Write calculation results to a compressed JSON file.
- Parameters:
results – List of dictionaries containing elastic properties
results_dir – Directory path where results will be saved
job_num – Index of the current job
num_jobs – Total number of jobs
- 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
- class core.components.calculate.single.PairwiseCountRunner(dataset_cfg='/checkpoint/ocp/shared/pairwise_data/preview_config.yaml', ds_name='omat', radius=3.5, portion=0.01)#
Bases:
fairchem.core.components.runner.Runner
Perform a single point calculation of several structures/molecules.
This class handles the single point calculation of atomic structures using a specified calculator, processes the input data in chunks, and saves the results.
- dataset_cfg#
- ds_name#
- radius#
- portion#
- run()#
- save_state(checkpoint_location: str, is_preemption: bool = False) bool #
- class core.components.calculate.single.MDRPhononRunner(calculator: ase.calculators.calculator.Calculator, input_data: Sequence[dict], 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
- class core.components.calculate.single.RelaxationRunner(calculator: ase.calculators.calculator.Calculator, input_data: fairchem.core.datasets.atoms_sequence.AtomsSequence, calculate_properties: collections.abc.Sequence[str], save_relaxed_atoms: bool = True, normalize_properties_by: dict[str, str] | None = None, save_target_properties: collections.abc.Sequence[str] | None = None, **relax_kwargs)#
Bases:
fairchem.core.components.calculate.CalculateRunner
Relax a sequence of several structures/molecules.
This class handles the relaxation of atomic structures using a specified calculator, processes the input data in chunks, and saves the results.
- result_glob_pattern: ClassVar[str] = 'relaxation_*-*.json.gz'#
- _calculate_properties#
- _save_relaxed_atoms#
- _normalize_properties_by#
- _save_target_properties#
- _relax_kwargs#
- calculate(job_num: int = 0, num_jobs: int = 1) list[dict[str, Any]] #
Perform relaxation calculations on a subset of structures.
Splits the input data into chunks and processes the chunk corresponding to job_num.
- 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:
list[dict[str, Any]] - List of dictionaries containing calculation results
- write_results(results: list[dict[str, Any]], results_dir: str, job_num: int = 0, num_jobs: int = 1) None #
Write calculation results to a compressed JSON file.
- Parameters:
results – List of dictionaries containing elastic properties
results_dir – Directory path where results will be saved
job_num – Index of the current job
num_jobs – Total number of jobs
- 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
- class core.components.calculate.single.SinglePointRunner(calculator: ase.calculators.calculator.Calculator, input_data: fairchem.core.datasets.atoms_sequence.AtomsSequence, calculate_properties: collections.abc.Sequence[str], normalize_properties_by: dict[str, str] | None = None, save_target_properties: collections.abc.Sequence[str] | None = None)#
Bases:
fairchem.core.components.calculate.CalculateRunner
Perform a single point calculation of several structures/molecules.
This class handles the single point calculation of atomic structures using a specified calculator, processes the input data in chunks, and saves the results.
- result_glob_pattern: ClassVar[str] = 'singlepoint_*-*.json.gz'#
- _calculate_properties#
- _normalize_properties_by#
- _save_target_properties#
- calculate(job_num: int = 0, num_jobs: int = 1) list[dict[str, Any]] #
Perform singlepoint calculations on a subset of structures.
Splits the input data into chunks and processes the chunk corresponding to job_num.
- 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:
list[dict[str, Any]] - List of dictionaries containing calculation results
- write_results(results: list[dict[str, Any]], results_dir: str, job_num: int = 0, num_jobs: int = 1) None #
Write calculation results to a compressed JSON file.
- Parameters:
results – List of dictionaries containing energy and forces results
results_dir – Directory path where results will be saved
job_num – Index of the current job
num_jobs – Total number of jobs
- 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