Path Integral Quantum Monte Carlo
Public Member Functions | Data Fields | Protected Attributes
Container Class Referenceabstract

The base class which holds details on the generalized box that our system will be simulated inside of. More...

#include <container.h>

+ Inheritance diagram for Container:

Public Member Functions

 Container ()
 Initialize all variables.
 
virtual ~Container ()
 Empty destructor.
 
void putInBC (dVec &r) const
 Place a vector in boundary conditions. More...
 
void putInBC1 (dVec &r) const
 
virtual void putInside (dVec &) const =0
 Place a vector inside the simulation cell.
 
virtual dVec randPosition (MTRand &) const =0
 Random position inside a box.
 
virtual dVec randUpdate (MTRand &, const dVec &) const =0
 Random updated position inside a box.
 
virtual int gridIndex (const dVec &) const =0
 Map a position into a grid index.
 
virtual double gridBoxVolume (const int) const =0
 The physical size of a NDIM-dimensional grid box.
 
double gridRadius2 (const int) const
 The radius of a grid box. More...
 

Data Fields

TinyVector< unsigned int, NDIMperiodic
 Determines which dimensions have periodic bc.
 
dVec side
 The linear dimensions of the box.
 
dVec sideInv
 The inverse box dimensions.
 
dVec sideInv2
 2 times the inverse box dimensions
 
double volume
 The volume of the container in A^3.
 
double rcut2
 The smallest separation squared.
 
double maxSep
 The maximum possible separation for 2 beads on the same timeslice.
 
string name
 The name of the container.
 
int numGrid
 The number of grid boxes for the position grid.
 
bool fullyPeriodic
 Is the prism fully periodic?
 
dVec gridSize
 The grid size in each dimension.
 

Protected Attributes

dVec pSide
 Periodic * side.
 

Detailed Description

The base class which holds details on the generalized box that our system will be simulated inside of.

This class implements boundary conditions, and holds details on the physical dimensions of the simulation cell.

Definition at line 24 of file container.h.

Member Function Documentation

◆ gridRadius2()

double Container::gridRadius2 ( const int  n) const

The radius of a grid box.

Given a grid box number, return the associated radius.

Parameters
nThe grid index
Returns
The radius squared x^2 + y^2 of the grid box

Definition at line 51 of file container.cpp.

51  {
52  iVec _gridIndex;
53  for (int i = 0; i < NDIM; i++) {
54  int scale = 1;
55  for (int j = i+1; j < NDIM; j++)
56  scale *= NGRIDSEP;
57  _gridIndex[i] = (n/scale) % NGRIDSEP;
58  PIMC_ASSERT(_gridIndex[i]<NGRIDSEP);
59  }
60 
61  double r2 = 0.0;
62  for (int i = 0; i < 2; i++) {
63  double ri = -0.5*side[i] + (_gridIndex[i] + 0.5)*gridSize[i];
64  r2 += ri*ri;
65  }
66  return r2;
67 }
dVec gridSize
The grid size in each dimension.
Definition: container.h:44
dVec side
The linear dimensions of the box.
Definition: container.h:31
#define NDIM
Number of spatial dimnsions.
Definition: common.h:71
#define NGRIDSEP
Spatial separations to be used in each dimension of the particle position grid.
Definition: common.h:93
#define PIMC_ASSERT(X)
Rename assert method.
Definition: common.h:64
TinyVector< int, NDIM > iVec
A NDIM-vector of type integer.
Definition: common.h:114

◆ putInBC()

void Container::putInBC ( dVec r) const
inline

Place a vector in boundary conditions.

Algorithm C4 from

See also
: Z. Phys. Chem. 227 (2013) 345–352

Definition at line 50 of file container.h.

50  {
51  r -= pSide*blitz::floor(r*sideInv + 0.5);
52  /* int k; */
53  /* for (int i = 0; i < NDIM; ++i) { */
54  /* k = int(r[i]*sideInv[i] + ((r[i]>=0.0)?0.5:-0.5)); */
55  /* r[i] -= k*pSide[i]; */
56  /* } */
57  }
dVec sideInv
The inverse box dimensions.
Definition: container.h:32
dVec pSide
Periodic * side.
Definition: container.h:97
+ Here is the caller graph for this function:

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