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

Comparing trunk/src/applications/staticProps/GofRAngle.cpp (file contents):
Revision 963 by tim, Wed May 17 21:51:42 2006 UTC vs.
Revision 1213 by xsun, Wed Jan 23 21:21:50 2008 UTC

# Line 50 | Line 50 | namespace oopse {
50                         const std::string& sele2, RealType len, int nrbins, int nangleBins)
51      : RadialDistrFunc(info, filename, sele1, sele2), len_(len), nRBins_(nrbins), nAngleBins_(nangleBins){
52  
53 <      deltaR_ = len_ /nRBins_;            
54 <      deltaCosAngle_ = 2.0 / nAngleBins_;    
55 <
53 >      deltaR_ = len_ /(double) nRBins_;
54 >      deltaCosAngle_ = 2.0 / (double)nAngleBins_;    
55        histogram_.resize(nRBins_);
56        avgGofr_.resize(nRBins_);
57        for (int i = 0 ; i < nRBins_; ++i) {
# Line 63 | Line 62 | namespace oopse {
62  
63  
64    void GofRAngle::preProcess() {
66
65      for (int i = 0; i < avgGofr_.size(); ++i) {
66        std::fill(avgGofr_[i].begin(), avgGofr_[i].end(), 0);
67      }
# Line 71 | Line 69 | namespace oopse {
69  
70    void GofRAngle::initalizeHistogram() {
71      npairs_ = 0;
72 <    for (int i = 0; i < histogram_.size(); ++i)
72 >    for (int i = 0; i < histogram_.size(); ++i){
73        std::fill(histogram_[i].begin(), histogram_[i].end(), 0);
74 +    }
75    }
76  
78
77    void GofRAngle::processHistogram() {
80
78      int nPairs = getNPairs();
79      RealType volume = info_->getSnapshotManager()->getCurrentSnapshot()->getVolume();
80      RealType pairDensity = nPairs /volume;
# Line 102 | Line 99 | namespace oopse {
99      if (sd1 == sd2) {
100        return;
101      }
105    
102      Vector3d pos1 = sd1->getPos();
103      Vector3d pos2 = sd2->getPos();
104      Vector3d r12 = pos2 - pos1;
105 <    currentSnapshot_->wrapVector(r12);
105 >    if (usePeriodicBoundaryConditions_)
106 >      currentSnapshot_->wrapVector(r12);
107  
108      RealType distance = r12.length();
109      int whichRBin = distance / deltaR_;
110  
111      if (distance <= len_) {
112 +
113        RealType cosAngle = evaluateAngle(sd1, sd2);
114        RealType halfBin = (nAngleBins_ - 1) * 0.5;
115        int whichThetaBin = halfBin * (cosAngle + 1.0);
# Line 153 | Line 151 | namespace oopse {
151      Vector3d pos1 = sd1->getPos();
152      Vector3d pos2 = sd2->getPos();
153      Vector3d r12 = pos2 - pos1;
154 <    currentSnapshot_->wrapVector(r12);
154 >  
155 >    if (usePeriodicBoundaryConditions_)
156 >      currentSnapshot_->wrapVector(r12);
157 >
158      r12.normalize();
159      Vector3d dipole = sd1->getElectroFrame().getColumn(2);
160      dipole.normalize();    

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines