ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/applications/sequentialProps/ContactAngle2.cpp
(Generate patch)

Comparing trunk/src/applications/sequentialProps/ContactAngle2.cpp (file contents):
Revision 2037 by gezelter, Tue Nov 4 20:16:29 2014 UTC vs.
Revision 2072 by gezelter, Sat Mar 7 22:54:56 2015 UTC

# Line 51 | Line 51 | namespace OpenMD {
51   #include "math/Eigenvalue.hpp"
52  
53   namespace OpenMD {
54 <
54 >  
55    ContactAngle2::ContactAngle2(SimInfo* info, const std::string& filename,
56                                 const std::string& sele, RealType solidZ,
57 <                               RealType threshDens, int nrbins, int nzbins)
58 <    : SequentialAnalyzer(info, filename), selectionScript_(sele),
59 <      evaluator_(info), seleMan_(info), solidZ_(solidZ),
60 <      threshDens_(threshDens), nRBins_(nrbins), nZBins_(nzbins) {
61 <
57 >                               RealType threshDens, RealType bufferLength,
58 >                               int nrbins, int nzbins)
59 >  : SequentialAnalyzer(info, filename), solidZ_(solidZ),
60 >    threshDens_(threshDens), bufferLength_(bufferLength), nRBins_(nrbins),
61 >    nZBins_(nzbins), selectionScript_(sele), seleMan_(info),
62 >    evaluator_(info) {
63 >    
64      setOutputName(getPrefix(filename) + ".ca2");
65      
66      evaluator_.loadScriptString(sele);
# Line 123 | Line 125 | namespace OpenMD {
125        int whichRBin = int(r / dr);
126        int whichZBin = int( (zLen/2.0 + z) / dz);
127        
128 <      if ((whichRBin < nRBins_) && (whichZBin >= 0) && (whichZBin < nZBins_))
129 <        histo[whichRBin][whichZBin] += sd->getMass();
128 >      if ((whichRBin < nRBins_) && (whichZBin >= 0) && (whichZBin < nZBins_)) {
129 >        std::size_t i = static_cast<std::size_t>(whichRBin);
130 >        std::size_t j = static_cast<std::size_t>(whichZBin);
131 >        histo[i][j] += sd->getMass();
132 >      }
133        
134      }
135      
# Line 154 | Line 159 | namespace OpenMD {
159        bool foundThresh = false;
160        int rloc = 0;
161        
162 <      for (unsigned int i = 0; i < nRBins_;  ++i) {
163 <        RealType ther = dr * (i + 0.5);
162 >      for (std::size_t i = 0; i < nRBins_;  ++i) {
163 >
164          if (histo[i][j] >= threshDens_) aboveThresh = true;
165  
166          if (aboveThresh && (histo[i][j] <= threshDens_)) {
# Line 169 | Line 174 | namespace OpenMD {
174          Vector<RealType,2> point;
175          point[0] = dr*(rloc+0.5);
176          point[1] = thez;
177 <        points.push_back( point );      
177 >
178 >        if (thez > bufferLength_) {
179 >          points.push_back( point );
180 >        }
181        }      
182      }
183  
# Line 246 | Line 254 | namespace OpenMD {
254      center[1] = -((RealType)0.5)*coeff[2];
255      RealType radius = sqrt(fabs(center[0]*center[0] + center[1]*center[1]
256                                  - coeff[0]));
249    RealType ev0 =  fabs(evals[0]);
257  
258      int i1;
259      for (i1 = 0; i1 < 100; ++i1) {
# Line 284 | Line 291 | namespace OpenMD {
291      if (fabs(zCen) > rDrop) {
292        ca = 180.0;
293      } else {
294 <    
288 <      if (zCen >= 0.0) {
289 <        ca = 90.0 + asin(zCen/rDrop)*(180.0/M_PI);
290 <      } else {
291 <        ca = 90 - asin(zCen/rDrop)*(180.0/M_PI);
292 <      }
294 >      ca = 90.0 + asin(zCen/rDrop)*(180.0/M_PI);
295      }
296  
297      values_.push_back( ca );

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines