--- trunk/src/applications/sequentialProps/ContactAngle2.cpp 2014/11/04 20:16:29 2037 +++ trunk/src/applications/sequentialProps/ContactAngle2.cpp 2015/03/07 21:41:51 2071 @@ -51,14 +51,16 @@ namespace OpenMD { #include "math/Eigenvalue.hpp" namespace OpenMD { - + ContactAngle2::ContactAngle2(SimInfo* info, const std::string& filename, const std::string& sele, RealType solidZ, - RealType threshDens, int nrbins, int nzbins) - : SequentialAnalyzer(info, filename), selectionScript_(sele), - evaluator_(info), seleMan_(info), solidZ_(solidZ), - threshDens_(threshDens), nRBins_(nrbins), nZBins_(nzbins) { - + RealType threshDens, RealType bufferLength, + int nrbins, int nzbins) + : SequentialAnalyzer(info, filename), solidZ_(solidZ), + threshDens_(threshDens), bufferLength_(bufferLength), nRBins_(nrbins), + nZBins_(nzbins), selectionScript_(sele), seleMan_(info), + evaluator_(info) { + setOutputName(getPrefix(filename) + ".ca2"); evaluator_.loadScriptString(sele); @@ -120,8 +122,8 @@ namespace OpenMD { // z is possibly symmetric around 0 z = pos.z(); - int whichRBin = int(r / dr); - int whichZBin = int( (zLen/2.0 + z) / dz); + std::size_t whichRBin = int(r / dr); + std::size_t whichZBin = int( (zLen/2.0 + z) / dz); if ((whichRBin < nRBins_) && (whichZBin >= 0) && (whichZBin < nZBins_)) histo[whichRBin][whichZBin] += sd->getMass(); @@ -154,8 +156,8 @@ namespace OpenMD { bool foundThresh = false; int rloc = 0; - for (unsigned int i = 0; i < nRBins_; ++i) { - RealType ther = dr * (i + 0.5); + for (std::size_t i = 0; i < nRBins_; ++i) { + if (histo[i][j] >= threshDens_) aboveThresh = true; if (aboveThresh && (histo[i][j] <= threshDens_)) { @@ -169,7 +171,10 @@ namespace OpenMD { Vector point; point[0] = dr*(rloc+0.5); point[1] = thez; - points.push_back( point ); + + if (thez > bufferLength_) { + points.push_back( point ); + } } } @@ -246,7 +251,6 @@ namespace OpenMD { center[1] = -((RealType)0.5)*coeff[2]; RealType radius = sqrt(fabs(center[0]*center[0] + center[1]*center[1] - coeff[0])); - RealType ev0 = fabs(evals[0]); int i1; for (i1 = 0; i1 < 100; ++i1) { @@ -284,12 +288,7 @@ namespace OpenMD { if (fabs(zCen) > rDrop) { ca = 180.0; } else { - - if (zCen >= 0.0) { - ca = 90.0 + asin(zCen/rDrop)*(180.0/M_PI); - } else { - ca = 90 - asin(zCen/rDrop)*(180.0/M_PI); - } + ca = 90.0 + asin(zCen/rDrop)*(180.0/M_PI); } values_.push_back( ca );