MetropolisMonteCarlo

MetropolisMonteCarlo(configuration, constraints=None, trajectory_filename=None, steps=None, max_trial_moves=None, log_interval=None, method=None, random_seed=None, trajectory_interval=None, trajectory_object_id=None)

Perform a Metropolis Monte Carlo simulation on a configuration using a specified method for carrying out each Monte Carlo trial move.

Parameters:
  • configuration (MoleculeConfiguration | BulkConfiguration | DeviceConfiguration | SurfaceConfiguration | MDTrajectory | Trajectory) – The initial configuration or a trajectory. If a trajectory is given, the last configuration will be used as the initial configuration for this MC run and the trajectory will be appended to. When a trajectory is used as input, the arguments trajectory_interval and trajectory_object_id should be None`.

  • constraints (int | FixAtomConstraints | list of int | list of FixAtomConstraints) – The list of atomic constraints. Note that for the ContinuousRandomNetwork these constraints are used only for fixing the bonding network (i.e., any atom listed here will not be allowed to take part in a bond switch move, hence fixing its neighbours). The coordinates of the atoms are however not constrained in the geometry optimization following a bond switch. If this further constraint is desired, it should be introduced in the optimize_geometry_parameters input of the ContinuousRandomNetwork object.
    Default: No constraints.

  • trajectory_filename (str) – The filename of the file to be used for storing the trajectory. This should not be given if configuration is a trajectory.
    Default: No trajectory will be written, unless configuration is a trajectory.

  • steps (int) – The number of steps to take in the simulation. A smaller number might be taken if max_trial_moves is reached before the target number of steps.
    Default: 50

  • max_trial_moves (int) – The maximum number of trial moves (accepted or rejected) to take in the simulation.
    Default: 100 * steps

  • log_interval (int) – The resolution used in writing the log file, where the given number represents the number of steps performed between each each log file entry.
    Default: 1

  • method (BaseMetropolisMonteCarloMethod) – The method used to take the Monte Carlo step.
    Default: ContinuousRandomNetwork()

  • random_seed (int) – The random seed used for the Metropolis algorithm.
    Default: Generated automatically.

  • trajectory_interval (int) – The resolution used in saving steps to a trajectory file. A value of 1 results in all steps being saved; a value of 2 results in every second step being saved; etc. If configuration is a trajectory (i.e., this is a restart MC simulation) this parameter will use the same value as was used in the previous trajectory.
    Default: Equal to log_interval.

  • trajectory_object_id (str) – The object ID of the trajectory written to trajectory_filename. This should not be given if configuration is a trajectory.
    Default: Chosen automatically.

Returns:

The Monte Carlo trajectory.

Return type:

MDTrajectory | Trajectory

Notes

The MetropolisMonteCarlo() method implements the Metropolis Monte Carlo scheme for sampling thermodynamic or structural properties. The method takes a class that specifies a set of moves that define the type of Monte Carlo simulation. These moves are randomly trialed, with each move being accepted or rejected stochastically based on the change in energy relative to the given temperature. In this way a non-autocorrelated sampling of the initial configuration, Trajectory or MDTrajectory is generated.

One example of a Monte Carlo model that can be generated with the MetropolisMonteCarlo() is the ContinuousRandomNetwork model. This model defines moves that alter the bonding of an input configuration, allowing for the generation of amorphous materials.