45#include "applications/sequentialProps/ContactAngle1.hpp"
54#include "utils/Constants.hpp"
55#include "utils/simError.h"
59 ContactAngle1::ContactAngle1(
SimInfo* info,
const std::string& filename,
60 const std::string& sele1,
61 const std::string& sele2, RealType solidZ,
62 RealType dropletRadius) :
64 solidZ_(solidZ), dropletRadius_(dropletRadius) {
65 setOutputName(
getPrefix(filename) +
".ca1");
67 std::stringstream params;
68 params <<
" solid Z = " << solidZ_
69 <<
", droplet radius = " << dropletRadius_;
71 const std::string paramString = params.str();
72 setParameterString(paramString);
75 void ContactAngle1::doFrame(
int) {
80 seleMan1_.setSelectionSet(evaluator1_.evaluate());
91 com += sd->
getPos() * mass;
96 RealType dz = com.z() - solidZ_;
99 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
100 "ContactAngle1: Z-center of mass of selection, %lf, was\n"
101 "\tlocated below the solid reference plane, %lf\n",
103 painCave.isFatal = 1;
104 painCave.severity = OPENMD_ERROR;
108 if (dz > dropletRadius_) {
109 values_.push_back(180.0);
111 RealType k = pow(2.0, -4.0 / 3.0) * dropletRadius_;
113 RealType z2 = dz * dz;
114 RealType z3 = z2 * dz;
116 RealType k3 = k2 * k;
118 Polynomial<RealType> poly;
119 poly.setCoefficient(4, z3 + k3);
120 poly.setCoefficient(3, 8.0 * z3 + 8.0 * k3);
121 poly.setCoefficient(2, 24.0 * z3 + 18.0 * k3);
122 poly.setCoefficient(1, 32.0 * z3);
123 poly.setCoefficient(0, 16.0 * z3 - 27.0 * k3);
124 vector<RealType> realRoots = poly.FindRealRoots();
128 vector<RealType>::iterator ri;
130 RealType maxct = -1.0;
131 for (ri = realRoots.begin(); ri != realRoots.end(); ++ri) {
133 if (ct > 1.0) ct = 1.0;
134 if (ct < -1.0) ct = -1.0;
137 if (ct > maxct) { maxct = ct; }
140 values_.push_back(acos(maxct) * (180.0 / Constants::PI));
bool isDynamic()
Tests if the result from evaluation of script is dynamic.
StuntDouble * nextSelected(int &i)
Finds the next selected StuntDouble in the selection.
StuntDouble * beginSelected(int &i)
Finds the first selected StuntDouble in the selection.
"applications/sequentialProps/SequentialAnalyzer"
One of the heavy-weight classes of OpenMD, SimInfo maintains objects and variables relating to the cu...
"Don't move, or you're dead! Stand up! Captain, we've got them!"
RealType getMass()
Returns the mass of this stuntDouble.
Vector3d getPos()
Returns the current position of this stuntDouble.
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
std::string getPrefix(const std::string &str)