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 2072 by gezelter, Sat Mar 7 22:54:56 2015 UTC vs.
Revision 2081 by gezelter, Tue Mar 17 18:22:18 2015 UTC

# Line 54 | Line 54 | namespace OpenMD {
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), solidZ_(solidZ),
61 <    threshDens_(threshDens), bufferLength_(bufferLength), nRBins_(nrbins),
62 <    nZBins_(nzbins), selectionScript_(sele), seleMan_(info),
63 <    evaluator_(info) {
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      
# 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_)) {
133 <        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 >      if ((whichRBin < int(nRBins_)) && (whichZBin >= 0) && (whichZBin < int(nZBins_))) {
133 >        histo[whichRBin][whichZBin] += sd->getMass();
134        }
135        
136      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines