meld.system.restraints.GMMDistanceRestraint

class meld.system.restraints.GMMDistanceRestraint(system, scaler, ramp, n_distances, n_components, atoms, weights, means, precisions)[source]

Bases: SelectableRestraint

Restrain multiple distances using Gaussian mixture models

The energy has the form:

E = w1 N1 exp(-0.5 (r-u1)^T P1 (r-u1)) + w2 N2 exp(-0.5 (r-u2)^T P2 (r-u2)) + …

where:

w1, w2, … are the weights N1, N2, … are automatically calculated normalization factors r is the vector of distances for the atom pairs u1, u2, … are the mean vectors for each component P1, P2, … are the precision (inverse covariance) matrices for each component

__init__(system, scaler, ramp, n_distances, n_components, atoms, weights, means, precisions)[source]

Initialize a GMMDistanceRestraint

Parameters
  • system (ISystem) – system object that restraint belongs to

  • scaler (Optional[RestraintScaler]) – A Scaler to vary the force constant with alpha. If None, then a constant 1.0 scaler will be used.

  • ramp (Optional[TimeRamp]) – a time ramp to turn restraints on a beginning of simulation

  • n_distances (int) – number of distances involved in GMM; max 32

  • n_components (int) – number of mixture components; max 32

  • atoms (List[AtomIndex]) – a lit of length 2 * n_distances

  • weights (ndarray) – the weights for the mixture components, shape(n_components)

  • means (ndarray) – the means of each mixture component, shape(n_components, n_distances)

  • precisions (ndarray) – the precision (i.e. inverse covariance) of each mixture component, shape(n_components, n_distances, n_distances)

Methods

__init__(system, scaler, ramp, n_distances, ...)

Initialize a GMMDistanceRestraint

from_params(system, scaler, ramp, params)

Create a GMMDistanceRestraint from a GMMParams object.

classmethod from_params(system, scaler, ramp, params)[source]

Create a GMMDistanceRestraint from a GMMParams object.

Parameters
  • system (ISystem) – system object that restraint belongs to

  • scaler (Optional[RestraintScaler]) – A Scaler to vary the force constant with alpha. If None, then a constant 1.0 scaler will be used.

  • ramp (Optional[TimeRamp]) – a time ramp to turn restraints on a beginning of simulation

  • params (GMMParams) – object to build restraint from

Return type

GMMDistanceRestraint