Configuration manager

class mchammer.ConfigurationManager(atoms, strict_constraints, sublattices, occupation_constraints=None)

ConfigurationManager store its own state of the configuration that are being sampled in the ensemble.

ConfigurationManager is responsible for all information and handling of the configuration.

  • occupations (list of int) – The occupation of the configurations. The integers refer to elements via their number in the periodic table
  • strict_constraints (list of list of int) – the strictest form of the allowed occupations.
  • occupation_constraints (list of list of int) – optional occupation constraint to enfore a more stricter species occupation than what is allowed from the Calculator.
  • sublattices (list of list of int) – the integers refer to lattice site indices in the configuration.


  • occupation constraint not implemented
  • add check that all sites in the different sublattices all have the same occupation constraint.

The atoms object.


Returns a tuple of a list of a random index in a specific sublattice and a list of the element to flip it to.

  • sublattice (int) – The sublattice to pick indices from.
  • return ((list[int], list[int])) –
Return type:

Tuple[int, int]


Returns a tuple of a list of two random indices in a specific sublattice and what elements they will occupy after a swap. The two indices refer to lattice sites and the indices will, if swapped, produce a new, different configuration that is allowed by the occupation constraints.

Parameters:sublattice (int) – The sublattice to pick indices from.
Return type:Tuple[List[int], List[int]]

The occupation constraints for this configuration manager.

Return type:List[List[int]]

The occupations of the configuration.

Return type:List[int]

The sublattices of the configuration.

Return type:List[List[int]]
update_occupations(list_of_sites, list_of_elements)

Update the element occupation of the configuration being sampled. This will change the state in both the configuration in the calculator and the state of configuration manager.

  • list_of_sites (list of int) – list of indices of the configuration to change.
  • list_of_elements (list of int) – list of elements to put on the lattice sites the indices refer to.


  • change occupation
  • change the element occupation