1 #ifndef DDMD_CELL_LIST_H 2 #define DDMD_CELL_LIST_H 12 #include <ddMd/chemistry/Atom.h> 13 #include <simp/boundary/Boundary.h> 14 #include <util/space/Grid.h> 15 #include <util/containers/DArray.h> 16 #include <util/containers/GArray.h> 135 void allocate(
int atomCapacity,
const Vector& lower,
const Vector& upper,
136 const Vector& cutoffs,
int nCellCut = 1);
152 void allocate(
int atomCapacity,
const Vector& lower,
const Vector& upper,
153 double cutoff,
int nCellCut = 1);
194 void placeAtom(
Atom &atom);
222 const Grid& grid()
const;
229 double cellLength(
int i)
const;
239 int cellIndexFromPosition(
const Vector& position)
const;
244 const Cell* begin()
const;
251 const Cell& cell(
int i)
const;
267 int maxNAtomCell()
const;
273 int atomCapacity()
const;
278 int cellCapacity()
const;
283 bool isAllocated()
const;
290 bool isBuilt()
const;
297 bool isValid()
const;
368 void setGridDimensions(
const Vector& lower,
const Vector& upper,
369 const Vector& cutoffs,
int nCellCut);
374 bool isValidAtomId(
int atomId);
387 if (position[i] <= lowerOuter_[i]) {
390 if (position[i] >= upperOuter_[i]) {
393 r[i] = int( (position[i] - lowerOuter_[i])/ cellLengths_[i] );
394 assert(r[i] < grid_.dimension(i));
396 return grid_.rank(r);
405 assert(nAtom_ < tags_.capacity());
407 int rank = cellIndexFromPosition(atom.
position());
409 tags_[nAtom_].cellRank = rank;
410 tags_[nAtom_].ptr = &atom;
411 cells_[rank].incrementCapacity();
421 inline bool CellList::isValidAtomId(
int atomId)
422 {
return ( (0 <= atomId) && (atomId < tags_.capacity()) ); }
434 {
return cellLengths_[i]; }
441 assert(i < cells_.size());
455 {
return (cells_.capacity() > 0); }
const Cell * begin() const
Return pointer to first local cell in linked list.
const int Dimension
Dimensionality of space.
A cell list used only to identify nearby atom pairs.
An automatically growable array, analogous to a std::vector.
A Vector is a Cartesian vector.
void placeAtom(Atom &atom)
Determine the appropriate cell for an Atom, based on its position.
Vector & position()
Get position Vector by reference.
File containing preprocessor macros for error handling.
A point particle in an MD simulation.
Parallel domain decomposition (DD) MD simulation.
Classes used by all simpatico molecular simulations.
Utility classes for scientific computation.
bool isAllocated() const
Has memory been allocated for this CellList?
double cellLength(int i) const
Dimension of each cell in direction i.
An IntVector is an integer Cartesian vector.
A grid of points indexed by integer coordinates.
const Grid & grid() const
Return Grid object by const reference.
int cellIndexFromPosition(const Vector &position) const
Return the index of the cell that contains a position Vector.
const Cell & cell(int i) const
Return a specified cell by const reference.
A single Cell in a CellList.