mcmala.simulation package

Submodules

mcmala.simulation.atom_displacer module

Configuration suggester for atomistic simulations.

class mcmala.simulation.atom_displacer.AtomDisplacer(maximum_displacement, enforce_pbc=True)

Bases: mcmala.simulation.configuration_suggester.ConfigurationSuggester

Configuration suggester for atomistic simulations.

Displaces a random atom in an ASE atoms object by a random vector.

get_info()

Access a dictionary with identifying information.

Returns

info

Return type

dict

suggest_new_configuration(old_configuration: ase.Atoms)

Suggest a new configuration based on the old.

Parameters

old_configuration (ase.Atoms) – Old configuration based on which a new one will be suggested.

Returns

new_configuration – New configuration as suggested by algorithm.

Return type

ase.Atoms

mcmala.simulation.atom_displacer.random()x in the interval [0, 1).

mcmala.simulation.configuration_suggester module

Abstract base class for configuration suggesters.

class mcmala.simulation.configuration_suggester.ConfigurationSuggester

Bases: abc.ABC

Abstract base class for configuration suggesters.

abstract get_info()

Access a dictionary with identifying information.

Returns

info

Return type

dict

abstract suggest_new_configuration(old_configuration)

Suggest a new configuration based on the old.

Parameters

old_configuration (Any) – Old configuration based on which a new one will be suggested.

Returns

new_configuration – New configuration as suggested by algorithm.

Return type

Any

mcmala.simulation.ising_model module

Evaluator, suggester, configurations for the Ising model.

class mcmala.simulation.ising_model.IsingGrid(lattice_size, initType='random')

Bases: object

Represents a grid of spins.

Such a grid is at the center of the Ising model. Spins can be either +1 or -1 (spin up/spin down). Only a quadratic 2D lattice is supported.

Parameters
  • lattice_size (int) –

    Size of the lattice (in either direction, a quadratic lattice is

    assumed.)

  • initType (string) – Type of initialization to be performed. Default “random”, assgning spins at random. “positive” or “negative” initializes the lattice entirely with positive or negative spins, respectively.

visualize(ax=None)

Visualize an Ising model spin grid.

Parameters

ax (matplotlib.axes.Axes) – An axis to be used for plotting. If “None”, one will be created.

Returns

ax – Axis to be used for plotting. If one was provided, the plot will have been added to this one.

Return type

matplotlib.axes.Axes

class mcmala.simulation.ising_model.IsingModelConfigurations

Bases: mcmala.simulation.configuration_suggester.ConfigurationSuggester

Configuration suggester for the Ising model.

Randomly flips a spin.

get_info()

Access a dictionary with identifying information.

Returns

info

Return type

dict

suggest_new_configuration(old_configuration: mcmala.simulation.ising_model.IsingGrid)

Suggest a new configuration for an Ising model spin grid.

This is done by randomly flipping a spin.

Parameters

old_configuration (IsingGrid) – Spin grid for which to suggest a new spin grid.

Returns

new_configuration – New spin grid.

Return type

IsingGrid

class mcmala.simulation.ising_model.IsingModelEvaluator(*args: Any, **kwargs: Any)

Bases: ase.calculators.calculator.

Evaluator for the Ising model.

An object of this class can calculate the total energy of an Ising model spin grid.

Parameters

interaction_strength (float) – Interaction strength of Ising model, in eV.

calculate(atoms: mcmala.simulation.ising_model.IsingGrid)

Calculate the total energy of a spin grid.

Parameters

atoms (IsingGrid) – Spin grid based on which the total energy will be calculated.

Returns

total_energy – Total energy of the given configuration, in eV.

Return type

float

calculate_properties(atoms: mcmala.simulation.ising_model.IsingGrid, properties)

After a calculation, calculate additional properties.

This is separate from the calculate function because of MALA-MC simulations. For these energy and additional property calculation need to be separate.

Module contents

Everything evaluating/simulation related MCMALA contains.