1 #ifndef SIMP_COMPOSITE_BOND_H 2 #define SIMP_COMPOSITE_BOND_H 11 #include <util/param/ParamComposite.h> 12 #include <util/param/Begin.h> 13 #include <util/param/End.h> 37 template <
class BareBond,
class BarePair>
73 void set(std::string name,
int type,
double value);
84 double energy(
double rsq,
int type)
const;
97 double forceOverR(
double rsq,
int bondTypeId)
const;
116 double get(std::string name,
int type)
const;
137 template <
class BareBond,
class BarePair>
142 std::string name(
"CompositeBond");
144 name += bond_.className();
146 name += pair_.className();
155 template <
class BareBond,
class BarePair>
157 : bond_(other.bond_),
164 template <
class BareBond,
class BarePair>
176 beginPtr = &
addBegin(bond_.className().c_str());
178 beginPtr->readParameters(in);
182 endPtr->readParameters(in);
185 beginPtr = &
addBegin(pair_.className().c_str());
187 beginPtr->readParameters(in);
191 endPtr->readParameters(in);
199 template <
class BareBond,
class BarePair>
202 bond_.setNBondType(nBondType);
203 pair_.setNAtomType(1);
209 template <
class BareBond,
class BarePair>
214 double total = bond_.energy(rsq, type);
215 total += pair_.energy(rsq, 0, 0);
222 template <
class BareBond,
class BarePair>
227 double total = bond_.forceOverR(rsq, type);
228 total += pair_.forceOverR(rsq, 0, 0);
235 template <
class BareBond,
class BarePair>
237 ::set(std::string name,
int type,
double value)
245 template <
class BareBond,
class BarePair>
247 get(std::string name,
int type)
const 256 template <
class BareBond,
class BarePair>
End bracket of a ParamComposite parameter block.
double energy(double rsq, int type) const
Returns interaction energy for a single pair of particles.
double forceOverR(double rsq, int bondTypeId) const
Returns ratio of bond force to atom separation.
File containing preprocessor macros for error handling.
Classes used by all simpatico molecular simulations.
void setNBondType(int nBondType)
Set nAtomType value.
Composite bond potential.
CompositeBond()
Constructor.
End & addEnd()
Add a closing bracket.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
Utility classes for scientific computation.
Begin & addBegin(const char *label)
Add a Begin object representing a class name and bracket.
void readParameters(std::istream &in)
Read epsilon and sigma, initialize other variables.
void setIndent(const ParamComponent &parent, bool next=true)
Set indent level.
double get(std::string name, int type) const
Get a parameter value, identified by a string.
void setClassName(const char *className)
Set class name string.
void readParamComposite(std::istream &in, ParamComposite &child, bool next=true)
Add and read a required child ParamComposite.
An object that can read multiple parameters from file.
Beginning line of a composite parameter block.
double randomBondLength(Random *randomPtr, double beta, int type) const
Throws exception if called.