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

Comparing trunk/OOPSE-4/src/applications/staticProps/BondOrderParameter.cpp (file contents):
Revision 3022 by gezelter, Tue Sep 26 01:30:32 2006 UTC vs.
Revision 3026 by gezelter, Tue Sep 26 16:08:44 2006 UTC

# Line 37 | Line 37
37   * arising out of the use of or inability to use software, even if the
38   * University of Notre Dame has been advised of the possibility of
39   * such damages.
40 + *
41 + *  BondOrderParameter.cpp
42 + *  OOPSE-4
43 + *
44 + *  Created by J. Daniel Gezelter on 09/26/06.
45 + *  @author  J. Daniel Gezelter
46 + *  @version $Id: BondOrderParameter.cpp,v 1.18 2006-09-26 16:08:44 gezelter Exp $
47 + *
48   */
41
42
43 /* Creates orientational bond order parameters as outlined by
44 *     Bond-orientaional order in liquids and glasses, Steinhart,Nelson,Ronchetti
45 *     Phys Rev B, 28,784,1983
46 *
47 */
49  
50   #include "applications/staticProps/BondOrderParameter.hpp"
51   #include "utils/simError.h"
# Line 85 | Line 86 | namespace oopse {
86      MinW_ = -0.25;
87      MaxW_ = 0.25;
88      deltaW_ = (MaxW_ - MinW_) / nbins;
88  }
89  
90 +    // Make arrays for Wigner3jm
91 +    double* THRCOF = new double[2*lMax_+1];
92 +    // Variables for Wigner routine
93 +    double lPass, m1Pass, m2m, m2M;
94 +    int error, mSize;
95 +    mSize = 2*lMax_+1;
96 +
97 +    for (int l = 0; l <= lMax_; l++) {
98 +      lPass = (double)l;
99 +      for (int m1 = -l; m1 <= l; m1++) {
100 +        m1Pass = (double)m1;
101 +
102 +        std::pair<int,int> lm = std::make_pair(l, m1);
103 +        
104 +        // Zero work array
105 +        for (int ii = 0; ii < 2*l + 1; ii++){
106 +          THRCOF[ii] = 0.0;
107 +        }
108 +            
109 +        // Get Wigner coefficients
110 +        Wigner3jm(&lPass, &lPass, &lPass,
111 +                  &m1Pass, &m2m, &m2M,
112 +                  THRCOF, &mSize, &error);
113 +        
114 +        m2Min[lm] = (int)floor(m2m);
115 +        m2Max[lm] = (int)floor(m2M);
116 +        
117 +        for (int mmm = 0; mmm < (int)(m2M - m2m); mmm++) {
118 +          w3j[lm].push_back(THRCOF[mmm]);
119 +        }
120 +      }
121 +    }
122 +    delete [] THRCOF;
123 +    THRCOF = NULL;
124 +  }
125 +  
126    BondOrderParameter::~BondOrderParameter() {
127      Q_histogram_.clear();
128      W_histogram_.clear();
129 +    for (int l = 0; l <= lMax_; l++) {
130 +      for (int m = -l; m <= l; m++) {
131 +        w3j[std::make_pair(l,m)].clear();
132 +      }
133 +    }
134 +    w3j.clear();
135 +    m2Min.clear();
136 +    m2Max.clear();
137    }
138 <
138 >  
139    void BondOrderParameter::initalizeHistogram() {
140      for (int bin = 0; bin < nBins_; bin++) {
141        for (int l = 0; l <= lMax_; l++) {
# Line 128 | Line 172 | namespace oopse {
172      int nBonds, Nbonds;
173      SphericalHarmonic sphericalHarmonic;
174      int i, j;
131    // Make arrays for Wigner3jm
132    double* THRCOF = new double[2*lMax_+1];
133    // Variables for Wigner routine
134    double lPass, m1Pass, m2Min, m2Max;
135    int error, m1, m2, m3, mSize;
136    mSize = 2*lMax_+1;
175  
176      DumpReader reader(info_, dumpFilename_);    
177      int nFrames = reader.getNFrames();
# Line 245 | Line 283 | namespace oopse {
283      
284          for (int l = 0; l <= lMax_; l++) {
285            w[l] = 0.0;
248          lPass = (double)l;
286            for (int m1 = -l; m1 <= l; m1++) {
287 <            // Zero work array
288 <            for (int ii = 0; ii < 2*l + 1; ii++){
289 <              THRCOF[ii] = 0.0;
287 >            std::pair<int,int> lm = std::make_pair(l, m1);
288 >            for (int mmm = 0; mmm < (m2Max[lm] - m2Min[lm]); mmm++) {
289 >              int m2 = m2Min[lm] + mmm;
290 >              int m3 = -m1-m2;
291 >              w[l] += w3j[lm][mmm] * q[lm] *
292 >                q[std::make_pair(l,m2)] *  q[std::make_pair(l,m3)];
293              }
254            // Get Wigner coefficients
255            m1Pass = (double)m1;
256            
257            Wigner3jm(&lPass, &lPass, &lPass,
258                      &m1Pass, &m2Min, &m2Max,
259                      THRCOF, &mSize, &error);
260            
261            for (int mmm = 0; mmm < (int)(m2Max - m2Min); mmm++) {
262              m2 = (int)floor(m2Min) + mmm;
263              m3 = -m1-m2;
264              w[l] += THRCOF[mmm] *
265                q[std::make_pair(l,m1)] *
266                q[std::make_pair(l,m2)] *
267                q[std::make_pair(l,m3)];
268            }
294            }
295            
296            w_hat[l] = w[l] / pow(q2[l], 1.5);
# Line 303 | Line 328 | namespace oopse {
328      
329      for (int l = 0; l <= lMax_; l++) {
330        W[l] = 0.0;
306      lPass = (double)l;
331        for (int m1 = -l; m1 <= l; m1++) {
332 <        // Zero work array
333 <        for (int ii = 0; ii < 2*l + 1; ii++){
334 <          THRCOF[ii] = 0.0;
332 >        std::pair<int,int> lm = std::make_pair(l, m1);
333 >        for (int mmm = 0; mmm < (m2Max[lm] - m2Min[lm]); mmm++) {
334 >          int m2 = m2Min[lm] + mmm;
335 >          int m3 = -m1-m2;
336 >          W[l] += w3j[lm][mmm] * QBar[lm] *
337 >            QBar[std::make_pair(l,m2)] * QBar[std::make_pair(l,m3)];
338          }
312        // Get Wigner coefficients
313        m1Pass = (double)m1;
314        
315        Wigner3jm(&lPass, &lPass, &lPass,
316                  &m1Pass, &m2Min, &m2Max,
317                  THRCOF, &mSize, &error);
318        
319        for (int mmm = 0; mmm < (int)(m2Max - m2Min); mmm++) {
320          m2 = (int)floor(m2Min) + mmm;
321          m3 = -m1-m2;
322          W[l] += THRCOF[mmm] *
323            QBar[std::make_pair(l,m1)] *
324            QBar[std::make_pair(l,m2)] *
325            QBar[std::make_pair(l,m3)];
326        }
339        }
340        
341        W_hat[l] = W[l] / pow(Q2[l], 1.5);
# Line 384 | Line 396 | namespace oopse {
396          RealType Qval = MinQ_ + (i + 0.5) * deltaQ_;              
397          osq << Qval;
398          for (int l = 0; l <= lMax_; l++) {
399 <          osq << "\t" << (RealType)Q_histogram_[std::make_pair(i,l)] / (RealType)Qcount_[l];
399 >          osq << "\t" << (RealType)Q_histogram_[std::make_pair(i,l)] /
400 >            (RealType)Qcount_[l];
401          }
402          osq << "\n";
403        }
# Line 412 | Line 425 | namespace oopse {
425          RealType Wval = MinW_ + (i + 0.5) * deltaW_;              
426          osw << Wval;
427          for (int l = 0; l <= lMax_; l++) {
428 <          osw << "\t" << (RealType)W_histogram_[std::make_pair(i,l)] / (RealType)Wcount_[l];
428 >          osw << "\t" << (RealType)W_histogram_[std::make_pair(i,l)] /
429 >            (RealType)Wcount_[l];
430          }
431          osw << "\n";
432        }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines