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 2039 by gezelter, Thu Nov 6 14:31:32 2014 UTC vs.
Revision 2081 by gezelter, Tue Mar 17 18:22:18 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 centroidX, RealType centroidY,
58                                 RealType threshDens, RealType bufferLength,
59                                 int nrbins, int nzbins)
60 <    : SequentialAnalyzer(info, filename), selectionScript_(sele),
61 <      evaluator_(info), seleMan_(info), solidZ_(solidZ),
62 <      threshDens_(threshDens), bufferLength_(bufferLength),
63 <      nRBins_(nrbins), nZBins_(nzbins) {
64 <
60 >    : SequentialAnalyzer(info, filename), solidZ_(solidZ),
61 >      centroidX_(centroidX), centroidY_(centroidY),
62 >      threshDens_(threshDens), bufferLength_(bufferLength), nRBins_(nrbins),
63 >      nZBins_(nzbins), selectionScript_(sele), seleMan_(info),
64 >      evaluator_(info) {
65 >    
66      setOutputName(getPrefix(filename) + ".ca2");
67      
68      evaluator_.loadScriptString(sele);
# Line 95 | Line 97 | namespace OpenMD {
97      }
98      
99  
100 <    RealType mtot = 0.0;
101 <    Vector3d com(V3Zero);
102 <    RealType mass;
103 <    
104 <    for (sd = seleMan_.beginSelected(i); sd != NULL;
105 <         sd = seleMan_.nextSelected(i)) {      
106 <      mass = sd->getMass();
107 <      mtot += mass;
108 <      com += sd->getPos() * mass;
109 <    }
100 >    // RealType mtot = 0.0;
101 >    // Vector3d com(V3Zero);
102 >    // RealType mass;
103 >    
104 >    // for (sd = seleMan_.beginSelected(i); sd != NULL;
105 >    //      sd = seleMan_.nextSelected(i)) {      
106 >    //   mass = sd->getMass();
107 >    //   mtot += mass;
108 >    //   com += sd->getPos() * mass;
109 >    // }
110  
111 <    com /= mtot;
111 >    // com /= mtot;
112  
113 +    Vector3d com(centroidX_, centroidY_, solidZ_);
114 +
115      // now that we have the centroid, we can make cylindrical density maps
116      Vector3d pos;
117      RealType r;
# Line 125 | Line 129 | namespace OpenMD {
129        int whichRBin = int(r / dr);
130        int whichZBin = int( (zLen/2.0 + z) / dz);
131        
132 <      if ((whichRBin < nRBins_) && (whichZBin >= 0) && (whichZBin < nZBins_))
132 >      if ((whichRBin < int(nRBins_)) && (whichZBin >= 0) && (whichZBin < int(nZBins_))) {
133          histo[whichRBin][whichZBin] += sd->getMass();
134 +      }
135        
136      }
137      
# Line 156 | Line 161 | namespace OpenMD {
161        bool foundThresh = false;
162        int rloc = 0;
163        
164 <      for (unsigned int i = 0; i < nRBins_;  ++i) {
165 <        RealType ther = dr * (i + 0.5);
164 >      for (std::size_t i = 0; i < nRBins_;  ++i) {
165 >
166          if (histo[i][j] >= threshDens_) aboveThresh = true;
167  
168          if (aboveThresh && (histo[i][j] <= threshDens_)) {
# Line 251 | Line 256 | namespace OpenMD {
256      center[1] = -((RealType)0.5)*coeff[2];
257      RealType radius = sqrt(fabs(center[0]*center[0] + center[1]*center[1]
258                                  - coeff[0]));
254    RealType ev0 =  fabs(evals[0]);
259  
260      int i1;
261      for (i1 = 0; i1 < 100; ++i1) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines