Configuration manager

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

The ConfigurationManager owns and handles information pertaining to a configuration being sampled in a Monte Carlo simulation.

Parameters:
  • atoms (ASE Atoms) – configuration to be handled
  • strict_constraints (list of list of int) – strictest form of the allowed occupations
  • sites_by_sublattice (list of list of int) – sites (inner list) that belong to each sublattice (outer list)
  • occupation_constraints (list of list of int) – optional occupation constraint to enfore a more stricter species occupation than what is allowed from the Calculator.

Todo

  • occupation constraint not implemented
  • add check that all sites in the different sublattices all have the same occupation constraint.
  • revise docstrings
  • clarify “occupation_constraints” vs “strict_constraints”; the OccupationConstraints class should help here
atoms

atomic structure associated with configuration (copy)

Return type:Atoms
get_flip_state(sublattice)

Returns a site index and a new species for the site.

Parameters:sublattice (int) – index of sublattice from which to pick a site
Return type:Tuple[int, int]
get_swapped_state(sublattice)

Returns two random sites (first element of tuple) and their occupation after a swap (second element of tuple). The new configuration will obey the occupation constraints associated with the configuration mananger.

Parameters:sublattice (int) – sublattice from which to pick sites

Todo

  • profile this method as it is called frequently
  • look for speed up opportunities
  • The current implementation assumes all sites in this sublattice to have the same allowed occupations.
Return type:Tuple[List[int], List[int]]
occupation_constraints

occupation constraints associated with configuration manager (copy); the outer list runs over sites with each inner list representing the species allowed on this site.

Return type:List[List[int]]
occupations

occupation vector of the configuration (copy)

Return type:List[int]
sublattices

sites belonging to each sublattice of the configuration (copy)

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

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

Parameters:
  • sites (List[int]) – indices of sites of the configuration to change
  • species (List[int]) – new occupations (species) by atomic number