Calculators

ClusterExpansionCalculator

class mchammer.calculators.ClusterExpansionCalculator(atoms, cluster_expansion, name='Cluster Expansion Calculator', scaling=None)

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 (Atoms) – structure for which to set up the calculator
  • cluster_expansion (ClusterExpansion) – cluster expansion from which to build calculator
  • name (str) – human-readable identifier for this calculator
  • scaling (float) – scaling factor applied to the property value predicted by the cluster expansion

Todo

  • add OccupationConstraints once available
atoms

atomic structure associated with calculator

Return type:Atoms
calculate_local_contribution(local_indices=None, occupations=None)

Calculates and returns the sum of the contributions to the property due to the sites specified in local_indices

Parameters:
  • local_indices (Optional[List[int]]) – sites over which to sum up the local contribution
  • occupations (Optional[List[int]]) – entire occupation vector
Return type:

float

calculate_total(*, occupations)

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
occupation_constraints

map from site to allowed species

Return type:List[List[int]]
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