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

Comparing trunk/OOPSE-4/src/applications/staticProps/GofRAngle.cpp (file contents):
Revision 1993 by tim, Thu Feb 10 14:15:52 2005 UTC vs.
Revision 2037 by tim, Wed Feb 16 19:36:30 2005 UTC

# Line 46 | Line 46 | GofRAngle::GofRAngle(SimInfo* info, const std::string&
46  
47   namespace oopse {
48  
49 < GofRAngle::GofRAngle(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2, double len)
50 <    : RadialDistrFunc(info, filename, sele1, sele2, len){
49 > GofRAngle::GofRAngle(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2)
50 >    : RadialDistrFunc(info, filename, sele1, sele2){
51  
52    histogram_.resize(nbins_);
53    avgGofr_.resize(nbins_);
52   }
53  
54  
55   void GofRAngle::preProcess() {
56 <    avgGofr_.resize(nbins_);
57 <    for (int i = 0; i < avgGofr_.size(); ++i)
56 >
57 >    for (int i = 0; i < avgGofr_.size(); ++i) {
58          std::fill(avgGofr_[i].begin(), avgGofr_[i].end(), 0);
59 +    }
60   }
61  
62   void GofRAngle::initalizeHistogram() {
# Line 69 | Line 68 | void GofRAngle::processHistogram() {
68  
69   void GofRAngle::processHistogram() {
70  
71 +    int nPairs = getNPairs();
72      double volume = info_->getSnapshotManager()->getCurrentSnapshot()->getVolume();
73 <    double pairDensity = npairs_ /volume;
74 <    double pairConstant = ( 4.0 * PI * pairDensity ) / 3.0;
73 >    double pairDensity = nPairs /volume;
74 >    double pairConstant = ( 4.0 * NumericConstant::PI * pairDensity ) / 3.0;
75  
76      for(int i = 0 ; i < histogram_.size(); ++i){
77  
# Line 99 | Line 99 | void GofRAngle::collectHistogram(StuntDouble* sd1, Stu
99      currentSnapshot_->wrapVector(r12);
100  
101      double distance = r12.length();
102 <    int whichBin = distance / deltaR_;
102 >    int whichRBin = distance / deltaR_;
103  
104 <    
105 <    double cosAngle = evaluateAngle(sd1, sd2);
106 <    histogram_[whichBin] ++;
107 <    
108 <    npairs_++;
104 >    if (distance <= len_) {
105 >        double cosAngle = evaluateAngle(sd1, sd2);
106 >        double halfBin = (nAngleBins_ - 1) * 0.5;
107 >        int whichThetaBin = halfBin * (cosAngle + 1.0);
108 >        ++histogram_[whichRBin][whichThetaBin];
109 >        
110 >        ++npairs_;
111 >    }
112   }
113  
114   void GofRAngle::writeRdf() {
# Line 119 | Line 122 | void GofRAngle::writeRdf() {
122              double r = deltaR_ * (i + 0.5);
123  
124              for(int j = 0; j < avgGofr_[i].size(); ++j) {
125 <                double cosAngle = ;
125 >                double cosAngle = -1.0 + (i + 0.5)*deltaCosAngle_;
126                  rdfStream << r << "\t" << cosAngle << "\t" << avgGofr_[i][j]/nProcessed_ << "\n";
127              }
128          }
# Line 132 | Line 135 | void GofRAngle::writeRdf() {
135      rdfStream.close();
136   }
137  
135
136
138   double GofRTheta::evaluateAngle(StuntDouble* sd1, StuntDouble* sd2) {
139      Vector3d pos1 = sd1->getPos();
140      Vector3d pos2 = sd2->getPos();
141      Vector3d r12 = pos1 - pos2;
142      currentSnapshot_->wrapVector(r12);
143      r12.normalize();
144 <    Vector3d dipole = sd1->getElectroFrame().getColumn(2)£»
144 >    Vector3d dipole = sd1->getElectroFrame().getColumn(2);
145      dipole.normalize();    
146 <    return dot();
146 >    return dot(r12, dipole);
147   }
148  
149   double GofROmega::evaluateAngle(StuntDouble* sd1, StuntDouble* sd2) {
150      Vector3d v1 = sd1->getElectroFrame().getColumn(2);
151 <    Vector3d v2 = sd1->getElectroFrame().getColumn(2);
152 <
153 <    
151 >    Vector3d v2 = sd1->getElectroFrame().getColumn(2);    
152 >    v1.normalize();
153 >    v2.normalize();
154 >    return dot(v1, v2);
155   }
156  
157  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines