SymmetrySite
¶
-
class SymmetrySite : public OpenMM::VirtualSite¶
This is a VirtualSite that applies a rotation and translation to the position of a single other particle. It is useful for creating multiple copies of a molecule that are symmetrically arranged either with respect to each other or to the periodic box.
The transformation is defined by a rotation matrix R (specified by its rows Rx, Ry, and Rz). and a translation vector v. The position r’ of the virtual site is computed from the position r of the original particle as
r’x = Rxxrx + Rxyry + Rxzrz + vx
r’x = Ryyrx + Ryyry + Ryzrz + vy
r’x = Rzzrx + Rzyry + Rzzrz + vz
It can be applied in two different modes. When useBoxVectors is false the transformation is performed in Cartesian coordinates. When useBoxVectors is true it is performed in fractional coordinates as defined by the periodic box, which means that v acts as a set of scale factors for the periodic box vectors. This latter mode is convenient for building crystallographic unit cells composed of multiple symmetric molecules. It should be used with care: if R represents a rotation by any angle other than 0 or 180 degrees, performing the rotation in fractional coordinates can distort the molecule.
Public Functions
-
SymmetrySite(int particle, const Vec3 &Rx, const Vec3 &Ry, const Vec3 &Rz, const Vec3 &v, bool useBoxVectors)¶
Create a new SymmetrySite virtual site.
The arguments Rx, Ry, and Rz must form an orthogonal matrix (its transpose is its inverse).
- Parameters:
particle – the index of the particle the site depends on
Rx – the first row of the rotation matrix
Ry – the second row of the rotation matrix
Rz – the third row of the rotation matrix
v – the offset vector
useBoxVectors – specifies whether the transformation is performed in Cartesian or fractional coordinates
-
void getRotationMatrix(Vec3 &Rx, Vec3 &Ry, Vec3 &Rz) const¶
Get the rotation matrix.
- Parameters:
Rx – the first row of the rotation matrix
Ry – the second row of the rotation matrix
Rz – the third row of the rotation matrix
-
bool getUseBoxVectors() const¶
Get whether whether the transformation is performed in Cartesian or fractional coordinates.
-
SymmetrySite(int particle, const Vec3 &Rx, const Vec3 &Ry, const Vec3 &Rz, const Vec3 &v, bool useBoxVectors)¶