12 #include <util/containers/Array.h> 47 static const int MaxAtomCell = 253;
49 static const int MaxAtomCell = 61;
53 static const int NullIndex = -1;
70 void deleteAtom(
CellTag &cellTag);
81 void addAtom(
CellTag &cellTag,
Atom &atom,
int cellId);
84 int nAtomCell()
const;
87 int firstClearPos()
const;
94 Atom* atomPtr(
int index)
const;
110 bool isValid(
const Array<CellTag> &cellTags,
int nAtom,
int icell)
const;
133 Atom* atoms_[MaxAtomCell];
147 friend class ::CellTest;
148 friend class ::CellListTest;
167 if (firstEmptyPos_ > cellPos) {
168 firstEmptyPos_ = cellPos;
172 int i = firstClearPos_ - 1;
173 while (i >= 0 && atoms_[i] == 0) {
176 firstClearPos_ = i + 1;
180 cellTag.
cellId = NullIndex;
192 if (firstEmptyPos_ == MaxAtomCell) {
197 atoms_[firstEmptyPos_] = &atom;
202 cellTag.
cellPos = firstEmptyPos_;
205 if (firstEmptyPos_ < MaxAtomCell - 1) {
207 if (firstEmptyPos_ == firstClearPos_) {
209 firstEmptyPos_ = firstEmptyPos_ + 1;
210 firstClearPos_ = firstClearPos_ + 1;
215 for (
int i = firstEmptyPos_ + 1; i < MaxAtomCell; ++i) {
216 if (atoms_[i] == 0) {
229 firstEmptyPos_ = MaxAtomCell;
230 firstClearPos_ = MaxAtomCell;
236 {
return nAtomCell_; }
239 {
return firstClearPos_; }
242 {
return atoms_[index]; }
Array container class template.
int cellId
Cell index of Cell containing associated Atom.
File containing preprocessor macros for error handling.
int nAtomCell() const
Get number of atoms in cell.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
int cellPos
Array index of Atom pointer in a Cell::part_ array.
A point particle within a Molecule.
Utility classes for scientific computation.
void addAtom(CellTag &cellTag, Atom &atom, int cellId)
Add one atom to a Cell.
Location of the pointer to a particular Atom in a CellList.
Atom * atomPtr(int index) const
Get a pointer to Atom (may be null).
A set of Atoms in a small region.
int firstClearPos() const
Get index of first clear element of atoms_.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
void deleteAtom(CellTag &cellTag)
Remove a specified atom from the Cell.