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 1785 by jmichalk, Wed Aug 22 18:43:27 2012 UTC vs.
Revision 1879 by gezelter, Sun Jun 16 15:15:42 2013 UTC

# Line 35 | Line 35
35   *                                                                      
36   * [1]  Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).            
37   * [2]  Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).          
38 < * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008).          
38 > * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008).          
39   * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010).
40   * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
41   */
# 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 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 129 | Line 131 | namespace OpenMD {
131        rdfStream << "#nRBins = " << nRBins_ << "\t maxLen = " << len_ << "deltaR = " << deltaR_ <<"\n";
132        rdfStream << "#nAngleBins =" << nAngleBins_ << "deltaCosAngle = " << deltaCosAngle_ << "\n";
133        for (unsigned int i = 0; i < avgGofr_.size(); ++i) {
134 <        RealType r = deltaR_ * (i + 0.5);
134 >        // RealType r = deltaR_ * (i + 0.5);
135  
136          for(unsigned int j = 0; j < avgGofr_[i].size(); ++j) {
137 <          RealType cosAngle = -1.0 + (j + 0.5)*deltaCosAngle_;
137 >          // RealType cosAngle = -1.0 + (j + 0.5)*deltaCosAngle_;
138            rdfStream << avgGofr_[i][j]/nProcessed_ << "\t";
139          }
140  
# 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