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.

  • 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 (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

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

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


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 from which calculator was constructed

Return type:ClusterExpansion

map from site to allowed species

Return type:List[List[int]]
update_occupations(indices, species)

Updates the occupation (species) of the associated atomic structure.

  • indices (List[int]) – sites to update
  • species (List[int]) – new occupations (species) by atomic number