8 #include "BoxExternal.h" 30 : epsilon_(other.epsilon_),
32 sigmaCb_(other.sigmaCb_),
33 cutoff_(other.cutoff_),
35 boundaryPtr_(other.boundaryPtr_),
36 nAtomType_(other.nAtomType_),
37 isInitialized_(other.isInitialized_)
45 boundaryPtr_ = other.boundaryPtr_;
46 nAtomType_ = other.nAtomType_;
47 isInitialized_ = other.isInitialized_;
48 epsilon_ = other.epsilon_;
49 sigma_ = other.sigma_;
50 sigmaCb_ = other.sigmaCb_;
51 cutoff_ = other.cutoff_;
52 coeff_ = other.coeff_;
64 if (nAtomType > MaxAtomType) {
65 UTIL_THROW(
"nAtomType > BoxExternal::MaxAtomType");
67 nAtomType_ = nAtomType;
74 { boundaryPtr_ = &boundary; }
82 if (!isInitialized_) {
83 UTIL_THROW(
"BoxExternal potential is not initialized");
94 if (nAtomType_ == 0) {
95 UTIL_THROW(
"nAtomType must be set before readParam");
98 UTIL_THROW(
"Boundary must be set before readParam");
102 read<double>(in,
"epsilon", epsilon_);
103 read<double>(in,
"sigma", sigma_);
104 read<double>(in,
"cutoff", cutoff_);
107 sigmaCb_ = sigma_ * sigma_ * sigma_;
108 coeff_ = 4.0 * epsilon_ * acos(-1.0) / 45.0 * 0.7 * sigmaCb_;
110 isInitialized_ =
true;
119 if (nAtomType_ <= 0) {
123 UTIL_THROW(
"Boundary must be set before loadParameters");
125 loadParameter<double> (ar,
"epsilon", epsilon_);
126 loadParameter<double> (ar,
"sigma", sigma_);
127 loadParameter<double> (ar,
"cutoff", cutoff_);
130 isInitialized_ =
true;
148 void BoxExternal::set(std::string name,
double value)
150 if (name ==
"epsilon") {
153 if (name ==
"sigma") {
156 if (name ==
"cutoff") {
166 double BoxExternal::get(std::string name)
const 169 if (name ==
"epsilon") {
172 if (name ==
"sigma") {
175 if (name ==
"cutoff") {
195 {
return std::string(
"BoxExternal"); }
virtual void loadParameters(Serializable::IArchive &ar)
Load internal state from an archive.
An orthorhombic periodic unit cell.
void readParameters(std::istream &in)
Read potential parameters, and initialize other variables.
void setExternalParameter(double externalParameter)
Sets external parameter.
Classes used by all simpatico molecular simulations.
BoxExternal & operator=(const BoxExternal &other)
Assignment.
Saving / output archive for binary ostream.
std::string className() const
Return name string "LJPair" for this evaluator class.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
virtual void save(Serializable::OArchive &ar)
Save internal state to an archive.
BoxExternal()
Default constructor.
Utility classes for scientific computation.
double externalParameter() const
Returns external parameter.
A repulsive 9-3 potential confining particles within a box.
Saving archive for binary istream.
void setClassName(const char *className)
Set class name string.
void setNAtomType(int nAtomType)
Set nAtomType value.
void setBoundary(Boundary &boundary)
Set pointer to Boundary.