meld.system.restraints.COMRestraint

class meld.system.restraints.COMRestraint(system, scaler, ramp, group1, group2, weights1, weights2, dims, force_const, distance)[source]

Bases: meld.system.restraints.NonSelectableRestraint

Restraint on the distance between two groups along selected axes

This class implements a restraint on the distance between the center of two groups.

The weights used to calculate the center can be specified as weights1 and weights2. If these are None, then the masses of the atoms will be used.

The dims parameter controls which dimensions are used to compute the distance. For example if dims='xyz', then the distance will be the normal distance in all three dimensions. If dims='x', then only the x-component will be considered.

Restraints are typically added using RestraintMangager.create_restraint with the 'com' key:

>>> r = system.restraints.create_restraint('com', scaler, ramp=ramp,
                                           group1=group1, group2=group2,
                                           weights1=weights1,
                                           weights2=weights2,
                                           dims=dims,
                                           force_const=force_const,
                                           distance=distance)
__init__(system, scaler, ramp, group1, group2, weights1, weights2, dims, force_const, distance)[source]

Initialize a COMRestraint

Parameters
  • system (ISystem) – the system this restraint belongs to

  • scaler (Optional[RestraintScaler]) – scale the force with alpha

  • ramp (Optional[TimeRamp]) – scale the force over time

  • group1 (List[AtomIndex]) – atoms in group1

  • group2 (List[AtomIndex]) – atoms in group2

  • weights1 (List[float]) – Weights to use when calculating the COM. If None, then the atom masses will be used.

  • weights2 (List[float]) – Weights to use when calculating the COM. If None, then the atom masses will be used.

  • dims (str) – combination of x, y, z that determines which dimensions are used when calculating the distance

  • force_const (Quantity) – force constant in kJ/mol/nm^2

  • distance (Union[Quantity, Positioner]) – distance between groups

Methods

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

Initialize a COMRestraint