All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
PLMD::Pbc Class Reference

#include <Pbc.h>

Public Member Functions

 Pbc ()
 Constructor. More...
 
double distance (const bool pbc, const Vector &v1, const Vector &v2) const
 Compute modulo of (v2-v1), using or not pbc depending on bool pbc. More...
 
Vector distance (const Vector &v1, const Vector &v2) const
 Computes v2-v1, using minimal image convention. More...
 
void setBox (const Tensor &b)
 Set the lattice vectors. More...
 
const TensorgetBox () const
 Returns the box. More...
 
const TensorgetInvBox () const
 Returns the inverse matrix of box. More...
 
Vector realToScaled (const Vector &) const
 Transform a vector in real space to a vector in scaled coordinates. More...
 
Vector scaledToReal (const Vector &) const
 Transform a vector in scaled coordinates to a vector in real space. More...
 
bool isOrthorombic () const
 Returns true if the box vectors are orthogonal. More...
 

Static Public Member Functions

static void test ()
 Perform some check. Useful for debugging. More...
 

Private Types

enum  { unset, orthorombic, generic }
 Type of box. More...
 

Private Member Functions

void buildShifts (std::vector< Vector > shifts[2][2][2]) const
 Build list of shifts. More...
 
void fullSearch (Vector &) const
 Full search (for testing) More...
 
Vector distance (const Vector &, const Vector &, int *nshifts) const
 internal version of distance, also returns the number of attempted shifts (used in Pbc::test()). More...
 

Private Attributes

enum PLMD::Pbc:: { ... }  type
 Type of box. More...
 
Tensor box
 Box. More...
 
Tensor invBox
 Inverse box. More...
 
Tensor reduced
 Reduced box. More...
 
Tensor invReduced
 Inverse of the reduced box. More...
 
std::vector< Vectorshifts [2][2][2]
 List of shifts that should be attempted. More...
 
Vector diag
 Alternative representation for orthorombic cells. More...
 
Vector hdiag
 
Vector mdiag
 

Detailed Description

Definition at line 38 of file Pbc.h.

Member Enumeration Documentation

anonymous enum
private

Type of box.

Enumerator
unset 
orthorombic 
generic 

Definition at line 40 of file Pbc.h.

Constructor & Destructor Documentation

PLMD::Pbc::Pbc ( )

Constructor.

Definition at line 32 of file Pbc.cpp.

Member Function Documentation

void PLMD::Pbc::buildShifts ( std::vector< Vector shifts[2][2][2]) const
private

Build list of shifts.

This is expensive, and must be called only when box is reset. It allows building a minimal set of shifts depending on the sign of the scaled coordinates representing a distance vector.

Definition at line 39 of file Pbc.cpp.

Vector PLMD::Pbc::distance ( const Vector v1,
const Vector v2,
int *  nshifts 
) const
private

internal version of distance, also returns the number of attempted shifts (used in Pbc::test()).

Definition at line 158 of file Pbc.cpp.

double PLMD::Pbc::distance ( const bool  pbc,
const Vector v1,
const Vector v2 
) const

Compute modulo of (v2-v1), using or not pbc depending on bool pbc.

Definition at line 153 of file Pbc.cpp.

Vector PLMD::Pbc::distance ( const Vector v1,
const Vector v2 
) const
inline

Computes v2-v1, using minimal image convention.

Definition at line 98 of file Pbc.h.

void PLMD::Pbc::fullSearch ( Vector d) const
private

Full search (for testing)

Definition at line 93 of file Pbc.cpp.

const Tensor & PLMD::Pbc::getBox ( ) const

Returns the box.

Definition at line 214 of file Pbc.cpp.

const Tensor & PLMD::Pbc::getInvBox ( ) const

Returns the inverse matrix of box.

Thus: pbc.getInvBox() == inverse(pbc.getBox()).

Definition at line 218 of file Pbc.cpp.

bool PLMD::Pbc::isOrthorombic ( ) const

Returns true if the box vectors are orthogonal.

Definition at line 210 of file Pbc.cpp.

Vector PLMD::Pbc::realToScaled ( const Vector d) const

Transform a vector in real space to a vector in scaled coordinates.

Thus:pbc.realToScaled(v) == matmul(transpose(inverse(pbc.getBox(),v)));

Definition at line 202 of file Pbc.cpp.

Vector PLMD::Pbc::scaledToReal ( const Vector d) const

Transform a vector in scaled coordinates to a vector in real space.

Thus:pbc.scaledToRead(v) == matmul(transpose(pbc.getBox()),v);

Definition at line 206 of file Pbc.cpp.

void PLMD::Pbc::setBox ( const Tensor b)

Set the lattice vectors.

b[i][j] is the j-th component of the i-th vector

Definition at line 115 of file Pbc.cpp.

void PLMD::Pbc::test ( )
static

Perform some check. Useful for debugging.

Definition at line 222 of file Pbc.cpp.

Member Data Documentation

Tensor PLMD::Pbc::box
private

Box.

Definition at line 42 of file Pbc.h.

Vector PLMD::Pbc::diag
private

Alternative representation for orthorombic cells.

Not really used, but could be used to optimize search in orthorombic cells.

Definition at line 58 of file Pbc.h.

Vector PLMD::Pbc::hdiag
private

Definition at line 58 of file Pbc.h.

Tensor PLMD::Pbc::invBox
private

Inverse box.

Definition at line 44 of file Pbc.h.

Tensor PLMD::Pbc::invReduced
private

Inverse of the reduced box.

Definition at line 50 of file Pbc.h.

Vector PLMD::Pbc::mdiag
private

Definition at line 58 of file Pbc.h.

Tensor PLMD::Pbc::reduced
private

Reduced box.

This is a set of lattice vectors generating the same lattice but "minimally skewed". Useful to optimize image search.

Definition at line 48 of file Pbc.h.

std::vector<Vector> PLMD::Pbc::shifts[2][2][2]
private

List of shifts that should be attempted.

Depending on the sign of the scaled coordinates representing a distance vector, a different set of shifts must be tried.

Definition at line 54 of file Pbc.h.

enum { ... } PLMD::Pbc::type

Type of box.


The documentation for this class was generated from the following files: