8 #include "Simulation.h" 11 #include <mcMd/analyzers/AnalyzerManager.h> 12 #include <mcMd/species/SpeciesManager.h> 13 #include <mcMd/chemistry/Activate.h> 16 #include <simp/species/Species.h> 17 #include <simp/species/SpeciesGroup.tpp> 20 #include <util/containers/ArraySet.h> 21 #include <util/param/Factory.h> 22 #include <util/space/Vector.h> 23 #include <util/misc/initStatic.h> 42 speciesManagerPtr_(0),
43 analyzerManagerPtr_(0),
44 commandManagerPtr_(0),
49 , maskedPairPolicy_(MaskBonded)
61 , dihedralCapacity_(0)
79 , communicatorPtr_(&communicator)
86 if (!MPI::Is_initialized()) {
92 int rank = communicatorPtr_->Get_rank();
110 speciesManagerPtr_(0),
111 analyzerManagerPtr_(0),
112 commandManagerPtr_(0),
113 moleculeCapacity_(0),
117 , maskedPairPolicy_(MaskBonded)
129 , dihedralCapacity_(0)
148 , communicatorPtr_(0)
163 if (speciesManagerPtr_) {
164 delete speciesManagerPtr_;
170 if (logFile_.is_open()) logFile_.close();
178 { analyzerManagerPtr_ = ptr; }
184 { commandManagerPtr_ = ptr; }
193 UTIL_THROW(
"No communicator was passed to constructor");
195 if (communicatorPtr_ != &communicator) {
196 UTIL_THROW(
"ParamCommunicator must be the one passed to constructor");
215 assert(speciesManagerPtr_);
219 read<int>(in,
"nAtomType", nAtomType_);
220 if (nAtomType_ <= 0) {
225 readOptional<int>(in,
"nBondType", nBondType_);
226 if (nBondType_ < 0) {
232 readOptional<int>(in,
"nAngleType", nAngleType_);
233 if (nAngleType_ < 0) {
239 readOptional<int>(in,
"nDihedralType", nDihedralType_);
240 if (nDihedralType_ < 0) {
246 readOptional<int>(in,
"hasCoulomb", hasCoulomb_);
247 if ((hasCoulomb_ != 0) && (hasCoulomb_ != 1)) {
253 readOptional<int>(in,
"hasExternal", hasExternal_);
254 if (hasExternal_ < 0) {
260 readOptional<int>(in,
"nLinkType", nLinkType_);
261 if (nLinkType_ < 0) {
267 readOptional<int>(in,
"hasTether", hasTether_);
268 if (hasTether_ < 0) {
274 readOptional<int>(in,
"hasSpecial", hasSpecial_);
275 if (hasSpecial_ < 0) {
281 atomTypes_.allocate(nAtomType_);
282 for (
int i = 0; i < nAtomType_; ++i) {
283 atomTypes_[i].setId(i);
285 atomTypes_[i].setHasCharge(hasCoulomb_);
290 readDArray<AtomType>(in,
"atomTypes", atomTypes_, nAtomType_);
293 read<MaskPolicy>(in,
"maskedPairPolicy", maskedPairPolicy_);
297 for (
int iSpecies = 0; iSpecies <
nSpecies(); ++iSpecies) {
304 initializeSpeciesData();
328 loadParameter<int>(ar,
"nAtomType", nAtomType_);
330 loadParameter<int>(ar,
"nBondType", nBondType_);
334 loadParameter<int>(ar,
"nAngleType", nAngleType_,
false);
338 loadParameter<int>(ar,
"nDihedralType", nDihedralType_,
false);
342 loadParameter<int>(ar,
"hasCoulomb", hasCoulomb_,
false);
346 loadParameter<int>(ar,
"hasExternal", hasExternal_,
false);
350 loadParameter<int>(ar,
"nLinkType", nLinkType_,
false);
354 loadParameter<int>(ar,
"hasTether", hasTether_,
false);
358 loadParameter<int>(ar,
"hasSpecial", hasSpecial_,
false);
362 atomTypes_.allocate(nAtomType_);
363 for (
int i = 0; i < nAtomType_; ++i) {
364 atomTypes_[i].setId(i);
366 loadDArray<AtomType>(ar,
"atomTypes", atomTypes_, nAtomType_);
369 loadParameter<MaskPolicy>(ar,
"maskedPairPolicy", maskedPairPolicy_);
372 for (
int iSpecies = 0; iSpecies <
nSpecies(); ++iSpecies) {
378 initializeSpeciesData();
388 fileMaster_.
save(ar);
418 ar & maskedPairPolicy_;
420 (*speciesManagerPtr_).save(ar);
435 void Simulation::initializeSpeciesData()
440 UTIL_THROW(
"Error: nSpecies() <= 0 in Simulation::initialize()");
443 if (nBondType_ < 0) {
444 UTIL_THROW(
"Error: nBondType < 0 in Simulation::initialize()");
448 if (nAngleType_ < 0) {
449 UTIL_THROW(
"Error: nAngleType < 0 in Simulation::initialize()");
453 if (nDihedralType_ < 0) {
454 UTIL_THROW(
"Error: nDihedralType < 0 in Simulation::initialize()");
458 if (nLinkType_ < 0) {
459 UTIL_THROW(
"Error: nLinkType_ < 0 in Simulation::initialize()");
463 UTIL_THROW(
"Attempt to re-initialize species data arrays");
484 if (nBondType_ > 0) {
489 if (nAngleType_ > 0) {
494 if (nDihedralType_ > 0) {
500 moleculeCapacity_ = 0;
509 dihedralCapacity_ = 0;
511 for (iSpecies = 0; iSpecies <
nSpecies(); ++iSpecies) {
512 speciesPtr = &
species(iSpecies);
515 if (speciesPtr->
id() != iSpecies) {
521 reservoirs_[iSpecies].allocate(speciesPtr->
capacity());
524 firstMoleculeIds_[iSpecies] = moleculeCapacity_;
525 firstAtomIds_[iSpecies] = atomCapacity_;
527 if (nBondType_ > 0) {
528 firstBondIds_[iSpecies] = bondCapacity_;
532 if (nAngleType_ > 0) {
533 firstAngleIds_[iSpecies] = angleCapacity_;
537 if (nDihedralType_ > 0) {
538 firstDihedralIds_[iSpecies] = dihedralCapacity_;
544 nAtom = speciesPtr->
nAtom();
545 moleculeCapacity_ += capacity;
546 atomCapacity_ += capacity*nAtom;
548 if (nBondType_ > 0) {
549 nBond = speciesPtr->
nBond();
550 bondCapacity_ += capacity*nBond;
554 if (nAngleType_ > 0) {
555 nAngle = speciesPtr->
nAngle();
556 angleCapacity_ += capacity*nAngle;
560 if (nDihedralType_ > 0) {
562 dihedralCapacity_ += capacity*nDihedral;
571 molecules_.allocate(moleculeCapacity_);
574 for (iSpecies = 0; iSpecies <
nSpecies(); ++iSpecies) {
575 speciesPtr = &
species(iSpecies);
576 initializeSpeciesMolecules(iSpecies);
581 if (nBondType_ > 0) {
582 if (bondCapacity_ > 0) {
583 bonds_.allocate(bondCapacity_);
587 for (iSpecies = 0; iSpecies <
nSpecies(); ++iSpecies) {
588 initializeSpeciesBonds(iSpecies);
595 if (nAngleType_ > 0) {
596 if (angleCapacity_ > 0) {
597 angles_.allocate(angleCapacity_);
601 for (iSpecies = 0; iSpecies <
nSpecies(); ++iSpecies) {
602 initializeSpeciesAngles(iSpecies);
609 if (nDihedralType_ > 0) {
610 if (dihedralCapacity_ > 0) {
611 dihedrals_.allocate(dihedralCapacity_);
613 dihedrals_.allocate(1);
615 for (iSpecies = 0; iSpecies <
nSpecies(); ++iSpecies) {
616 initializeSpeciesDihedrals(iSpecies);
639 void Simulation::initializeSpeciesMolecules(
int iSpecies)
648 speciesPtr = &
species(iSpecies);
650 nAtom = speciesPtr->
nAtom();
653 moleculePtr = &molecules_[firstMoleculeIds_[iSpecies]];
654 atomPtr = &atoms_[firstAtomIds_[iSpecies]];
657 for (iMol = 0; iMol < capacity; ++iMol) {
660 moleculePtr->
setId(iMol);
666 for (iAtom = 0; iAtom < nAtom; ++iAtom) {
677 moleculePtr = &molecules_[firstMoleculeIds_[iSpecies]
679 for (iMol = 0; iMol < capacity; ++iMol) {
680 reservoirs_[iSpecies].push(*moleculePtr);
694 void Simulation::initializeSpeciesBonds(
int iSpecies)
696 if (nBondType_ <= 0) {
706 int iMol, iBond, atom0Id, atom1Id, type;
709 speciesPtr = &
species(iSpecies);
710 nBond = speciesPtr->
nBond();
714 moleculePtr = &molecules_[firstMoleculeIds_[iSpecies]];
716 bondPtr = &bonds_[0] + firstBondIds_[iSpecies];
719 for (iMol = 0; iMol < capacity; ++iMol) {
721 firstAtomPtr = &(moleculePtr->
atom(0));
728 for (iBond = 0; iBond < nBond; ++iBond) {
734 atom0Ptr = firstAtomPtr + atom0Id;
735 atom1Ptr = firstAtomPtr + atom1Id;
738 bondPtr->
setAtom(0, *atom0Ptr);
739 bondPtr->
setAtom(1, *atom1Ptr);
744 if (maskedPairPolicy_ == MaskBonded) {
768 void Simulation::initializeSpeciesAngles(
int iSpecies)
771 if (nAngleType_ <= 0) {
778 Atom* firstAtomPtr, *atom0Ptr, *atom1Ptr, *atom2Ptr;
779 int iMol, iAngle, atom0Id, atom1Id, atom2Id, type;
780 int capacity, nAngle;
782 speciesPtr = &
species(iSpecies);
784 nAngle = speciesPtr->
nAngle();
787 moleculePtr = &molecules_[firstMoleculeIds_[iSpecies]];
789 anglePtr = &angles_[0] + firstAngleIds_[iSpecies];
792 for (iMol = 0; iMol < capacity; ++iMol) {
794 firstAtomPtr = &(moleculePtr->
atom(0));
801 for (iAngle = 0; iAngle < nAngle; ++iAngle) {
808 atom0Ptr = firstAtomPtr + atom0Id;
809 atom1Ptr = firstAtomPtr + atom1Id;
810 atom2Ptr = firstAtomPtr + atom2Id;
813 anglePtr->
setAtom(0, *atom0Ptr);
814 anglePtr->
setAtom(1, *atom1Ptr);
815 anglePtr->
setAtom(2, *atom2Ptr);
838 void Simulation::initializeSpeciesDihedrals(
int iSpecies)
844 Atom *firstAtomPtr, *atom0Ptr, *atom1Ptr, *atom2Ptr, *atom3Ptr;
845 int iMol, iDihedral, atom0Id, atom1Id, atom2Id, atom3Id, type;
846 int capacity, nDihedral;
848 speciesPtr = &
species(iSpecies);
853 moleculePtr = &molecules_[firstMoleculeIds_[iSpecies]];
855 dihedralPtr = &dihedrals_[0] + firstDihedralIds_[iSpecies];
858 for (iMol = 0; iMol < capacity; ++iMol) {
860 firstAtomPtr = &(moleculePtr->
atom(0));
867 for (iDihedral = 0; iDihedral < nDihedral; ++iDihedral) {
877 atom0Ptr = firstAtomPtr + atom0Id;
878 atom1Ptr = firstAtomPtr + atom1Id;
879 atom2Ptr = firstAtomPtr + atom2Id;
880 atom3Ptr = firstAtomPtr + atom3Id;
883 dihedralPtr->
setAtom(0, *atom0Ptr);
884 dihedralPtr->
setAtom(1, *atom1Ptr);
885 dihedralPtr->
setAtom(2, *atom2Ptr);
886 dihedralPtr->
setAtom(3, *atom3Ptr);
904 const Molecule* molecules = &molecules_[firstMoleculeIds_[speciesId]];
906 set.allocate(molecules, capacity);
914 Molecule* ptr = &reservoirs_[speciesId].pop();
925 reservoirs_[speciesId].push(molecule);
934 {
return speciesManagerPtr_->
size(); }
940 {
return (*speciesManagerPtr_)[i]; }
946 {
return (*speciesManagerPtr_)[i]; }
954 for (
int iAtom = 0; iAtom < atomCapacity_; ++iAtom) {
955 if (atoms_[iAtom].
id() != iAtom) {
961 for (
int iSpecies=0; iSpecies <
nSpecies(); ++iSpecies) {
966 const Atom* atomPtr = &(atoms_[0]);
968 const Bond* bondPtr = 0;
969 if (nBondType_ > 0) {
970 bondPtr = &(bonds_[0]);
974 const Angle* anglePtr = 0;
975 if (nAngleType_ > 0) {
976 anglePtr = &(angles_[0]);
981 if (nDihedralType_ > 0) {
982 dihedralPtr = &(dihedrals_[0]);
988 for (
int iSpecies = 0; iSpecies <
nSpecies(); ++iSpecies) {
992 const int capacity = speciesPtr->
capacity();
993 const int nAtom = speciesPtr->
nAtom();
996 if (nBondType_ > 0) {
997 nBond = speciesPtr->
nBond();
1002 if (nAngleType_ > 0) {
1003 nAngle = speciesPtr->
nAngle();
1006 #ifdef SIMP_DIHEDRAL 1008 if (nDihedralType_ > 0) {
1014 for (
int iMol = 0; iMol < capacity; ++iMol) {
1017 if (&moleculePtr->
species() != speciesPtr) {
1018 UTIL_THROW(
"Inconsistent molecule.species()");
1020 if (moleculePtr->
id() != iMol) {
1026 if (&moleculePtr->
atom(0) != atomPtr) {
1031 for (
int iAtom = 0; iAtom < nAtom; ++iAtom) {
1034 if (&(atomPtr->
molecule()) != moleculePtr) {
1037 if (atomPtr != &(moleculePtr->
atom(iAtom))) {
1048 type = atomPtr->
typeId();
1049 if (type < 0 || type >= nAtomType_) {
1063 if (nBondType_ > 0 && nBond > 0) {
1065 if (&moleculePtr->
bond(0) != bondPtr) {
1068 if (moleculePtr->
nBond() != nBond) {
1072 const Atom* atom0Ptr;
1073 const Atom* atom1Ptr;
1074 int id0, id1, bondType;
1077 for (
int iBond = 0; iBond < nBond; ++iBond) {
1085 if (id0 < 0 || id0 >= nAtom) {
1086 UTIL_THROW(
"Invalid local atom id in a SpeciesBond");
1088 if (id1 < 0 || id1 >= nAtom) {
1089 UTIL_THROW(
"Invalid local atom id in a SpeciesBond");
1091 if (bondType < 0 || bondType >= nBondType_) {
1092 std::cout <<
"bondType = " << bondType
1094 std::cout <<
"nBondType_ = " << nBondType_
1096 UTIL_THROW(
"Invalid bondType in a SpeciesBond");
1100 atom0Ptr = &(bondPtr->
atom(0));
1101 atom1Ptr = &(bondPtr->
atom(1));
1102 if (atom0Ptr != &(moleculePtr->
atom(id0))) {
1103 UTIL_THROW(
"Inconsistent atom handle for a Bond");
1105 if (atom1Ptr != &(moleculePtr->
atom(id1))) {
1106 UTIL_THROW(
"Inconsistent atom handle for a Bond");
1108 if (bondPtr->
typeId() != bondType) {
1119 if (maskedPairPolicy_ == MaskBonded) {
1137 if (nAngleType_ > 0 && nAngle > 0) {
1139 if (&moleculePtr->
angle(0) != anglePtr) {
1142 if (moleculePtr->
nAngle() != nAngle) {
1146 const Atom* atom0Ptr = 0;
1147 const Atom* atom1Ptr = 0;
1148 const Atom* atom2Ptr = 0;
1149 int id0, id1, id2, angleType;
1152 for (
int iAngle = 0; iAngle < nAngle; ++iAngle) {
1161 if (id0 < 0 || id0 >= nAtom) {
1162 UTIL_THROW(
"Invalid local atom id in a SpeciesAngle");
1164 if (id1 < 0 || id1 >= nAtom) {
1165 UTIL_THROW(
"Invalid local atom id in a SpeciesAngle");
1167 if (id2 < 0 || id2 >= nAtom) {
1168 UTIL_THROW(
"Invalid local atom id in a SpeciesAngle");
1170 if (angleType < 0 || angleType >= nAngleType_) {
1171 UTIL_THROW(
"Invalid local atom id in a SpeciesAngle");
1175 atom0Ptr = &(anglePtr->
atom(0));
1176 atom1Ptr = &(anglePtr->
atom(1));
1177 atom2Ptr = &(anglePtr->
atom(2));
1179 if (atom0Ptr != &(moleculePtr->
atom(id0))) {
1180 UTIL_THROW(
"Inconsistent atom handle for an Angle");
1182 if (atom1Ptr != &(moleculePtr->
atom(id1))) {
1183 UTIL_THROW(
"Inconsistent atom handle for an Angle");
1185 if (atom2Ptr != &(moleculePtr->
atom(id2))) {
1186 UTIL_THROW(
"Inconsistent atom handle for an Angle");
1188 if (anglePtr->
typeId() != angleType) {
1202 #ifdef SIMP_DIHEDRAL 1203 if (nDihedralType_ > 0 && nDihedral > 0) {
1205 const Atom* tAtomPtr;
1206 int tAtomId, dihedralType;
1208 if (&moleculePtr->
dihedral(0) != dihedralPtr) {
1211 if (moleculePtr->
nDihedral() != nDihedral) {
1212 UTIL_THROW(
"Inconsistent values of nDihedral");
1216 for (
int iDihedral = 0; iDihedral < nDihedral; ++iDihedral) {
1219 for (
int tId = 0; tId < 4; ++tId) {
1222 if (tId < 0 || tId >= nAtom)
1223 UTIL_THROW(
"Invalid local atom id in SpeciesDihedral");
1225 tAtomPtr = &(dihedralPtr->
atom(tId));
1226 if (tAtomPtr != &(moleculePtr->
atom(tAtomId))) {
1227 UTIL_THROW(
"Inconsistent atom handle for an Dihedral");
1232 if (dihedralType < 0 || dihedralType >= nDihedralType_) {
1233 UTIL_THROW(
"Invalid local atom id in a SpeciesDihedral");
1235 if (dihedralType != dihedralPtr->
typeId()) {
1236 UTIL_THROW(
"Inconsistent dihedral type index");
1260 out <<
"-g Debugging ON " << std::endl;
1262 out <<
"-g Debugging OFF" << std::endl;
1265 out <<
"-m MPI ON " << std::endl;
1267 out <<
"-m MPI OFF" << std::endl;
1270 out <<
"-c Coulomb ON " << std::endl;
1272 out <<
"-c Coulomb OFF" << std::endl;
1275 out <<
"-np Pairs ON " << std::endl;
1277 out <<
"-np Pairs OFF" << std::endl;
1280 out <<
"-b Bonds ON " << std::endl;
1282 out <<
"-b Bonds OFF" << std::endl;
1285 out <<
"-a Angles ON " << std::endl;
1287 out <<
"-a Angles OFF" << std::endl;
1289 #ifdef SIMP_DIHEDRAL 1290 out <<
"-d Dihedrals ON " << std::endl;
1292 out <<
"-d Dihedrals OFF" << std::endl;
1294 #ifdef SIMP_EXTERNAL 1295 out <<
"-e External ON " << std::endl;
1297 out <<
"-e External OFF" << std::endl;
1300 out <<
"-s Special ON " << std::endl;
1302 out <<
"-s Special OFF" << std::endl;
1305 out <<
"-l Link ON " << std::endl;
1307 out <<
"-l Link OFF" << std::endl;
1310 out <<
"-i Shift ON " << std::endl;
1312 out <<
"-i Shift OFF" << std::endl;
1324 return speciesManagerPtr_->
factory();
1333 return analyzerManagerPtr_->
factory();
void setNAtom(int nAtom)
Set the number of Atoms per molecule.
Manager for Command objects in an MdSimulation.
static void initStatic()
Define and initialize baseInterval.
Bond & bond(int localId)
Get a specific Bond in this Molecule by non-const reference.
void setSpecies(Species &species)
Set the parent Species.
void setAtom(int i, Atom &atom)
Add an atom to this group.
void commitMpiTypes()
Commit all MPI data types needed for Mc and Md simulations.
int iStep_
Step index for main MC or MD loop.
Molecule & molecule() const
Get the parent Molecule by reference.
virtual void readParameters(std::istream &in)
Read parameter file block and initialize simulation.
const SpeciesDihedral & speciesDihedral(int iDihedral) const
Get a specific SpeciesDihedral object, by local angle index.
static void deallocate()
Delete all static arrays.
void setDirectoryId(int directoryId)
Set an integer directory identifier for this processor.
int nDihedral() const
Get the number of Dihedrals in this Molecule.
void setIoCommunicator(MPI::Intracomm &communicator)
Set the communicator.
int nAngle() const
Get the number of Angles in this Molecule.
int nAtom() const
Get number of atoms per molecule for this Species.
Factory< Analyzer > & analyzerFactory()
Return the Analyzer factory by reference.
void outputOptions(std::ostream &out) const
Output a list of options enabled and disabled during compilation.
virtual void save(Serializable::OArchive &ar)
Save internal state to an archive.
void setId(int id)
Set the integer index for this molecule.
Dihedral & dihedral(int localId)
Get a specific Dihedral in this Molecule by reference.
virtual ~Simulation()
Destructor.
Factory< Data > & factory()
Return a reference to the factory.
void setFirstBond(Bond &bond)
Set the first Bond.
void setTypeId(int typeId)
Set the group type id for this group.
void openOutputFile(const std::string &filename, std::ofstream &out, std::ios_base::openmode mode=std::ios_base::out) const
Open an output file.
void loadParamComposite(Serializable::IArchive &ar, ParamComposite &child, bool next=true)
Add and load a required child ParamComposite.
Mask & mask()
Get the associated Mask by reference.
bool isActive() const
Is this group active?
Species & species() const
Get the molecular Species by reference.
void setMolecule(Molecule &molecule)
Set the parent molecule.
int typeId() const
Get the typeId for this covalent group.
void allocateMoleculeSet(Util::ArraySet< Molecule > &set, int speciesId) const
Allocate and initialize a molecule set for one Species.
static void activate(Molecule &molecule)
Activate all atoms and groups in one molecule.
virtual bool isValid() const
Return true if Simulation is valid, or throw an Exception.
Classes used by all simpatico molecular simulations.
int nSystem_
Number of Systems of interacting molecules (> 1 in Gibbs ensemble).
void initStatic()
Guarantee initialization of all static class members in Util namespace.
Molecule & getMolecule(int speciesId)
Get a new molecule from a reservoir of unused Molecule objects.
int id() const
Get the index for this Molecule (unique in species).
void setNAngle(int nAngle)
Set the number of Angles per molecule.
void returnMolecule(Molecule &molecule)
Return a molecule to a reservoir of unused molecules.
static void setFile(std::ofstream &file)
Set the log ostream to a file.
Saving / output archive for binary ostream.
void setFirstAtom(Atom &atom)
Set the first Atom.
const SpeciesBond & speciesBond(int iBond) const
Get a specific SpeciesBond object, by local bond index.
int nDihedral() const
Get number of dihedrals per molecule for this Species.
bool isMasked(const Atom &atom) const
True if the atom is in the masked set for the target Atom.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
bool isActive() const
Get the isActive flag.
static void initStatic()
Method to guarantee initialization of static data.
int typeId() const
Get type index for this Atom.
static void allocate(int capacity, RArray< Atom > &atoms)
Allocate a static array of Atom objects.
int nBond() const
Get the number of Bonds in this Molecule.
virtual void save(Serializable::OArchive &ar)
Save internal state to file.
A container for pointers to a subset of elements of an associated array.
void setNBond(int nBond)
Set the number of Bonds per molecule.
bool hasSpecies() const
Has data for all species structures and capacities.
A point particle within a Molecule.
Utility classes for scientific computation.
void setAnalyzerManager(AnalyzerManager *ptr)
Set the associated AnalyzerManager.
void setCommandManager(CommandManager *ptr)
Set the associated CommandManager.
const SpeciesAngle & speciesAngle(int iAngle) const
Get a specific SpeciesAngle object, by local angle index.
int typeId() const
Get the type id for this covalent group.
void setFirstDihedral(Dihedral &dihedral)
Set the first Dihedral.
int atomTypeId(int iAtom) const
Get atom type index for a specific atom, by local atom index.
MPI::Intracomm & communicator()
Get the MPI communicator by reference.
Atom & atom(int i)
Get a specific Atom in the Group by reference.
bool isValid() const
Return true if Species is valid, or throw an Exception.
virtual void save(Serializable::OArchive &ar)
Save internal state to file.
void setId(int id)
Set integer id for this Species.
void setCommonControl()
Enable "replicated" mode in multi-system simulations.
Manager for a list of Analyzer objects.
void setTypeId(int typeId)
Set the atomic type index.
int id() const
Get integer id of this Species.
Saving archive for binary istream.
int atomId(int i) const
Get the local id for a specific Atom.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
int nSpecies() const
Get the number of Species in this Simulation.
A sequence of NAtom covalently interacting atoms.
bool isMutable() const
Is this a mutable Species?
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
void setClassName(const char *className)
Set class name string.
const Atom & atom(int localId) const
Get a specific Atom in this Molecule.
int capacity() const
Maximum allowed number of molecules for this Species.
Factory< Species > & speciesFactory()
Return the Species Factory by reference.
bool hasCommunicator() const
Does the simulation have an associated MPI communicator?
void readParamComposite(std::istream &in, ParamComposite &child, bool next=true)
Add and read a required child ParamComposite.
A Manager for a set of Species objects.
void setIoCommunicator()
Set MPI job to read one parameter file and one command file.
void setNDihedral(int nDihedral)
Set the number of Dihedrals per molecule.
void allocate(int capacity)
Allocate the underlying C array.
int size() const
Get logical size.
A physical molecule (a set of covalently bonded Atoms).
A Species represents a set of chemically similar molecules.
static void saveOptional(Serializable::OArchive &ar, Type &value, bool isActive)
Save an optional parameter value to an output archive.
int nBond() const
Get number of bonds per molecule for this Species.
int nAngle() const
Get number of angles per molecule for this Species.
Angle & angle(int localId)
Get a specific Angle in this Molecule by non-const reference.
Species & species(int i)
Get a specific Species by reference.
#define UTIL_ASSERT(condition)
Assertion macro suitable for debugging serial or parallel code.
void setFirstAngle(Angle &angle)
Set the first Angle.
void writeParam(std::string filename)
Open output, write and close an output parameter file.
FileMaster & fileMaster()
Get the FileMaster object.
virtual void loadParameters(Serializable::IArchive &ar)
Load internal state from an archive.
void append(const Atom &atom)
Add an Atom to the masked set.