[]Trait lumol::sim::mc::MCMove

pub trait MCMove {
    fn describe(&self) -> &str;
fn setup(&mut self, system: &System);
fn degrees_of_freedom(&self) -> MCDegreeOfFreedom;
fn prepare(&mut self, system: &mut System, rng: &mut dyn RngCore) -> bool;
fn cost(&self, system: &System, beta: f64, cache: &mut EnergyCache) -> f64;
fn apply(&mut self, system: &mut System);
fn restore(&mut self, system: &mut System);
fn update_amplitude(&mut self, scaling_factor: Option<f64>); }

The MCMove trait correspond to the set of methods used in Monte Carlo simulations.

Required methods

fn describe(&self) -> &str

Give a short description of this move

fn setup(&mut self, system: &System)

Set up move before simulation is run

fn degrees_of_freedom(&self) -> MCDegreeOfFreedom

Get the number of degrees of freedom simulated by this move

fn prepare(&mut self, system: &mut System, rng: &mut dyn RngCore) -> bool

Prepare the move by selecting the particles to move, and the parameters of the move. The rng random number generator should be used to generate the parameters of the move.

This function should return true is we can perform the move, and false otherwise.

fn cost(&self, system: &System, beta: f64, cache: &mut EnergyCache) -> f64

Get the cost of performing this move on system. For example in simple NVT simulations, this cost is the energetic difference between the new and the old state times beta. The cost must be dimmensionless.

Note that the cost will be placed in an exponential with a negative sign. For NVT using the Metropolis criterion: cost = beta*(U_new - U_old) -> P_acc = min[1, exp(-cost)].

The cache should be used to compute the cost, or the cache.unused function should be used to ensure that the cache is updated as needed after this move.

fn apply(&mut self, system: &mut System)

Apply the move, if it has not already been done in prepare.

fn restore(&mut self, system: &mut System)

Restore the system to it's initial state if it has been changed in prepare.

fn update_amplitude(&mut self, scaling_factor: Option<f64>)

Update the sample range for displacements.

Loading content...


impl MCMove for Resize

impl MCMove for Rotate

impl MCMove for Translate

Loading content...