OrientationRestraintForce¶
- class openmm.openmm.OrientationRestraintForce(*args)¶
This is an approximately harmonic restraint force for keeping a group of particles in a particular orientation. You specify a set of particles and reference positions for them. It finds the rigid transformation that optimally aligns the particles to the reference positions, consisting of a translation followed by a rotation. The interaction energy is 2*k*sin^2(theta/2), where theta is the rotation angle and k is a user defined force constant. When the particles are close to the target orientation, this approximately equals the harmonic form (k/2)*theta^2. For larger angles, the force is reduced from the harmonic form, and it goes to zero at theta=pi/2. This avoids the discontinuity in the force that would be present if the force were nonzero at pi/2.
- __init__(self, k, referencePositions, particles=std::vector< int >()) OrientationRestraintForce ¶
- __init__(self, other) OrientationRestraintForce
Create an OrientationRestraintForce.
- Parameters:
k (float) – the force constant, measured in kJ/mol
referencePositions (Sequence[Vec3]) – the reference positions to compute the rotation from. The length of this vector must equal the number of particles in the system, even if not all particles are used in computing the rotation.
particles (Sequence[int]) – the indices of the particles to use when computing the rotation. If this is empty (the default), all particles in the system will be used.
Methods
__init__
() -> OrientationRestraintForce)Create an OrientationRestraintForce.
getForceGroup
(self)Get the force group this Force belongs to.
getK
(self)Get the force constant.
getName
(self)Get the name of this Force.
getParticles
(self)Get the indices of the particles to use when computing the rotation.
getReferencePositions
(self)Get the reference positions to compute the rotation from.
setForceGroup
(self, group)Set the force group this Force belongs to.
setK
(self, k)Set the force constant.
setName
(self, name)Set the name of this Force.
setParticles
(self, particles)Set the indices of the particles to use when computing the rotation.
setReferencePositions
(self, positions)Set the reference positions to compute the rotation from.
updateParametersInContext
(self, context)Update the reference positions and particle indices in a Context to match those stored in this Force object.
Returns whether or not this force makes use of periodic boundary conditions.
Attributes
The membership flag
- property thisown¶
The membership flag
- getK(self) float ¶
Get the force constant.
- Returns:
the force constant in kJ/mol
- Return type:
float
- setK(self, k)¶
Set the force constant.
- Parameters:
k (float) – the force constant, measured in kJ/mol
- setReferencePositions(self, positions)¶
Set the reference positions to compute the rotation from.
- getParticles(self) tuple[int, ...] ¶
Get the indices of the particles to use when computing the rotation. If this is empty, all particles in the system will be used.
- setParticles(self, particles)¶
Set the indices of the particles to use when computing the rotation. If this is empty, all particles in the system will be used.
- updateParametersInContext(self, context)¶
Update the reference positions and particle indices in a Context to match those stored in this Force object. This method provides an efficient method to update certain parameters in an existing Context without needing to reinitialize it. Simply call setReferencePositions() setParticles(), and setK() to modify this object’s parameters, then call updateParametersInContext() to copy them over to the Context.
- usesPeriodicBoundaryConditions(self) bool ¶
Returns whether or not this force makes use of periodic boundary conditions.
- Returns:
true if force uses PBC and false otherwise
- Return type:
bool
- getForceGroup(self) int ¶
Get the force group this Force belongs to.
- getName(self) str ¶
Get the name of this Force. This is an arbitrary, user modifiable identifier. By default it equals the class name, but you can change it to anything useful.
- setForceGroup(self, group)¶
Set the force group this Force belongs to.
- Parameters:
group (int) – the group index. Legal values are between 0 and 31 (inclusive).
- setName(self, name)¶
Set the name of this Force. This is an arbitrary, user modifiable identifier. By default it equals the class name, but you can change it to anything useful.