# meld.system.openmm_runner.transform.restraints¶

This module implements transformers that add restraint forces to the openmm system before simulation

Classes

 AbsoluteCOMRestraintTransformer(options, …) COMRestraintTransformer(options, …) CartesianRestraintTransformer(options, …) ConfinementRestraintTransformer(options, …) Transformer to handle confinement restraints DefaultOrderedDict([default_factory]) MeldRestraintTransformer(options, …) OldRDCRestraintTransformer(options, …) RDCRestraintTransformer(options, …) YZCartesianTransformer(options, …)
class meld.system.openmm_runner.transform.restraints.AbsoluteCOMRestraintTransformer(options, always_active_restraints, selectively_active_restraints)[source]
add_interactions(system, topology)[source]

Add new interactions to the system.

This may involve: - Adding new forces, e.g. for restraints - Replacing an existing force with another, e.g. softcore

interactions

This method must return the modified system. If the transformer does not add interactions, it may simply return the passed values.

Parameters
• system (simtk.openmm.System) – OpenMM system object to be modified

• topology (simtk.openmm.Topology) – OpenMM topology object to be modified and/or used for indexing

finalize(system, topology)

Finalize the transformer.

This method is guaranteed to be called after all forces are added to the system and provides an opportunity to do bookkeeping.

This method should not add any new forces.

Parameters
• system (simtk.openmm.System) – OpenMM system object to be modified

• topology (simtk.openmm.Topology) – OpenMM topology object to be modified and/or used for indexing

update(simulation, alpha, timestep)[source]

Update the system according to alpha and timestep.

This method is called at the beginning of every stage. It should update forces and parameters as necessary.

Parameters
• simulation (simtk.openmm.app.simulation) – OpenMM simulation object to be modified

• alpha (float) – Current value of alpha, ranges from 0 to 1

• stage (int) – Current stage of the simulation, starting from 0

class meld.system.openmm_runner.transform.restraints.COMRestraintTransformer(options, always_active_restraints, selectively_active_restraints)[source]
add_interactions(system, topology)[source]

Add new interactions to the system.

This may involve: - Adding new forces, e.g. for restraints - Replacing an existing force with another, e.g. softcore

interactions

This method must return the modified system. If the transformer does not add interactions, it may simply return the passed values.

Parameters
• system (simtk.openmm.System) – OpenMM system object to be modified

• topology (simtk.openmm.Topology) – OpenMM topology object to be modified and/or used for indexing

finalize(system, topology)

Finalize the transformer.

This method is guaranteed to be called after all forces are added to the system and provides an opportunity to do bookkeeping.

This method should not add any new forces.

Parameters
• system (simtk.openmm.System) – OpenMM system object to be modified

• topology (simtk.openmm.Topology) – OpenMM topology object to be modified and/or used for indexing

update(simulation, alpha, timestep)[source]

Update the system according to alpha and timestep.

This method is called at the beginning of every stage. It should update forces and parameters as necessary.

Parameters
• simulation (simtk.openmm.app.simulation) – OpenMM simulation object to be modified

• alpha (float) – Current value of alpha, ranges from 0 to 1

• stage (int) – Current stage of the simulation, starting from 0

class meld.system.openmm_runner.transform.restraints.CartesianRestraintTransformer(options, always_active_restraints, selectively_active_restraints)[source]
add_interactions(system, topology)[source]

Add new interactions to the system.

This may involve: - Adding new forces, e.g. for restraints - Replacing an existing force with another, e.g. softcore

interactions

This method must return the modified system. If the transformer does not add interactions, it may simply return the passed values.

Parameters
• system (simtk.openmm.System) – OpenMM system object to be modified

• topology (simtk.openmm.Topology) – OpenMM topology object to be modified and/or used for indexing

finalize(system, topology)

Finalize the transformer.

This method is guaranteed to be called after all forces are added to the system and provides an opportunity to do bookkeeping.

This method should not add any new forces.

Parameters
• system (simtk.openmm.System) – OpenMM system object to be modified

• topology (simtk.openmm.Topology) – OpenMM topology object to be modified and/or used for indexing

update(simulation, alpha, timestep)[source]

Update the system according to alpha and timestep.

This method is called at the beginning of every stage. It should update forces and parameters as necessary.

Parameters
• simulation (simtk.openmm.app.simulation) – OpenMM simulation object to be modified

• alpha (float) – Current value of alpha, ranges from 0 to 1

• stage (int) – Current stage of the simulation, starting from 0

class meld.system.openmm_runner.transform.restraints.ConfinementRestraintTransformer(options, always_active_restraints, selectively_active_restraints)[source]

Transformer to handle confinement restraints

add_interactions(system, topology)[source]

Add new interactions to the system.

This may involve: - Adding new forces, e.g. for restraints - Replacing an existing force with another, e.g. softcore

interactions

This method must return the modified system. If the transformer does not add interactions, it may simply return the passed values.

Parameters
• system (simtk.openmm.System) – OpenMM system object to be modified

• topology (simtk.openmm.Topology) – OpenMM topology object to be modified and/or used for indexing

finalize(system, topology)

Finalize the transformer.

This method is guaranteed to be called after all forces are added to the system and provides an opportunity to do bookkeeping.

This method should not add any new forces.

Parameters
• system (simtk.openmm.System) – OpenMM system object to be modified

• topology (simtk.openmm.Topology) – OpenMM topology object to be modified and/or used for indexing

update(simulation, alpha, timestep)[source]

Update the system according to alpha and timestep.

This method is called at the beginning of every stage. It should update forces and parameters as necessary.

Parameters
• simulation (simtk.openmm.app.simulation) – OpenMM simulation object to be modified

• alpha (float) – Current value of alpha, ranges from 0 to 1

• stage (int) – Current stage of the simulation, starting from 0

class meld.system.openmm_runner.transform.restraints.DefaultOrderedDict(default_factory=None, *a, **kw)[source]
clear() → None. Remove all items from od.
copy() → a shallow copy of od[source]
fromkeys(S[, v]) → New ordered dictionary with keys from S.

If not specified, the value defaults to None.

get(k[, d]) → D[k] if k in D, else d. d defaults to None.
items() → a set-like object providing a view on D's items
keys() → a set-like object providing a view on D's keys
move_to_end()

Move an existing element to the end (or beginning if last==False).

Raises KeyError if the element does not exist. When last=True, acts like a fast version of self[key]=self.pop(key).

pop(k[, d]) → v, remove specified key and return the corresponding

value. If key is not found, d is returned if given, otherwise KeyError is raised.

popitem()

Remove and return a (key, value) pair from the dictionary.

Pairs are returned in LIFO order if last is true or FIFO order if false.

setdefault(k[, d]) → od.get(k,d), also set od[k]=d if k not in od
update([E, ]**F) → None. Update D from dict/iterable E and F.

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values() → an object providing a view on D's values
class meld.system.openmm_runner.transform.restraints.MeldRestraintTransformer(options, always_active_restraints, selectively_active_restraints)[source]
add_interactions(system, topology)[source]

Add new interactions to the system.

This may involve: - Adding new forces, e.g. for restraints - Replacing an existing force with another, e.g. softcore

interactions

This method must return the modified system. If the transformer does not add interactions, it may simply return the passed values.

Parameters
• system (simtk.openmm.System) – OpenMM system object to be modified

• topology (simtk.openmm.Topology) – OpenMM topology object to be modified and/or used for indexing

finalize(system, topology)

Finalize the transformer.

This method is guaranteed to be called after all forces are added to the system and provides an opportunity to do bookkeeping.

This method should not add any new forces.

Parameters
• system (simtk.openmm.System) – OpenMM system object to be modified

• topology (simtk.openmm.Topology) – OpenMM topology object to be modified and/or used for indexing

update(simulation, alpha, timestep)[source]

Update the system according to alpha and timestep.

This method is called at the beginning of every stage. It should update forces and parameters as necessary.

Parameters
• simulation (simtk.openmm.app.simulation) – OpenMM simulation object to be modified

• alpha (float) – Current value of alpha, ranges from 0 to 1

• stage (int) – Current stage of the simulation, starting from 0

class meld.system.openmm_runner.transform.restraints.OldRDCRestraintTransformer(options, always_active_restraints, selectively_active_restraints)[source]
add_interactions(system, topology)[source]

Add new interactions to the system.

This may involve: - Adding new forces, e.g. for restraints - Replacing an existing force with another, e.g. softcore

interactions

This method must return the modified system. If the transformer does not add interactions, it may simply return the passed values.

Parameters
• system (simtk.openmm.System) – OpenMM system object to be modified

• topology (simtk.openmm.Topology) – OpenMM topology object to be modified and/or used for indexing

finalize(system, topology)

Finalize the transformer.

This method is guaranteed to be called after all forces are added to the system and provides an opportunity to do bookkeeping.

This method should not add any new forces.

Parameters
• system (simtk.openmm.System) – OpenMM system object to be modified

• topology (simtk.openmm.Topology) – OpenMM topology object to be modified and/or used for indexing

update(simulation, alpha, timestep)[source]

Update the system according to alpha and timestep.

This method is called at the beginning of every stage. It should update forces and parameters as necessary.

Parameters
• simulation (simtk.openmm.app.simulation) – OpenMM simulation object to be modified

• alpha (float) – Current value of alpha, ranges from 0 to 1

• stage (int) – Current stage of the simulation, starting from 0

class meld.system.openmm_runner.transform.restraints.RDCRestraintTransformer(options, always_active_restraints, selectively_active_restraints)[source]
add_interactions(system, topology)[source]

Add new interactions to the system.

This may involve: - Adding new forces, e.g. for restraints - Replacing an existing force with another, e.g. softcore

interactions

This method must return the modified system. If the transformer does not add interactions, it may simply return the passed values.

Parameters
• system (simtk.openmm.System) – OpenMM system object to be modified

• topology (simtk.openmm.Topology) – OpenMM topology object to be modified and/or used for indexing

finalize(system, topology)

Finalize the transformer.

This method is guaranteed to be called after all forces are added to the system and provides an opportunity to do bookkeeping.

This method should not add any new forces.

Parameters
• system (simtk.openmm.System) – OpenMM system object to be modified

• topology (simtk.openmm.Topology) – OpenMM topology object to be modified and/or used for indexing

update(simulation, alpha, timestep)[source]

Update the system according to alpha and timestep.

This method is called at the beginning of every stage. It should update forces and parameters as necessary.

Parameters
• simulation (simtk.openmm.app.simulation) – OpenMM simulation object to be modified

• alpha (float) – Current value of alpha, ranges from 0 to 1

• stage (int) – Current stage of the simulation, starting from 0

class meld.system.openmm_runner.transform.restraints.YZCartesianTransformer(options, always_active_restraints, selectively_active_restraints)[source]
add_interactions(system, topology)[source]

Add new interactions to the system.

This may involve: - Adding new forces, e.g. for restraints - Replacing an existing force with another, e.g. softcore

interactions

This method must return the modified system. If the transformer does not add interactions, it may simply return the passed values.

Parameters
• system (simtk.openmm.System) – OpenMM system object to be modified

• topology (simtk.openmm.Topology) – OpenMM topology object to be modified and/or used for indexing

finalize(system, topology)

Finalize the transformer.

This method is guaranteed to be called after all forces are added to the system and provides an opportunity to do bookkeeping.

This method should not add any new forces.

Parameters
• system (simtk.openmm.System) – OpenMM system object to be modified

• topology (simtk.openmm.Topology) – OpenMM topology object to be modified and/or used for indexing

update(simulation, alpha, timestep)[source]

Update the system according to alpha and timestep.

This method is called at the beginning of every stage. It should update forces and parameters as necessary.

Parameters
• simulation (simtk.openmm.app.simulation) – OpenMM simulation object to be modified

• alpha (float) – Current value of alpha, ranges from 0 to 1

• stage (int) – Current stage of the simulation, starting from 0