Calculators¶
ClusterExpansionCalculator¶

class
mchammer.calculators.
ClusterExpansionCalculator
(atoms, cluster_expansion, name='Cluster Expansion Calculator', scaling=None, use_local_energy_calculator=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:  atoms (ase.Atoms) – structure for which to set up the calculator
 cluster_expansion (ClusterExpansion) – cluster expansion from which to build calculator
 name (
str
) – humanreadable identifier for this calculator  scaling (
Union
[int
,float
,None
]) – scaling factor applied to the property value predicted by the cluster expansion  use_local_energy_calculator (
bool
) – 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

atoms
¶ atomic structure associated with calculator
Return type: Atoms

calculate_local_contribution
(*, local_indices, occupations)[source]¶ Calculates and returns the sum of the contributions to the property due to the sites specified in local_indices
Parameters:  local_indices (
List
[int
]) – sites over which to sum up the local contribution  occupations (
List
[int
]) – entire occupation vector
Return type: float
 local_indices (

calculate_total
(*, occupations)[source]¶ Calculates and returns the total property value of the current configuration.
Parameters: occupations ( List
[int
]) – the entire occupation vector (i.e. list of atomic species)Return type: float

cluster_expansion
¶ cluster expansion from which calculator was constructed
Return type: ClusterExpansion

sublattices
¶ Sublattices of the calculators structure.
Return type: Sublattices

update_occupations
(indices, species)¶ Updates the occupation (species) of the associated atomic structure.
Parameters:  indices (
List
[int
]) – sites to update  species (
List
[int
]) – new occupations (species) by atomic number
 indices (
TargetVectorCalculator¶

class
mchammer.calculators.target_vector_calculator.
TargetVectorCalculator
(atoms, cluster_space, target_vector, weights=None, optimality_weight=1.0, optimality_tol=1e05, name='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:  atoms (
Atoms
) – structure for which to set up calculator  cluster_space (
ClusterSpace
) – cluster space from which to build calculator  target_vector (
List
[float
]) – vector to which any vector will be compared  weights (
Optional
[List
[float
]]) – weighting of each component in cluster vector comparison, by default 1.0 for all components  optimality_weight (
float
) – factor \(L\), a high value of which effectively favors a complete series of optimal cluster correlations for the smallest pairs (see above)  optimality_tol (
float
) – tolerance for determining whether a perfect match has been achieved (used in conjunction with \(L\))  name (
str
) – humanreadable identifier for this calculator

atoms
¶ atomic structure associated with calculator
Return type: Atoms

calculate_local_contribution
(occupations)[source]¶ Not yet implemented, forwards calculation to calculate_total.
Return type: float

calculate_total
(occupations)[source]¶ Calculates and returns the similarity value \(Q\) of the current configuration.
Parameters: occupations ( List
[int
]) – the entire occupation vector (i.e. list of atomic species)Return type: float

sublattices
¶ Sublattices of the calculators structure.
Return type: Sublattices

update_occupations
(indices, species)¶ Updates the occupation (species) of the associated atomic structure.
Parameters:  indices (
List
[int
]) – sites to update  species (
List
[int
]) – new occupations (species) by atomic number
 indices (
 atoms (

mchammer.calculators.target_vector_calculator.
compare_cluster_vectors
(cv_1, cv_2, orbit_data, weights=None, optimality_weight=1.0, tol=1e05)[source]¶ Calculate a quantity that measures similarity between two cluster vecors.
Parameters:  cv_1 (
ndarray
) – cluster vector 1  cv_2 (
ndarray
) – cluster vector 2  orbit_data (
OrderedDict
) – orbit data as obtained byClusterSpace.orbit_data
 weights (
Optional
[List
[float
]]) – Weight assigned to each cluster vector element  optimality_weight (
float
) – quantity \(L\) in [WalTiwJon13] (seemchammer.calculators.TargetVectorCalculator
)  tol (
float
) – numerical tolerance for determining whether two elements are exactly equal
Return type: float
 cv_1 (