8 #include "OrthoBoxExternal.h" 31 : indConfine_(other.indConfine_),
32 epsilon_(other.epsilon_),
34 sigmaCb_(other.sigmaCb_),
35 cutoff_(other.cutoff_),
37 boundaryPtr_(other.boundaryPtr_),
38 nAtomType_(other.nAtomType_),
39 isInitialized_(other.isInitialized_)
47 indConfine_ = other.indConfine_;
48 boundaryPtr_ = other.boundaryPtr_;
49 nAtomType_ = other.nAtomType_;
50 isInitialized_ = other.isInitialized_;
51 epsilon_ = other.epsilon_;
52 sigma_ = other.sigma_;
53 sigmaCb_ = other.sigmaCb_;
54 cutoff_ = other.cutoff_;
55 coeff_ = other.coeff_;
67 if (nAtomType > MaxAtomType) {
68 UTIL_THROW(
"nAtomType > OrthoBoxExternal::MaxAtomType");
70 nAtomType_ = nAtomType;
77 { boundaryPtr_ = &boundary; }
85 if (!isInitialized_) {
86 UTIL_THROW(
"OrthoBoxExternal potential is not initialized");
97 if (nAtomType_ == 0) {
98 UTIL_THROW(
"nAtomType must be set before readParam");
101 UTIL_THROW(
"Boundary must be set before readParam");
105 read<int>(in,
"indexConfinement", indConfine_);
106 if (indConfine_ < 0 || indConfine_ >
Dimension) {
107 UTIL_THROW(
"Invalid index for confinement directions.");
109 read<double>(in,
"epsilon", epsilon_);
110 read<double>(in,
"sigma", sigma_);
111 read<double>(in,
"cutoff", cutoff_);
114 sigmaCb_ = sigma_ * sigma_ * sigma_;
115 coeff_ = 4.0 * epsilon_ * acos(-1.0) / 45.0 * 0.7 * sigmaCb_;
117 isInitialized_ =
true;
126 if (nAtomType_ <= 0) {
130 UTIL_THROW(
"Boundary must be set before readParam");
132 loadParameter<int>(ar,
"indexConfinement", indConfine_);
133 if (indConfine_ < 0 || indConfine_ >
Dimension) {
134 UTIL_THROW(
"Invalid index for confinement directions.");
136 loadParameter<double>(ar,
"epsilon", epsilon_);
137 loadParameter<double>(ar,
"sigma", sigma_);
138 loadParameter<double>(ar,
"cutoff", cutoff_);
141 isInitialized_ =
true;
161 void OrthoBoxExternal::set(std::string name,
double value)
163 if (name ==
"epsilon") {
166 if (name ==
"sigma") {
169 if (name ==
"cutoff") {
179 double OrthoBoxExternal::get(std::string name)
const 182 if (name ==
"epsilon") {
185 if (name ==
"sigma") {
188 if (name ==
"cutoff") {
208 {
return std::string(
"OrthoBoxExternal"); }
const int Dimension
Dimensionality of space.
A repulsive 9-3 potential confining particles inside an orthogonal box along directions specified by ...
An orthorhombic periodic unit cell.
double externalParameter() const
Returns external parameter.
Classes used by all simpatico molecular simulations.
void readParameters(std::istream &in)
Read potential parameters, and initialize other variables.
std::string className() const
Return name string "LJPair" for this evaluator class.
OrthoBoxExternal()
Default constructor.
Saving / output archive for binary ostream.
#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.
Utility classes for scientific computation.
OrthoBoxExternal & operator=(const OrthoBoxExternal &other)
Assignment.
Saving archive for binary istream.
void setNAtomType(int nAtomType)
Set nAtomType value.
void setClassName(const char *className)
Set class name string.
void setBoundary(Boundary &boundary)
Set pointer to Boundary.
virtual void loadParameters(Serializable::IArchive &ar)
Load internal state from an archive.
void setExternalParameter(double externalParameter)
Sets external parameter.