8 #include "LamellarOrderingExternal.h" 34 : perpDirection_(other.perpDirection_),
35 interfaceWidth_(other.interfaceWidth_),
36 externalParameter_(other.externalParameter_),
37 periodicity_(other.periodicity_),
38 boundaryPtr_(other.boundaryPtr_),
39 nAtomType_(other.nAtomType_),
40 isInitialized_(other.isInitialized_)
43 for (
int i=0; i < nAtomType_; ++i) {
44 prefactor_[i] = other.prefactor_[i];
53 perpDirection_ = other.perpDirection_;
54 interfaceWidth_ = other.interfaceWidth_;
55 externalParameter_ = other.externalParameter_;
56 periodicity_ = other.periodicity_;
57 boundaryPtr_ = other.boundaryPtr_;
58 nAtomType_ = other.nAtomType_;
59 isInitialized_ = other.isInitialized_;
60 for (
int i=0; i < nAtomType_; ++i) {
61 prefactor_[i] = other.prefactor_[i];
74 if (nAtomType > MaxAtomType) {
75 UTIL_THROW(
"nAtomType > LamellarOrderingExternal::MaxAtomType");
77 nAtomType_ = nAtomType;
91 { boundaryPtr_ = &boundary; }
98 if (nAtomType_ <= 0) {
99 UTIL_THROW(
"nAtomType must be set before readParam");
102 UTIL_THROW(
"Boundary must be set before readParam");
106 read<int>(in,
"perpDirection", perpDirection_);
107 if (perpDirection_ < 0 || perpDirection_ >=
Dimension) {
108 UTIL_THROW(
"Invalid index for perpendicular direction.");
111 readDArray<double>(in,
"prefactor", prefactor_, nAtomType_);
112 read<double>(in,
"externalParameter", externalParameter_);
113 read<double>(in,
"interfaceWidth", interfaceWidth_);
114 read<int>(in,
"periodicity", periodicity_);
115 isInitialized_ =
true;
124 loadParameter<int>(ar,
"perpDirection", perpDirection_);
125 if (perpDirection_ < 0 || perpDirection_ >=
Dimension) {
126 UTIL_THROW(
"Invalid index for perpendicular direction.");
129 loadDArray<double>(ar,
"prefactor", prefactor_, nAtomType_);
130 loadParameter<double>(ar,
"externalParameter", externalParameter_);
131 loadParameter<double>(ar,
"interfaceWidth", interfaceWidth_);
132 loadParameter<int>(ar,
"periodicity", periodicity_);
133 isInitialized_ =
true;
143 ar << perpDirection_;
145 ar << externalParameter_;
146 ar << interfaceWidth_;
153 void LamellarOrderingExternal::set(std::string name,
double value)
155 if (name ==
"externalParameter") {
156 externalParameter_ = value;
158 if (name ==
"interfaceWidth") {
159 interfaceWidth_ = value;
161 if (name ==
"periodicity") {
162 periodicity_ = value;
171 double LamellarOrderingExternal::get(std::string name)
const 174 if (name ==
"externalParameter") {
175 value = externalParameter_;
177 if (name ==
"interfaceWidth") {
178 value = interfaceWidth_;
180 if (name ==
"periodicity") {
181 value = periodicity_;
192 {
return externalParameter_; }
198 {
return std::string(
"LamellarOrderingExternal"); }
const int Dimension
Dimensionality of space.
void setExternalParameter(double externalParameter)
Sets external parameter.
void setBoundary(Boundary &boundary)
Set pointer to Boundary.
double externalParameter() const
Returns external parameter.
virtual void loadParameters(Serializable::IArchive &ar)
Load internal state from an archive.
LamellarOrderingExternal & operator=(const LamellarOrderingExternal &other)
Assignment.
An orthorhombic periodic unit cell.
virtual void save(Serializable::OArchive &ar)
Save internal state to an archive.
A clipped cosine potential that induces lamellar ordering along the direction specified by perpDirect...
Classes used by all simpatico molecular simulations.
LamellarOrderingExternal()
Default constructor.
Saving / output archive for binary ostream.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
Utility classes for scientific computation.
Saving archive for binary istream.
void setNAtomType(int nAtomType)
Set nAtomType value.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
void setClassName(const char *className)
Set class name string.
void allocate(int capacity)
Allocate the underlying C array.
void readParameters(std::istream &in)
Read potential parameters, and initialize other variables.
std::string className() const
Return name string "LamellarOrderingExternal".