9 #include "HarmonicL0Bond.h" 10 #include <util/random/Random.h> 24 for (
int i = 0; i < MaxNBondType; ++i) {
33 : nBondType_(other.nBondType_)
35 for (
int i = 0; i < nBondType_; ++i) {
36 kappa_[i] = other.kappa_[i];
45 nBondType_ = other.nBondType_;
46 for (
int i = 0; i < nBondType_; ++i) {
47 kappa_[i] = other.kappa_[i];
57 if (nBondType > MaxNBondType) {
58 UTIL_THROW(
"nBondType > HarmonicL0Bond::MaxNBondType");
60 nBondType_ = nBondType;
69 readCArray<double>(in,
"kappa", kappa_, nBondType_);
78 loadCArray<double> (ar,
"kappa", kappa_, nBondType_);
87 ar.
pack(kappa_, nBondType_);
97 Random *random,
double beta,
int type)
const 103 return sqrt(x*x + y*y + z*z)/sqrt(beta*kappa_[type]);
111 if (name ==
"kappa") {
112 kappa_[type] = value;
124 if (name ==
"kappa") {
125 value = kappa_[type];
void set(std::string name, int type, double value)
Modify a parameter, identified by a string.
double get(std::string name, int type) const
Get a parameter value, identified by a string.
void setNBondType(int nBondType)
Set the number of bond types.
File containing preprocessor macros for error handling.
Classes used by all simpatico molecular simulations.
HarmonicL0Bond & operator=(const HarmonicL0Bond &other)
Assignment.
Saving / output archive for binary ostream.
virtual void loadParameters(Serializable::IArchive &ar)
Load internal state from an archive.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
A harmonic bond potential with zero rest length.
void pack(const T &data)
Pack one object of type T.
Utility classes for scientific computation.
double gaussian(void)
Return a Gaussian random number with zero average and unit variance.
HarmonicL0Bond()
Constructor.
double randomBondLength(Random *random, double beta, int type) const
Return bond length chosen from equilibrium distribution.
Saving archive for binary istream.
virtual void save(Serializable::OArchive &ar)
Save internal state to an archive.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
void setClassName(const char *className)
Set class name string.
void readParameters(std::istream &in)
Read bond interaction parameters from input stream.