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

Comparing branches/development/src/applications/staticProps/GofRAngle.cpp (file contents):
Revision 1767 by gezelter, Fri Jul 6 22:01:58 2012 UTC vs.
Revision 1794 by gezelter, Thu Sep 6 19:44:06 2012 UTC

# Line 43 | Line 43
43   #include <algorithm>
44   #include <fstream>
45   #include "applications/staticProps/GofRAngle.hpp"
46 + #include "primitives/Atom.hpp"
47 + #include "types/MultipoleAdapter.hpp"
48   #include "utils/simError.h"
49  
50   namespace OpenMD {
# Line 68 | Line 70 | namespace OpenMD {
70      }
71    }
72  
73 <  void GofRAngle::initalizeHistogram() {
73 >  void GofRAngle::initializeHistogram() {
74      npairs_ = 0;
75      for (unsigned int i = 0; i < histogram_.size(); ++i){
76        std::fill(histogram_[i].begin(), histogram_[i].end(), 0);
# Line 107 | Line 109 | namespace OpenMD {
109        currentSnapshot_->wrapVector(r12);
110  
111      RealType distance = r12.length();
112 <    int whichRBin = distance / deltaR_;
112 >    int whichRBin = int(distance / deltaR_);
113  
114      if (distance <= len_) {
115  
116        RealType cosAngle = evaluateAngle(sd1, sd2);
117        RealType halfBin = (nAngleBins_ - 1) * 0.5;
118 <      int whichThetaBin = halfBin * (cosAngle + 1.0);
118 >      int whichThetaBin = int(halfBin * (cosAngle + 1.0));
119        ++histogram_[whichRBin][whichThetaBin];
120          
121        ++npairs_;
# Line 157 | Line 159 | namespace OpenMD {
159        currentSnapshot_->wrapVector(r12);
160  
161      r12.normalize();
162 <    Vector3d dipole = sd1->getElectroFrame().getColumn(2);
163 <    dipole.normalize();    
164 <    return dot(r12, dipole);
162 >
163 >    AtomType* atype1 = static_cast<Atom*>(sd1)->getAtomType();
164 >    MultipoleAdapter ma1 = MultipoleAdapter(atype1);
165 >    Vector3d vec;
166 >    if (ma1.isDipole() )
167 >      vec = sd1->getDipole();
168 >    else
169 >      vec = sd1->getA().transpose() * V3Z;
170 >    vec.normalize();    
171 >
172 >    return dot(r12, vec);
173    }
174  
175    RealType GofROmega::evaluateAngle(StuntDouble* sd1, StuntDouble* sd2) {
176 <    Vector3d v1 = sd1->getElectroFrame().getColumn(2);
177 <    Vector3d v2 = sd2->getElectroFrame().getColumn(2);    
176 >
177 >    AtomType* atype1 = static_cast<Atom*>(sd1)->getAtomType();
178 >    AtomType* atype2 = static_cast<Atom*>(sd2)->getAtomType();
179 >
180 >    MultipoleAdapter ma1 = MultipoleAdapter(atype1);
181 >    MultipoleAdapter ma2 = MultipoleAdapter(atype2);
182 >
183 >    Vector3d v1, v2;
184 >
185 >    if (ma1.isDipole() )
186 >      v1 = sd1->getDipole();
187 >    else
188 >      v1 = sd1->getA().transpose() * V3Z;
189 >
190 >    if (ma2.isDipole() )
191 >      v2 = sd2->getDipole();
192 >    else
193 >      v2 = sd2->getA().transpose() * V3Z;
194 >
195      v1.normalize();
196      v2.normalize();
197      return dot(v1, v2);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines