48#include "applications/sequentialProps/ContactAngle1.hpp"
57#include "utils/Constants.hpp"
58#include "utils/simError.h"
62 ContactAngle1::ContactAngle1(
SimInfo* info,
const std::string& filename,
63 const std::string& sele1,
64 const std::string& sele2, RealType solidZ,
65 RealType dropletRadius) :
67 solidZ_(solidZ), dropletRadius_(dropletRadius) {
68 setOutputName(
getPrefix(filename) +
".ca1");
70 std::stringstream params;
71 params <<
" solid Z = " << solidZ_
72 <<
", droplet radius = " << dropletRadius_;
74 const std::string paramString = params.str();
75 setParameterString(paramString);
78 void ContactAngle1::doFrame(
int) {
82 if (evaluator1_.isDynamic()) {
83 seleMan1_.setSelectionSet(evaluator1_.evaluate());
93 auto reducedSeleMan = seleMan1_.removeAtomsInRigidBodies();
95 for (sd = reducedSeleMan.beginSelected(i); sd != NULL;
96 sd = reducedSeleMan.nextSelected(i)) {
99 com += sd->getPos() * mass;
104 RealType dz = com.z() - solidZ_;
107 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
108 "ContactAngle1: Z-center of mass of selection, %lf, was\n"
109 "\tlocated below the solid reference plane, %lf\n",
111 painCave.isFatal = 1;
112 painCave.severity = OPENMD_ERROR;
116 if (dz > dropletRadius_) {
117 values_.push_back(180.0);
119 RealType k = pow(2.0, -4.0 / 3.0) * dropletRadius_;
121 RealType z2 = dz * dz;
122 RealType z3 = z2 * dz;
124 RealType k3 = k2 * k;
126 Polynomial<RealType> poly;
127 poly.setCoefficient(4, z3 + k3);
128 poly.setCoefficient(3, 8.0 * z3 + 8.0 * k3);
129 poly.setCoefficient(2, 24.0 * z3 + 18.0 * k3);
130 poly.setCoefficient(1, 32.0 * z3);
131 poly.setCoefficient(0, 16.0 * z3 - 27.0 * k3);
132 vector<RealType> realRoots = poly.FindRealRoots();
136 vector<RealType>::iterator ri;
138 RealType maxct = -1.0;
139 for (ri = realRoots.begin(); ri != realRoots.end(); ++ri) {
141 if (ct > 1.0) ct = 1.0;
142 if (ct < -1.0) ct = -1.0;
145 if (ct > maxct) { maxct = ct; }
148 values_.push_back(acos(maxct) * (180.0 / Constants::PI));
"applications/sequentialProps/SequentialAnalyzer"
One of the heavy-weight classes of OpenMD, SimInfo maintains objects and variables relating to the cu...
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
std::string getPrefix(const std::string &str)