8 #include "Multiblock.h" 23 , angleType_(NullIndex)
26 , dihedralType_(NullIndex)
37 read<int>(in,
"nBlock",
nBlock_);
40 for (
int i=0; i <
nBlock_; ++i) {
41 if (blockLengths_[i] < 1) {
42 UTIL_THROW(
"Invalid blockLength for Multiblock.");
47 for (
int i=0; i <
nBlock_; ++i) {
48 if (atomTypes_[i] < 0) {
49 UTIL_THROW(
"Invalid atomType for Multiblock.");
53 for (
int i=0; i <
nBlock_; ++i) {
61 for (
int i=0; i <
nBlock_; ++i) {
66 read<int>(in,
"bondType", bondType_);
70 readOptional<int>(in,
"hasAngles",
hasAngles_);
73 UTIL_THROW(
"Error: Cannot have angles with nAtom < 3");
76 read<int>(in,
"angleType", angleType_);
87 UTIL_THROW(
"Error: Cannot have dihedrals with nAtom < 4");
90 read<int>(in,
"dihedralType", dihedralType_);
104 loadParameter<int>(ar,
"nBlock",
nBlock_);
107 for (
int i=0; i <
nBlock_; ++i) {
108 if (blockLengths_[i] < 1) {
109 UTIL_THROW(
"Invalid blockLength for Multiblock.");
114 for (
int i=0; i <
nBlock_; ++i) {
115 if (atomTypes_[i] < 0) {
116 UTIL_THROW(
"Invalid atomType for Multiblock.");
120 for (
int i = 0; i <
nBlock_; ++i) {
128 for (
int i=0; i <
nBlock_; ++i) {
133 loadParameter<int>(ar,
"bondType", bondType_);
137 loadParameter<int>(ar,
"hasAngles",
hasAngles_,
false);
140 UTIL_THROW(
"Error: Cannot have angles with nAtom < 3");
143 loadParameter<int>(ar,
"angleType", angleType_);
151 loadParameter<int>(ar,
"hasDihedrals",
hasDihedrals_,
false);
154 UTIL_THROW(
"Error: Cannot have dihedrals with nAtom < 4");
157 loadParameter<int>(ar,
"dihedralType", dihedralType_);
196 for (
int i = 0; i <
nBlock_; ++i) {
211 {
return bondType_; }
218 {
return angleType_; }
226 {
return dihedralType_; }
int moleculeCapacity_
Number of molecules associated with the species.
virtual void loadSpeciesParam(Serializable::IArchive &ar)
Load species structure from an Archive.
virtual int calculateDihedralTypeId(int index) const
Return same dihedral type for any dihedral in any chain.
Multiblock()
Default constructor.
File containing preprocessor macros for error handling.
Classes used by all simpatico molecular simulations.
virtual void save(Serializable::OArchive &ar)
Save internal state to an archive.
int hasAngles_
Does this chain have angle potentials (0 = false, 1 = true).
int nAtom_
Number of atoms per molecule.
Saving / output archive for binary ostream.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
DArray< int > atomTypes_
Particle type ids for each block.
virtual void readSpeciesParam(std::istream &in)
Read block lengths length and and types.
Utility classes for scientific computation.
int nBlock_
Number of particles in each block.
DArray< int > blockLengths_
Number of particles in each block.
int nDihedral_
Number of dihedrals per molecule.
virtual int calculateAngleTypeId(int index) const
Return same angle type for any angle in any chain.
int nAngle_
Number of angles per molecule.
virtual int calculateBondTypeId(int index) const
Return same bond type for any bond in any chain.
Saving archive for binary istream.
int hasDihedrals_
Does this chain have dihedral potentials (0 = false, 1 = true).
void buildLinear()
Build the chemical structure for a linear molecule.
void setClassName(const char *className)
Set class name string.
void allocate(int capacity)
Allocate the underlying C array.
static void saveOptional(Serializable::OArchive &ar, Type &value, bool isActive)
Save an optional parameter value to an output archive.
int nBond_
Number of bonds per molecule.
A Species of linear polymers (abstract).
DArray< int > blockBegin_
Particle index for the beginning of each block.
virtual int calculateAtomTypeId(int index) const
Return the atom type for a specific atom.