Simpatico
v1.10
|
A monoclinic periodic unit cell.
Definition at line 42 of file MonoclinicBoundary.h.
#include <MonoclinicBoundary.h>
Public Member Functions | |
MonoclinicBoundary () | |
Constructor. More... | |
void | setMonoclinic (const Vector &lengths, const double d) |
Set unit cell dimensions for orthorhombic boundary. More... | |
void | setOrthorhombic (const Vector &lengths) |
Invalid function for monoclinic - throws Exception. More... | |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
Serialize to/from an archive. More... | |
Periodic Boundary Conditions - Coordinate Shifting | |
void | shift (Vector &r) const |
Shift Vector r to its image within the primary unit cell. More... | |
void | shift (Vector &r, IntVector &shift) const |
Shift Vector r to its image within the primary unit cell. More... | |
void | shiftGen (Vector &r) const |
Shift generalized Vector r to its primary image. More... | |
void | shiftGen (Vector &r, IntVector &shift) const |
Shift generalized Vector r to its primary image. More... | |
void | applyShift (Vector &r, int i, int t) const |
Shift Cartesian Vector r by multiple t of a Bravais lattice vector. More... | |
Periodic Boundary Conditions - Minimum Image Separations | |
double | distanceSq (const Vector &r1, const Vector &r2) const |
Return square distance between r1 and r2, with minimum image convention. More... | |
double | distanceSq (const Vector &r1, const Vector &r2, IntVector &shift) const |
Return square distance between r1 and r2, with minimum image convention. More... | |
double | distanceSq (const Vector &r1, const Vector &r2, Vector &dr) const |
Return square distance between r1 and r2, with minimum image convention. More... | |
Coordinate Transformations | |
void | transformCartToGen (const Vector &Rc, Vector &Rg) const |
Transform Vector of Cartesian coordinates to generalized coordinates. More... | |
void | transformGenToCart (const Vector &Rg, Vector &Rc) const |
Transform Vector of generalized coordinates to Cartesian coordinates. More... | |
Accessors | |
LatticeSystem | latticeSystem () |
Return actual lattice system. More... | |
const Vector & | lengths () const |
Get Vector of distances between faces of primitive cell. More... | |
double | length (int i) const |
Get distance across primitive cell along reciprocal basis vector i. More... | |
double | minLength () const |
Get minimum length across primitive unit cell. More... | |
double | volume () const |
Return unit cell volume. More... | |
const Vector & | bravaisBasisVector (int i) const |
Return Bravais lattice vector i. More... | |
const Vector & | reciprocalBasisVector (int i) const |
Return reciprocal lattice basis vector i. More... | |
void | randomPosition (Random &random, Vector &r) const |
Generate random Cartesian position within the primary unit cell. More... | |
bool | isValid () |
Return true if valid, or throw Exception. More... | |
Friends | |
class | ::MonoclinicBoundaryTest |
Unit test. More... | |
std::istream & | operator>> (std::istream &in, MonoclinicBoundary &boundary) |
istream extractor More... | |
std::ostream & | operator<< (std::ostream &out, const MonoclinicBoundary &boundary) |
ostream inserter More... | |
Simp::MonoclinicBoundary::MonoclinicBoundary | ( | ) |
Constructor.
Definition at line 23 of file MonoclinicBoundary.cpp.
References Util::Dimension, Util::Constants::Pi, and Util::Vector::Zero.
void Simp::MonoclinicBoundary::setMonoclinic | ( | const Vector & | lengths, |
const double | d | ||
) |
Set unit cell dimensions for orthorhombic boundary.
Also sets all related lengths and volume.
lengths | Vector of unit cell dimensions, orthogonal box. |
d | displacement along z axis. |
Definition at line 50 of file MonoclinicBoundary.cpp.
References lengths().
void Simp::MonoclinicBoundary::setOrthorhombic | ( | const Vector & | lengths | ) |
Invalid function for monoclinic - throws Exception.
lengths | Vector of unit cell dimensions, orthogonal box. |
Definition at line 60 of file MonoclinicBoundary.cpp.
References Util::Dimension, lengths(), and Util::Constants::Pi.
void Simp::MonoclinicBoundary::serialize | ( | Archive & | ar, |
const unsigned int | version | ||
) |
Serialize to/from an archive.
ar | saving or loading archive |
version | archive version id |
Definition at line 730 of file MonoclinicBoundary.h.
References Util::bcast< MonoclinicBoundary >(), isValid(), Util::recv< MonoclinicBoundary >(), and Util::send< MonoclinicBoundary >().
|
inline |
Shift Vector r to its image within the primary unit cell.
On output the vector r is shifted its image in the primary unit cell.
r | Vector of coordinates |
Definition at line 402 of file MonoclinicBoundary.h.
Shift Vector r to its image within the primary unit cell.
This method shifts a vector to its image in the primary unit cell, and also increments a corresponding atomic shift IntVector:
If the Vector r is shifted by r -> r - sum_i t[i]*a_i, then the IntVector shift parameter is incremented by shift -> shift + t, where t is an IntVector and a_i is Bravais basis vector number i.
r | Vector of Cartesian coordinates |
shift | integer shifts required to obtain "true" coordinates. |
Definition at line 436 of file MonoclinicBoundary.h.
|
inline |
Shift generalized Vector r to its primary image.
One output, each coordinate r[i] is shifted by an integer, so as to lie within the range 0 < r[i] < 1.0
Precondition: The algorithm assumes that on input, for each i=0,..,2, -1.0 < r[i] < 2.0, and throws an Exception otherwise.
r | Vector of generalized coordinates |
Definition at line 495 of file MonoclinicBoundary.h.
References Util::Dimension.
Shift generalized Vector r to its primary image.
This method maps a vector of generalized coordinates to lie in the primary cell, and also increments the atomic shift IntVector:
If r[i] -> r[i] - t, then shift[i] -> shift[i] + t.
r | Vector of generalized coordinates (in/out) |
shift | integer shifts, modified on output (in/out) |
Definition at line 513 of file MonoclinicBoundary.h.
References Util::Dimension.
|
inline |
Shift Cartesian Vector r by multiple t of a Bravais lattice vector.
This method shifts the Vector r by a specified amount:
r -> r + t*a_i
where a_i is Bravais lattice basis vector number i.
r | Vector of Cartesian coordinates |
i | index for direction (basis vector) of shift |
t | multiple added of Bravais basis vector a_i |
Definition at line 476 of file MonoclinicBoundary.h.
Return square distance between r1 and r2, with minimum image convention.
r1 | first position Vector |
r2 | second position Vector |
Definition at line 588 of file MonoclinicBoundary.h.
|
inline |
Return square distance between r1 and r2, with minimum image convention.
r1 | first position Vector |
r2 | second position Vector |
shift | shift added to r1 to create nearest image of r2. |
Definition at line 533 of file MonoclinicBoundary.h.
|
inline |
Return square distance between r1 and r2, with minimum image convention.
Upon return, Vector dr contains the separation r1 - r2, using the nearest image convention. Returns the square of the absolute magnitude of the separation dr.
r1 | first position Vector |
r2 | second position Vector |
dr | separation Vector (upon return) |
Definition at line 632 of file MonoclinicBoundary.h.
References operator<<, and operator>>.
Transform Vector of Cartesian coordinates to generalized coordinates.
Returns the generalized coordinates of Cartesian input Rc in output Rg.
Generalized coordinates range from 0.0 <= Rg[i] < 1.0 within the primitive cell, for i = 0,..,2.
Rc | Vector of Cartesian coordinates (input) |
Rg | Vector of generalized coordinates (output) |
Definition at line 706 of file MonoclinicBoundary.h.
Transform Vector of generalized coordinates to Cartesian coordinates.
Returns the Cartesian coordinates of input Rg in output Rc.
Rg | Vector of generalized coordinates (input) |
Rc | Vector of Cartesian coordinates (output) |
Definition at line 718 of file MonoclinicBoundary.h.
Referenced by randomPosition().
|
inline |
Return actual lattice system.
Return value for this class is Monoclinic.
Definition at line 699 of file MonoclinicBoundary.h.
|
inline |
Get Vector of distances between faces of primitive cell.
Each component of this vector is projection of a Bravais lattice unit vector onto a line parallel to the corresponding reciprocal lattice basis vector. The resulting distances are distances between faces of the primitive unit cell, which are normal to the reciprocal lattice unit vectors.
Definition at line 366 of file MonoclinicBoundary.h.
Referenced by setMonoclinic(), and setOrthorhombic().
|
inline |
Get distance across primitive cell along reciprocal basis vector i.
i | index of Cartesian direction, 0 <= i < Dimension |
Definition at line 372 of file MonoclinicBoundary.h.
|
inline |
Get minimum length across primitive unit cell.
Definition at line 396 of file MonoclinicBoundary.h.
|
inline |
Return unit cell volume.
Definition at line 378 of file MonoclinicBoundary.h.
|
inline |
Return Bravais lattice vector i.
i | basis Vector index. |
Definition at line 384 of file MonoclinicBoundary.h.
|
inline |
Return reciprocal lattice basis vector i.
i | basis Vector index. |
Definition at line 390 of file MonoclinicBoundary.h.
Generate random Cartesian position within the primary unit cell.
random | random number generator object |
r | Vector of random Cartesian coordinates (upon return) |
Definition at line 106 of file MonoclinicBoundary.cpp.
References Util::Dimension, transformGenToCart(), and Util::Random::uniform().
bool Simp::MonoclinicBoundary::isValid | ( | ) |
Return true if valid, or throw Exception.
Definition at line 118 of file MonoclinicBoundary.cpp.
References Util::Dimension, Util::feq(), Util::Constants::Pi, and UTIL_THROW.
Referenced by serialize().
|
friend |
Unit test.
Definition at line 333 of file MonoclinicBoundary.h.
|
friend |
istream extractor
in | input stream |
boundary | MonoclinicBoundary to be read from stream |
Definition at line 161 of file MonoclinicBoundary.cpp.
Referenced by distanceSq().
|
friend |
ostream inserter
out | output stream |
boundary | MonoclinicBoundary to be written to stream |
Definition at line 178 of file MonoclinicBoundary.cpp.
Referenced by distanceSq().