Calculators¶
ClusterExpansionCalculator¶
- class mchammer.calculators.ClusterExpansionCalculator(structure: ase.atoms.Atoms, cluster_expansion: icet.core.cluster_expansion.ClusterExpansion, name: str = 'Cluster Expansion Calculator', scaling: Optional[Union[float, int]] = None, use_local_energy_calculator: bool = True)[source]¶
A ClusterExpansionCalculator object enables the efficient calculation of properties described by a cluster expansion. It is specific for a particular (supercell) structure and commonly employed when setting up a Monte Carlo simulation, see Ensembles.
Cluster expansions, e.g., of the energy, typically yield property values per site. When running a Monte Carlo simulation one, however, considers changes in the total energy of the system. The default behavior is therefore to multiply the output of the cluster expansion by the number of sites. This behavior can be changed via the
scaling
keyword parameter.- Parameters
structure (ase.Atoms) – structure for which to set up the calculator
cluster_expansion (ClusterExpansion) – cluster expansion from which to build calculator
name – human-readable identifier for this calculator
scaling – scaling factor applied to the property value predicted by the cluster expansion
use_local_energy_calculator – evaluate energy changes using only the local environment; this method is generally much faster; unless you know what you are doing do not set this option to False
- accept_change()¶
Some calculators depend on the state of the occupdations, in which they need to be informed if the occupations change.
- calculate_change(*, sites: List[int], current_occupations: List[int], new_site_occupations: List[int]) float [source]¶
Calculates and returns the sum of the contributions to the property due to the sites specified in local_indices
- Parameters
sites – index of sites at which occupations will be changed
current_occupations – entire occupation vector (atomic numbers) before change
new_site_occupations – atomic numbers after change at the sites defined by sites
- calculate_total(*, occupations: List[int]) float [source]¶
Calculates and returns the total property value of the current configuration.
- Parameters
occupations – the entire occupation vector (i.e. list of atomic species)
- property cluster_expansion: icet.core.cluster_expansion.ClusterExpansion¶
cluster expansion from which calculator was constructed
- property sublattices: icet.core.sublattices.Sublattices¶
Sublattices of the calculators structure.
ConstituentStrainCalculator¶
- class mchammer.calculators.ConstituentStrainCalculator(constituent_strain: icet.tools.constituent_strain.ConstituentStrain, cluster_expansion: icet.core.cluster_expansion.ClusterExpansion, name: str = 'Constituent Strain Calculator', scaling: Optional[Union[float, int]] = None)[source]¶
Calculator for handling cluster expansions with strain.
- Parameters
constituent_strain – ConstituentStrain object defining the strain energy properties of the system; the supercell used to create this object should corresponding to the one used when running Monte Carlo simulations with this calculator
cluster_expansion – cluster expansion from which to build ClusterExpansionCalculator
name – human-readable identifier for this calculator
scaling – scaling factor applied to the property value predicted by the cluster expansion
- accept_change()[source]¶
Informs the ConstituentStrain object that the most recent change was accepted, such that the new structure factor can be stored.
- calculate_change(*, sites: List[int], current_occupations: List[int], new_site_occupations: List[int]) float [source]¶
Calculates and returns the sum of the contributions to the property due to the sites specified in local_indices
- Parameters
sites – index of sites at which occupations will be changed
current_occupations – entire occupation vector (atomic numbers) before change
new_site_occupations – atomic numbers after change at the sites defined by sites
- calculate_total(*, occupations: numpy.ndarray) float [source]¶
Calculates and returns the total property value of the current configuration.
- Parameters
occupations – the entire occupation vector (i.e. an array of atomic numbers as integers)
- property cluster_expansion: icet.core.cluster_expansion.ClusterExpansion¶
cluster expansion from which calculator was constructed
- property sublattices: icet.core.sublattices.Sublattices¶
Sublattices of the calculators structure.
TargetVectorCalculator¶
- class mchammer.calculators.TargetVectorCalculator(structure: ase.atoms.Atoms, cluster_space: icet.core.cluster_space.ClusterSpace, target_vector: List[float], weights: Optional[List[float]] = None, optimality_weight: float = 1.0, optimality_tol: float = 1e-05, name: str = 'Target vector calculator')[source]¶
A
TargetVectorCalculator
enables evaluation of the similarity between a structure and a target cluster vector. Such a comparison can be carried out in many ways, and this implementation follows the measure proposed by van de Walle et al. in Calphad 42, 13 (2013) [WalTiwJon13]. Specifically, the objective function \(Q\) is calculated as\[Q = - \omega L + \sum_{\alpha} \left| \Gamma_{\alpha} - \Gamma^{\text{target}}_{\alpha} \right|.\]Here, \(\Gamma_{\alpha}\) are components in the cluster vector and \(\Gamma^\text{target}_{\alpha}\) the corresponding target values. The factor \(\omega\) is the radius of the largest pair cluster such that all clusters with the same or smaller radii have \(\Gamma_{\alpha} - \Gamma^\text{target}_{\alpha} = 0\).
- Parameters
structure – structure for which to set up calculator
cluster_space – cluster space from which to build calculator
target_vector – vector to which any vector will be compared
weights – weighting of each component in cluster vector comparison, by default 1.0 for all components
optimality_weight – factor \(L\), a high value of which effectively favors a complete series of optimal cluster correlations for the smallest pairs (see above)
optimality_tol – tolerance for determining whether a perfect match has been achieved (used in conjunction with \(L\))
name – human-readable identifier for this calculator
- accept_change()¶
Some calculators depend on the state of the occupdations, in which they need to be informed if the occupations change.
- calculate_total(occupations: List[int]) float [source]¶
Calculates and returns the similarity value \(Q\) of the current configuration.
- Parameters
occupations – the entire occupation vector (i.e. list of atomic species)
- property sublattices: icet.core.sublattices.Sublattices¶
Sublattices of the calculators structure.
- mchammer.calculators.compare_cluster_vectors(cv_1: numpy.ndarray, cv_2: numpy.ndarray, orbit_data: List[collections.OrderedDict], weights: Optional[List[float]] = None, optimality_weight: float = 1.0, tol: float = 1e-05) float [source]¶
Calculate a quantity that measures similarity between two cluster vecors.
- Parameters
cv_1 – cluster vector 1
cv_2 – cluster vector 2
orbit_data – orbit data as obtained by
ClusterSpace.orbit_data
weights – Weight assigned to each cluster vector element
optimality_weight – quantity \(L\) in [WalTiwJon13] (see
mchammer.calculators.TargetVectorCalculator
)tol – numerical tolerance for determining whether two elements are exactly equal