ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/applications/staticProps/DensityPlot.cpp
(Generate patch)

Comparing trunk/OOPSE-4/src/applications/staticProps/DensityPlot.cpp (file contents):
Revision 2257 by tim, Mon Jun 13 18:25:30 2005 UTC vs.
Revision 2759 by tim, Wed May 17 21:51:42 2006 UTC

# Line 40 | Line 40
40   */
41  
42   #include <algorithm>
43 + #include <functional>
44   #include "applications/staticProps/DensityPlot.hpp"
45   #include "utils/simError.h"
46   #include "io/DumpReader.hpp"
# Line 48 | Line 49 | DensityPlot::DensityPlot(SimInfo* info, const std::str
49   namespace oopse {
50  
51  
52 < DensityPlot::DensityPlot(SimInfo* info, const std::string& filename, const std::string& sele, const std::string& cmSele, double len, int nrbins)
52 > DensityPlot::DensityPlot(SimInfo* info, const std::string& filename, const std::string& sele, const std::string& cmSele, RealType len, int nrbins)
53    : StaticAnalyser(info, filename), selectionScript_(sele), evaluator_(info), seleMan_(info),
54      cmSelectionScript_(cmSele), cmEvaluator_(info), cmSeleMan_(info),    
55      len_(len), nRBins_(nrbins), halfLen_(len/2)     {
# Line 83 | Line 84 | void DensityPlot::process() {
84    
85    DumpReader reader(info_, dumpFilename_);    
86    int nFrames = reader.getNFrames();
86
87    for (int i = 0; i < nFrames; i += step_) {
88      reader.readFrame(i);
89      currentSnapshot_ = info_->getSnapshotManager()->getCurrentSnapshot();
# Line 107 | Line 107 | void DensityPlot::process() {
107      Vector3d origin = calcNewOrigin();
108  
109      Mat3x3d hmat = currentSnapshot_->getHmat();
110 <    double slabVolume = deltaR_ * hmat(0, 0) * hmat(1, 1);
111 <    
112 <    int i;        
113 <    for (StuntDouble* sd = seleMan_.beginSelected(i); sd != NULL; sd = seleMan_.nextSelected(i)) {
110 >    RealType slabVolume = deltaR_ * hmat(0, 0) * hmat(1, 1);
111 >    int k;
112 >    for (StuntDouble* sd = seleMan_.beginSelected(k); sd != NULL; sd = seleMan_.nextSelected(k)) {
113  
114  
115              if (!sd->isAtom()) {
# Line 138 | Line 137 | void DensityPlot::process() {
137                  simError();  
138              }
139              
140 <            double nelectron = doubleData->getData();
140 >            RealType nelectron = doubleData->getData();
141  
142              data = atom->getAtomType()->getPropertyByName("LennardJones");
143              if (data == NULL) {
# Line 158 | Line 157 | void DensityPlot::process() {
157              }
158  
159              LJParam ljParam = ljData->getData();
160 <            double sigma = ljParam.sigma * 0.5;
161 <            double sigma2 = sigma * sigma;
160 >            RealType sigma = ljParam.sigma * 0.5;
161 >            RealType sigma2 = sigma * sigma;
162  
163              Vector3d pos = sd->getPos() - origin;
165            /*
166            currentSnapshot_->wrapVector(pos);            
167            double wrappedZdist = pos.z() + halfLen_;
168            if (wrappedZdist < 0.0 || wrappedZdist > len_) {
169                continue;
170            }
171            
172            int which =wrappedZdist / deltaR_;        
173            density_[which] += nelectron;
174            */
164              for (int j =0; j < nRBins_; ++j) {
165                  Vector3d tmp(pos);
166 <                double zdist =j * deltaR_ - halfLen_;
166 >                RealType zdist =j * deltaR_ - halfLen_;
167                  tmp[2] += zdist;
168                  currentSnapshot_->wrapVector(tmp);
169  
170 <                double wrappedZdist = tmp.z() + halfLen_;
170 >                RealType wrappedZdist = tmp.z() + halfLen_;
171                  if (wrappedZdist < 0.0 || wrappedZdist > len_) {
172                      continue;
173                  }
# Line 194 | Line 183 | void DensityPlot::process() {
183      }
184  
185    int nProcessed = nFrames /step_;
186 <  std::transform(density_.begin(), density_.end(), density_.begin(), std::bind2nd(std::divides<double>(), nProcessed));  
186 >  std::transform(density_.begin(), density_.end(), density_.begin(), std::bind2nd(std::divides<RealType>(), nProcessed));  
187    writeDensity();
188          
189  
# Line 205 | Line 194 | Vector3d DensityPlot::calcNewOrigin() {
194  
195      int i;
196      Vector3d newOrigin(0.0);
197 <    double totalMass = 0.0;
197 >    RealType totalMass = 0.0;
198      for (StuntDouble* sd = seleMan_.beginSelected(i); sd != NULL; sd = seleMan_.nextSelected(i)) {
199 <        double mass = sd->getMass();
199 >        RealType mass = sd->getMass();
200          totalMass += mass;
201          newOrigin += sd->getPos() * mass;        
202      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines