1 #ifndef SIMP_LAMELLAR_ORDERING_EXTERNAL_H 2 #define SIMP_LAMELLAR_ORDERING_EXTERNAL_H 11 #include <simp/boundary/Boundary.h> 12 #include <util/space/Dimension.h> 13 #include <util/param/ParamComposite.h> 107 void set(std::string name,
double value);
112 double get(std::string name)
const;
128 double energy(
double d,
int i)
const;
165 static const int MaxAtomType = 2;
171 double interfaceWidth_;
177 double externalParameter_;
198 double perpLength, q, clipParameter, arg, clipcos;
200 lengths = boundaryPtr_->lengths();
201 perpLength = lengths[perpDirection_];
203 q = (2.0*M_PI*periodicity_)/perpLength;
204 clipParameter = 1.0/(q*interfaceWidth_*perpLength);
206 clipcos = clipParameter*cos(arg);
208 return prefactor_[type]*externalParameter_*tanh(clipcos);
217 double d, totalEnergy;
219 d = position[perpDirection_];
220 totalEnergy +=
energy(d, type);
230 double perpLength, q, clipParameter, arg, clipcos, tanH, sechSq;
232 lengths = boundaryPtr_->lengths();
233 perpLength = lengths[perpDirection_];
235 q = (2.0*M_PI*periodicity_)/perpLength;
236 clipParameter = 1.0/(q*interfaceWidth_*perpLength);
238 clipcos = clipParameter*cos(arg);
239 tanH = tanh(clipcos);
240 sechSq = (1.0 - tanH*tanH);
241 return prefactor_[type]*externalParameter_*sechSq*clipParameter*sin(arg)*q;
251 double d = position[perpDirection_];
255 force[perpDirection_] = scalarf;
Vector & zero()
Set all elements of a 3D vector to zero.
A Vector is a Cartesian vector.
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.
File containing preprocessor macros for error handling.
A clipped cosine potential that induces lamellar ordering along the direction specified by perpDirect...
Classes used by all simpatico molecular simulations.
double energy(double d, int i) const
Returns external potential energy of a particle of type i.
LamellarOrderingExternal()
Default constructor.
Saving / output archive for binary ostream.
double forceScalar(double d, int type) const
Returns magnitude of the external force.
Utility classes for scientific computation.
Saving archive for binary istream.
void setNAtomType(int nAtomType)
Set nAtomType value.
void getForce(const Vector &position, int type, Vector &force) const
Returns force caused by the external potential.
void readParameters(std::istream &in)
Read potential parameters, and initialize other variables.
An object that can read multiple parameters from file.
std::string className() const
Return name string "LamellarOrderingExternal".