1 #ifndef MCMD_MOLECULE_H 2 #define MCMD_MOLECULE_H 21 #include <util/containers/ArrayIterator.h> 22 #include <util/containers/ConstArrayIterator.h> 80 static const int NullIndex = -1;
99 void setSpecies(
Species &species);
106 void setSystem(
System &system);
125 void setFirstAtom(
Atom &atom);
132 void setNAtom(
int nAtom);
140 void setFirstBond(
Bond &bond);
147 void setNBond(
int nBond);
156 void setFirstAngle(
Angle &angle);
163 void setNAngle(
int nAngle);
172 void setFirstDihedral(
Dihedral &dihedral);
179 void setNDihedral(
int nDihedral);
209 int nDihedral()
const;
220 const Atom& atom(
int localId)
const;
229 Atom& atom(
int localId);
239 Bond& bond(
int localId);
248 const Bond& bond(
int localId)
const;
259 Angle& angle(
int localId);
268 const Angle& angle(
int localId)
const;
288 const Dihedral& dihedral(
int localId)
const;
300 void begin(AtomIterator &iterator);
307 void begin(ConstAtomIterator &iterator)
const;
315 void begin(BondIterator &iterator);
322 void begin(ConstBondIterator &iterator)
const;
331 void begin(AngleIterator &iterator);
338 void begin(ConstAngleIterator &iterator)
const;
347 void begin(DihedralIterator &iterator);
354 void begin(ConstDihedralIterator &iterator)
const;
377 Angle* firstAnglePtr_;
436 inline int Molecule::nAtom()
const 443 inline int Molecule::nBond()
const 451 inline int Molecule::nAngle()
const 459 inline int Molecule::nDihedral()
const 460 {
return nDihedral_; }
466 inline Atom& Molecule::atom(
int localIndex)
468 assert(firstAtomPtr_);
469 assert(localIndex >= 0);
470 assert(localIndex < nAtom_);
471 return *(firstAtomPtr_ + localIndex);
477 inline const Atom& Molecule::atom(
int localIndex)
const 479 assert(firstAtomPtr_);
480 assert(localIndex >= 0);
481 assert(localIndex < nAtom_);
482 return *(firstAtomPtr_ + localIndex);
489 inline Bond& Molecule::bond(
int localIndex)
491 assert(firstBondPtr_);
492 assert(localIndex >= 0);
493 assert(localIndex < nBond_);
494 return *(firstBondPtr_ + localIndex);
500 inline const Bond& Molecule::bond(
int localIndex)
const 502 assert(firstBondPtr_);
503 assert(localIndex >= 0);
504 assert(localIndex < nBond_);
505 return *(firstBondPtr_ + localIndex);
513 inline Angle& Molecule::angle(
int localIndex)
515 assert(firstAnglePtr_);
516 assert(localIndex >= 0);
517 assert(localIndex < nAngle_);
518 return *(firstAnglePtr_ + localIndex);
524 inline const Angle& Molecule::angle(
int localIndex)
const 526 assert(firstAnglePtr_);
527 assert(localIndex >= 0);
528 assert(localIndex < nAngle_);
529 return *(firstAnglePtr_ + localIndex);
537 inline Dihedral& Molecule::dihedral(
int localIndex)
539 assert(firstDihedralPtr_);
540 assert(localIndex >= 0);
541 assert(localIndex < nDihedral_);
542 return *(firstDihedralPtr_ + localIndex);
548 inline const Dihedral& Molecule::dihedral(
int localIndex)
const 550 assert(firstDihedralPtr_);
551 assert(localIndex >= 0);
552 assert(localIndex < nAngle_);
553 return *(firstDihedralPtr_ + localIndex);
560 inline int Molecule::id()
const 568 assert(firstAtomPtr_);
571 iterator.
setEnd(firstAtomPtr_ + nAtom_);
579 assert(firstAtomPtr_);
582 iterator.
setEnd(firstAtomPtr_ + nAtom_);
591 assert(firstBondPtr_);
594 iterator.
setEnd(firstBondPtr_ + nBond_);
602 assert(firstBondPtr_);
605 iterator.
setEnd(firstBondPtr_ + nBond_);
615 assert(firstAnglePtr_);
618 iterator.
setEnd(firstAnglePtr_ + nAngle_);
626 assert(firstAnglePtr_);
629 iterator.
setEnd(firstAnglePtr_ + nAngle_);
639 assert(firstDihedralPtr_);
640 assert(nDihedral_ > 0);
642 iterator.
setEnd(firstDihedralPtr_ + nDihedral_);
650 assert(firstDihedralPtr_);
651 assert(nDihedral_ > 0);
653 iterator.
setEnd(firstDihedralPtr_ + nDihedral_);
660 inline void Molecule::setSpecies(
Species &species)
661 { speciesPtr_ = &species; }
666 inline void Molecule::setSystem(
System &system)
667 { systemPtr_ = &system; }
672 inline void Molecule::unsetSystem()
678 inline void Molecule::setFirstAtom(
Atom &atom)
679 { firstAtomPtr_ = &atom; }
684 inline void Molecule::setNAtom(
int nAtom)
691 inline void Molecule::setFirstBond(
Bond &bond)
692 { firstBondPtr_ = &bond; }
697 inline void Molecule::setNBond(
int nBond)
705 inline void Molecule::setFirstAngle(
Angle &angle)
706 { firstAnglePtr_ = ∠ }
711 inline void Molecule::setNAngle(
int nAngle)
712 { nAngle_ = nAngle; }
719 inline void Molecule::setFirstDihedral(
Dihedral &dihedral)
720 { firstDihedralPtr_ = &dihedral; }
725 inline void Molecule::setNDihedral(
int nDihedral)
726 { nDihedral_ = nDihedral; }
732 inline void Molecule::setId(
int id)
743 inline int Atom::indexInMolecule()
const 744 {
return int(
this - &molecule().atom(0));}
ConstArrayIterator< Atom > ConstAtomIterator
Iterator for const Atoms within a Molecule.
ConstArrayIterator< Angle > ConstAngleIterator
Iterator for const Angles within a Molecule.
A set of interacting Molecules enclosed by a Boundary.
void setCurrent(Data *ptr)
Set the current pointer value.
File containing preprocessor macros for error handling.
ArrayIterator< Atom > AtomIterator
Iterator for Atoms within a Molecule.
Classes used by all simpatico molecular simulations.
Forward const iterator for an Array or a C array.
ConstArrayIterator< Bond > ConstBondIterator
Iterator for const Bonds within a Molecule.
void setEnd(Data *ptr)
Set the value of the end pointer.
ConstArrayIterator< Dihedral > ConstDihedralIterator
Iterator for const Dihedrals within a Molecule.
A point particle within a Molecule.
Utility classes for scientific computation.
Forward iterator for an Array or a C array.
void setEnd(Data *ptr)
Set the value of the end pointer.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
A sequence of NAtom covalently interacting atoms.
void setCurrent(Data *ptr)
Set the current pointer value.
A physical molecule (a set of covalently bonded Atoms).
A Species represents a set of chemically similar molecules.