Overview#

The libcasm-monte package provides generic data structures and methods that can form the building blocks for Monte Carlo simulation implementations. The Python interface is provided for controlling simulations, data analysis, and initial testing. For the most efficient simulations, extensions written in C++ are used to implement calculators and checks used most frequently.

Note

The libcasm-clexmonte package provides the CASM cluster expansion Monte Carlo implementations built using this package.

Primarily, the libcasm-monte package includes a Python interface to data structures and methods written in C++ in the CASM::monte namespace:

  • libcasm.monte: Provides random number generation, logging, and the ValueMap data structure used throughout libcasm.monte.

  • libcasm.monte.sampling: Provides data structures and methods for sampling data and checking for convergence of Monte Carlo calculations.

  • libcasm.monte.events: Provides data structures and methods to help specify, propose, and apply Monte Carlo events that update discrete occupation variables.

  • libcasm.monte.methods: Provides data structures and methods for implementing Monte Carlo methods, such as the Metropolis algorithm.

Monte Carlo implementations can be roughly divided into two parts: a “model” which specifies how microstates are implemented and properties are calculated, and a “calculator” which implements a particular Monte Carlo method for sampling a particular thermodynamic ensemble.

CASM does not expect or require a standard interface to allow any model to work with any calculator. Generally, it is expected that models and calculators can be built re-using generic methods the libcasm-monte package provides as building blocks.

For tutorial and testing purposes libcasm-monte also includes:

  • libcasm.monte.ising_cpp: An Ising model implementation and a semi-grand canonical ensemble Monte Carlo calculator, written in C++ using CASM::monte with a Python interface using libcasm-monte.

  • libcasm.monte.ising_py: An Ising model implementation and a semi-grand canonical ensemble Monte Carlo calculator, written in Python using libcasm-monte.

Monte Carlo models#

Generally, a model implements:

  • a configuration data structure, to represent microstates,

  • a state data structure, to represent a configuration and the current thermodynamic conditions,

  • as many property calculator methods as necessary to calculate properties of configurations,

  • a system data structure, to store property calculators, and handle input of data that is used by property calculators, such as parametric composition axes, order parameter definitions, neighbor lists, and cluster expansion basis sets and coefficients.

For example, the CASM cluster expansion model in libcasm-clexmonte is implemented using:

  • the Configuration and State classes to represent microstates and thermodynamic conditions, and

  • the System class to manage the data needed by the calculators.

It also makes use of:

Monte Carlo calculators#

Generally, a calculator includes:

  • the Monte Carlo calculator class with a run method which implements a particular method for sampling properties of microstates in a particular thermodynamic ensemble,

  • an event generator method, for proposing Monte Carlo events,

  • a potential calculator method, for calculating changes in the thermodynamic potential due to an event, under given thermodynamic conditions.

For example, the libcasm.clexmonte.semigrand_canonical package implements Monte Carlo simulations in the semi-grand canonical ensemble for the CASM cluster expansion model.

The libcasm.clexmonte.semigrand_canonical package provides:

  • the SemiGrandCanonicalConditions class for representing thermodynamic conditions,

  • the SemiGrandCanonicalEventGenerator class for proposing events in the semi-grand canonical ensemble,

  • the SemiGrandCanonicalPotential class for calculating changes in the semi-grand canonical energy due to the proposed events, and

  • the SemiGrandCanonicalCalculator class for sampling microstates in the semi-grand canonical ensemble.

It also makes use of:

  • SamplingFixture and RunManager, to control sampling, convergence checking, and results output.

Other CASM cluster expansion model calculator packages include:

  • canonical: The standard CASM canonical Monte Carlo implementation using the Metropolis algorithm

  • semigrand_canonical: The standard CASM semigrand-canonical Monte Carlo implementation using the Metropolis algorithm

  • kinetic: The standard CASM kinetic Monte Carlo implementation

  • nfold: Implements semigrand-canonical Monte Carlo calculations using the N-fold way algorithm

  • flex: A flexible CASM Monte Carlo implementation that allows including a additional terms to the potential to enable umbrella sampling, special quasi-random structure (SQS) generation, and other approaches.