# Configuration manager¶

class mchammer.ConfigurationManager(structure, sublattices)[source]

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

Parameters
• structure (ase.Atoms) – configuration to be handled

• sublattices (Sublattices) – sublattices class used to define allowed occupations and so on

Todo

• revise docstrings

get_flip_state(sublattice_index, allowed_species=None)[source]

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

Parameters
• sublattice_index (int) – index of sublattice from which to pick a site

• allowed_species (Optional[List[int]]) – list of atomic numbers for allowed species

Return type

Tuple[int, int]

get_occupations_on_sublattice(sublattice_index)[source]

Returns the occupations on one sublattice.

Parameters

sublattice_index (int) – the sublattice for which the occupations should be returned

Return type

List[int]

get_swapped_state(sublattice_index, allowed_species=None)[source]

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_index (int) – sublattice from which to pick sites

• allowed_species (Optional[List[int]]) – list of atomic numbers for allowed species

Return type

Tuple[List[int], List[int]]

is_swap_possible(sublattice_index, allowed_species=None)[source]

Checks if swap is possible on specific sublattice.

Parameters
• sublattice_index (int) – index of sublattice to be checked

• allowed_species (Optional[List[int]]) – list of atomic numbers for allowed species

Return type

bool

property occupations

occupation vector of the configuration (copy)

Return type

List[int]

property structure

atomic structure associated with configuration (copy)

Return type

Atoms

property sublattices

sublattices of the configuration

Return type

Sublattices

update_occupations(sites, species)[source]

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 by atomic number