core.components.calculate.recipes.utils#
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.
Functions#
Retrieve a property from an Atoms object, either from its properties or info dictionary. |
|
|
Normalize a property value by either the number of atoms or another property. |
|
Get a sequence of properties from an atoms object and return a dict. |
Module Contents#
- core.components.calculate.recipes.utils.get_property_from_atoms(atoms: ase.Atoms, property_name: str) int | float | numpy.typing.ArrayLike #
Retrieve a property from an Atoms object, either from its properties or info dictionary.
- Parameters:
atoms – The ASE Atoms object to extract properties from
property_name – Name of the property to retrieve
- Returns:
The property value as an integer, float, or array-like object
- Raises:
ValueError – If the property is not found in either the properties or info dictionary
- core.components.calculate.recipes.utils.normalize_property(property_value: float | numpy.typing.ArrayLike, atoms: ase.Atoms, normalize_by: str)#
Normalize a property value by either the number of atoms or another property.
- Parameters:
property_value – The property value to normalize
atoms – The ASE Atoms object containing the normalization information
normalize_by – Normalization method, either “natoms” to divide by number of atoms or a property name to divide by that property’s value
Returns: The normalized property value
- core.components.calculate.recipes.utils.get_property_dict_from_atoms(properties: collections.abc.Sequence[str], atoms: ase.Atoms, normalize_by: dict[str, str] | None = None) dict[str, float | numpy.typing.ArrayLike] #
Get a sequence of properties from an atoms object and return a dict.
- Parameters:
properties – Sequence of property names to retrieve from the atoms object
atoms – The ASE Atoms object to extract properties from
normalize_by – Dictionary mapping property names to normalization methods
- Returns:
- Dictionary containing the requested properties as keys and
normalized properties if specified in normalize_by