8 #include "LocalLamellarOrderingExternal.h" 22 parallelDirection_(0),
36 : perpDirection_(other.perpDirection_),
37 parallelDirection_(other.parallelDirection_),
38 fraction_(other.fraction_),
40 externalParameter_(other.externalParameter_),
41 periodicity_(other.periodicity_),
42 boundaryPtr_(other.boundaryPtr_),
43 nAtomType_(other.nAtomType_),
44 isInitialized_(other.isInitialized_)
47 for (
int i=0; i < nAtomType_; ++i) {
48 prefactor_[i] = other.prefactor_[i];
57 perpDirection_ = other.perpDirection_;
58 parallelDirection_ = other.parallelDirection_;
59 fraction_ = other.fraction_;
60 boundaryPtr_ = other.boundaryPtr_;
61 nAtomType_ = other.nAtomType_;
62 isInitialized_ = other.isInitialized_;
63 width_ = other.width_;
64 periodicity_ = other.periodicity_;
65 externalParameter_ = other.externalParameter_;
67 for (i=0; i < nAtomType_; ++i) {
68 prefactor_[i] = other.prefactor_[i];
81 if (nAtomType > MaxAtomType) {
82 UTIL_THROW(
"nAtomType > LocalLamellarOrderingExternal::MaxAtomType");
84 nAtomType_ = nAtomType;
90 if (!isInitialized_) {
91 UTIL_THROW(
"LocalLamellarOrderingExternal potential is not initialized");
102 { boundaryPtr_ = &boundary; }
109 if (nAtomType_ == 0) {
110 UTIL_THROW(
"nAtomType must be set before readParam");
113 UTIL_THROW(
"Boundary must be set before readParam");
117 read<int>(in,
"perpDirection", perpDirection_);
118 if (perpDirection_ < 0 || perpDirection_ >=
Dimension) {
119 UTIL_THROW(
"Invalid index for perpendicular direction.");
121 read<int>(in,
"parallelDirection", parallelDirection_);
122 if (parallelDirection_ < 0 || parallelDirection_ >=
Dimension) {
123 UTIL_THROW(
"Invalid index for parallel direction.");
125 read<double>(in,
"fraction", fraction_);
127 readDArray<double>(in,
"prefactor", prefactor_, nAtomType_);
128 read<double>(in,
"externalParameter", externalParameter_);
129 read<double>(in,
"interfaceWidth", width_);
130 read<int>(in,
"periodicity", periodicity_);
132 isInitialized_ =
true;
141 if (nAtomType_ <= 0) {
144 loadParameter<int>(ar,
"perpDirection", perpDirection_);
145 if (perpDirection_ < 0 || perpDirection_ >=
Dimension) {
146 UTIL_THROW(
"Invalid index for perpendicular direction.");
148 loadParameter<int>(ar,
"parallelDirection", perpDirection_);
149 if (parallelDirection_ < 0 || parallelDirection_ >=
Dimension) {
150 UTIL_THROW(
"Invalid index for parallel direction.");
152 loadParameter<double>(ar,
"fraction", fraction_);
154 loadDArray<double>(ar,
"prefactor", prefactor_, nAtomType_);
155 loadParameter<double>(ar,
"externalParameter", externalParameter_);
156 loadParameter<double>(ar,
"interfaceWidth", width_);
157 loadParameter<int>(ar,
"periodicity", periodicity_);
158 isInitialized_ =
true;
167 ar << perpDirection_;
168 ar << parallelDirection_;
170 ar << externalParameter_;
179 void LocalLamellarOrderingExternal::set(std::string name,
double value)
181 if (name ==
"fraction") {
184 if (name ==
"externalParameter") {
185 externalParameter_ = value;
187 if (name ==
"interfaceWidth") {
197 double LocalLamellarOrderingExternal::get(std::string name)
const 200 if (name ==
"fraction") {
203 if (name ==
"externalParameter") {
204 value = externalParameter_;
206 if (name ==
"interfaceWidth") {
215 {
return externalParameter_; }
221 {
return std::string(
"LocalLamellarOrderingExternal"); }
void readParameters(std::istream &in)
Read potential parameters, and initialize other variables.
const int Dimension
Dimensionality of space.
std::string className() const
Return name string "LocalLamellarOrderingExternal".
void setBoundary(Boundary &boundary)
Set pointer to Boundary.
An orthorhombic periodic unit cell.
Classes used by all simpatico molecular simulations.
void setExternalParameter(double externalParameter)
Sets external parameter.
A clipped cosine potential that induces lamellar ordering along the direction specified by perpDirect...
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.
double externalParameter() const
Returns external parameter.
virtual void save(Serializable::OArchive &ar)
Save internal state to an archive.
void setNAtomType(int nAtomType)
Set nAtomType value.
void setClassName(const char *className)
Set class name string.
virtual void loadParameters(Serializable::IArchive &ar)
Load internal state from an archive.
void allocate(int capacity)
Allocate the underlying C array.
LocalLamellarOrderingExternal & operator=(const LocalLamellarOrderingExternal &other)
Assignment.
LocalLamellarOrderingExternal()
Default constructor.