allomorph.constants
Attributes
Functions
|
Update global constants from a dictionary. |
|
Load configuration from a JSON, YAML, or TOML file. |
|
Validate a user-supplied element dictionary. |
|
Load an element dictionary from a JSON file. |
|
Compute distance between 2 points in one of their real space coordinates. |
|
Compute real space distance between 2 points. |
|
Compute the core-shell probability for each atom in obj. |
|
Parse a concatenated element combination string into individual symbols. |
Module Contents
- allomorph.constants.TNP_DISTRIB_LIST = ['L10R', 'CS', 'CL10S', 'CRALS', 'RRAL', 'CSRAL', 'CSL10', 'CRSR', 'LL10'][source]
- allomorph.constants.update_constants(config)[source]
Update global constants from a dictionary.
- Parameters:
config – Dictionary containing constant names and their new values.
- allomorph.constants.load_config(path)[source]
Load configuration from a JSON, YAML, or TOML file.
- Parameters:
path – Path to the configuration file.
- Returns:
The loaded configuration dictionary.
- allomorph.constants.validate_ele_dict(ele_dict)[source]
Validate a user-supplied element dictionary.
- Parameters:
ele_dict – Dictionary mapping element symbols to property dicts.
- Returns:
The validated dictionary.
- Raises:
ValueError – If required keys are missing or invalid.
- allomorph.constants.load_ele_dict_from_file(path)[source]
Load an element dictionary from a JSON file.
- Parameters:
path – Path to a JSON file containing the element dictionary.
- Returns:
Validated element dictionary.
- allomorph.constants.dist_1d(coord1, coord2, dim)[source]
Compute distance between 2 points in one of their real space coordinates.
- allomorph.constants.calc_rcs_prob(obj, shape)[source]
Compute the core-shell probability for each atom in obj.
Returns a list where higher values correspond to surface-like positions.
- Parameters:
obj – ASE Atoms object.
shape – Nanoparticle shape string (e.g. ‘IC’, ‘DH’, ‘OT’).
- Returns:
List of probabilities, one per atom.
- allomorph.constants.parse_ele_comb(ele_comb, ele_dict=None)[source]
Parse a concatenated element combination string into individual symbols.
- Parameters:
ele_comb – String like ‘AuPtPd’ or ‘CuAgAu’.
ele_dict – Optional element dictionary to use for matching. If None, the built-in ELE_DICT is used.
- Returns:
List of element symbols, e.g. [‘Au’, ‘Pt’, ‘Pd’].
- Raises:
ValueError – If the string cannot be parsed.