Calculators¶
ClusterExpansionCalculator¶

class
mchammer.calculators.
ClusterExpansionCalculator
(structure, 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
structure (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 calculatorscaling (
Union
[int
,float
,None
]) – scaling factor applied to the property value predicted by the cluster expansionuse_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

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 contributionoccupations (
List
[int
]) – entire occupation vector
 Return type
float

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

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

property
structure
¶ atomic structure associated with calculator
 Return type
Atoms

property
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 updatespecies (
List
[int
]) – new occupations (species) by atomic number
TargetVectorCalculator¶

class
mchammer.calculators.
TargetVectorCalculator
(structure, 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
structure (
Atoms
) – structure for which to set up calculatorcluster_space (
ClusterSpace
) – cluster space from which to build calculatortarget_vector (
List
[float
]) – vector to which any vector will be comparedweights (
Optional
[List
[float
]]) – weighting of each component in cluster vector comparison, by default 1.0 for all componentsoptimality_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

calculate_local_contribution
(local_indices, 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

property
structure
¶ atomic structure associated with calculator
 Return type
Atoms

property
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 updatespecies (
List
[int
]) – new occupations (species) by atomic number

mchammer.calculators.
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 1cv_2 (
ndarray
) – cluster vector 2orbit_data (
OrderedDict
) – orbit data as obtained byClusterSpace.orbit_data
weights (
Optional
[List
[float
]]) – Weight assigned to each cluster vector elementoptimality_weight (
float
) – quantity \(L\) in [WalTiwJon13] (seemchammer.calculators.TargetVectorCalculator
)tol (
float
) – numerical tolerance for determining whether two elements are exactly equal
 Return type
float