8 #include "SlitExternal.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 > SlitExternal::MaxAtomType");
67 nAtomType_ = nAtomType;
74 { boundaryPtr_ = &boundary; }
82 if (!isInitialized_) {
83 UTIL_THROW(
"SlitExternal 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;
149 void SlitExternal::set(std::string name,
double value)
151 if (name ==
"epsilon") {
154 if (name ==
"sigma") {
157 if (name ==
"cutoff") {
167 double SlitExternal::get(std::string name)
const 170 if (name ==
"epsilon") {
173 if (name ==
"sigma") {
176 if (name ==
"cutoff") {
196 {
return std::string(
"SlitExternal"); }
void setExternalParameter(double externalParameter)
Sets external parameter.
virtual void loadParameters(Serializable::IArchive &ar)
Load internal state from an archive.
void setBoundary(Boundary &boundary)
Set pointer to Boundary.
An orthorhombic periodic unit cell.
double externalParameter() const
Returns external parameter.
virtual void save(Serializable::OArchive &ar)
Save internal state to an archive.
Classes used by all simpatico molecular simulations.
Saving / output archive for binary ostream.
void setNAtomType(int nAtomType)
Set nAtomType value.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
Utility classes for scientific computation.
A repulsive 9-3 potential confining particles along the z direction.
Saving archive for binary istream.
void readParameters(std::istream &in)
Read potential parameters, and initialize other variables.
std::string className() const
Return name string "LJPair" for this evaluator class.
void setClassName(const char *className)
Set class name string.
SlitExternal()
Default constructor.
SlitExternal & operator=(const SlitExternal &other)
Assignment.