LocalCoordinatesSite¶
-
class
simtk.openmm.openmm.
LocalCoordinatesSite
(*args)¶ This is a VirtualSite that uses the locations of several other particles to compute a local coordinate system, then places the virtual site at a fixed location in that coordinate system. The origin of the coordinate system and the directions of its x and y axes are each specified as a weighted sum of the locations of the other particles:
origin = w<sub>1</sub>r<sub>1</sub> + w<sub>2</sub>r<sub>2</sub> + w<sub>3</sub>r<sub>3</sub> + …
xdir = w<sub>1</sub>r<sub>1</sub> + w<sub>2</sub>r<sub>2</sub> + w<sub>3</sub>r<sub>3</sub> + …
ydir = w<sub>1</sub>r<sub>1</sub> + w<sub>2</sub>r<sub>2</sub> + w<sub>3</sub>r<sub>3</sub> + …
For the origin, the weights must add to one. For example if (w<sub>1</sub>, w<sub>2</sub>, w<sub>3</sub>) = (1.0, 0.0, 0.0), the origin of the local coordinate system is at the location of particle 1. For xdir and ydir, the weights must add to zero. For example, if (w<sub>1</sub>, w<sub>2</sub>, w<sub>3</sub>) = (-1.0, 0.5, 0.5), the x axis points from particle 1 toward the midpoint between particles 2 and 3.
The z direction is computed as zdir = xdir x ydir. To ensure the axes are all orthogonal, ydir is then recomputed as ydir = zdir x xdir. All three axis vectors are then normalized, and the virtual site location is set to
origin + x*xdir + y*ydir + z*zdir
-
__init__
(self, particles, originWeights, xWeights, yWeights, localPosition) → LocalCoordinatesSite¶ __init__(self, particle1, particle2, particle3, originWeights, xWeights, yWeights, localPosition) -> LocalCoordinatesSite __init__(self, other) -> LocalCoordinatesSite
Create a new LocalCoordinatesSite virtual site. This constructor assumes the site depends on exactly three other particles.
Parameters: - particle1 (int) – the index of the first particle
- particle2 (int) – the index of the second particle
- particle3 (int) – the index of the third particle
- originWeights (Vec3) – the weight factors for the three particles when computing the origin location
- xWeights (Vec3) – the weight factors for the three particles when computing xdir
- yWeights (Vec3) – the weight factors for the three particles when computing ydir
- localPosition (Vec3) – the position of the virtual site in the local coordinate system
Methods
__init__
(self, particles, originWeights, …)__init__(self, particle1, particle2, particle3, originWeights, xWeights, yWeights, localPosition) -> LocalCoordinatesSite __init__(self, other) -> LocalCoordinatesSite getLocalPosition
(self)Get the position of the virtual site in the local coordinate system. getNumParticles
(self)Get the number of particles this virtual site depends on. getOriginWeights
(self)Get the weight factors for the particles when computing the origin location. getParticle
(self, particle)Get the index of a particle this virtual site depends on. getXWeights
(self)Get the weight factors for the particles when computing xdir. getYWeights
(self)Get the weight factors for the particles when computing ydir. -
getOriginWeights
(self)¶ Get the weight factors for the particles when computing the origin location.
-
getXWeights
(self)¶ Get the weight factors for the particles when computing xdir.
-
getYWeights
(self)¶ Get the weight factors for the particles when computing ydir.
-
getLocalPosition
(self) → Vec3 const &¶ Get the position of the virtual site in the local coordinate system.
-
getNumParticles
(self) → int¶ Get the number of particles this virtual site depends on.
-
getParticle
(self, particle) → int¶ Get the index of a particle this virtual site depends on.
Parameters: particle (int) – the particle to get (between 0 and getNumParticles()) Returns: the index of the particle in the System Return type: int
-