meld.system.montecarlo

Functions

generate_uniform_angle()

Generate a uniform angle in (0, 360] :returns: :rtype: float

metropolis(current_energy, trial_energy, bias)

Perform a Metropolis accept/reject step.

rotate_around_vector(p1, p2, angle, points)

param p1

First point on axis to rotate around

Classes

DoubleTorsionMover(index1a, index1b, …)

MonteCarloScheduler(movers_with_weights, …)

Weighted random selection of Monte Carlo moves

RandomTorsionMover(index1, index2, atom_indices)

Rotate a torsion to a random angle

TranslationMover(atom_indices[, move_size])

Translate a chain

class meld.system.montecarlo.MonteCarloScheduler(movers_with_weights, update_trials)[source]

Weighted random selection of Monte Carlo moves

update(starting_state, runner)[source]

Perform a series of Monte Carlo moves

Parameters
  • starting_state (SystemState) – Initial state of system

  • runner (OpenMMRunner) – Runner to evaluate energies

  • n_trials (int) – Number of trials to run

Returns

The system state after Monte Carlo trials

Return type

SystemState

class meld.system.montecarlo.RandomTorsionMover(index1, index2, atom_indices)[source]

Rotate a torsion to a random angle

trial(state, runner)[source]

Perform a Metropolis trial

Parameters
  • state (SystemState) – Initial state of the system

  • runner (OpenMMRunner) – Runner to evaluate the energies

Returns

System state after trial and indiciator if trial was accepted

Return type

SystemState, boolean

class meld.system.montecarlo.TranslationMover(atom_indices, move_size=0.1)[source]

Translate a chain

trial(state, runner)[source]

Perform a metropolis trial

Parameters
  • state – initial SystemState

  • runnerOpenMMRunner to evaluate the energies

Returns

updated SystemState

meld.system.montecarlo.generate_uniform_angle()[source]

Generate a uniform angle in (0, 360] :returns: :rtype: float

meld.system.montecarlo.metropolis(current_energy, trial_energy, bias)[source]

Perform a Metropolis accept/reject step.

Parameters
  • current_energy (float) – Current energy in units of kT

  • trial_energy (float) – Energy of trial in units of kT

  • bias (float) – Negative log of ratio of forward and reverse move probabilities

Returns

Indicates if step should be accepted

Return type

boolean

meld.system.montecarlo.rotate_around_vector(p1, p2, angle, points)[source]
Parameters
  • p1 (ndarray) – First point on axis to rotate around

  • p2 (ndarray) – Second point on axis to rotate around

  • angle (float) – Angle in degrees

  • points (ndarray) – Numpy array of shape (n_atoms, 3)

Returns

Rotate array of shape (n_atoms, 3)

Return type

ndarray