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.19 2006-10-18 21:58:47 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" |
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++) { |
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(); |
230 |
|
if (atom->getGlobalIndex() != myIndex) { |
231 |
|
|
232 |
|
vec = sd->getPos() - atom->getPos(); |
233 |
< |
currentSnapshot_->wrapVector(vec); |
233 |
> |
|
234 |
> |
if (usePeriodicBoundaryConditions_) |
235 |
> |
currentSnapshot_->wrapVector(vec); |
236 |
|
|
237 |
|
// Calculate "bonds" and build Q_lm(r) where |
238 |
|
// Q_lm = Y_lm(theta(r),phi(r)) |
285 |
|
|
286 |
|
for (int l = 0; l <= lMax_; l++) { |
287 |
|
w[l] = 0.0; |
248 |
– |
lPass = (double)l; |
288 |
|
for (int m1 = -l; m1 <= l; m1++) { |
289 |
< |
// Zero work array |
290 |
< |
for (int ii = 0; ii < 2*l + 1; ii++){ |
291 |
< |
THRCOF[ii] = 0.0; |
289 |
> |
std::pair<int,int> lm = std::make_pair(l, m1); |
290 |
> |
for (int mmm = 0; mmm < (m2Max[lm] - m2Min[lm]); mmm++) { |
291 |
> |
int m2 = m2Min[lm] + mmm; |
292 |
> |
int m3 = -m1-m2; |
293 |
> |
w[l] += w3j[lm][mmm] * q[lm] * |
294 |
> |
q[std::make_pair(l,m2)] * q[std::make_pair(l,m3)]; |
295 |
|
} |
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 |
– |
} |
296 |
|
} |
297 |
|
|
298 |
|
w_hat[l] = w[l] / pow(q2[l], 1.5); |
330 |
|
|
331 |
|
for (int l = 0; l <= lMax_; l++) { |
332 |
|
W[l] = 0.0; |
306 |
– |
lPass = (double)l; |
333 |
|
for (int m1 = -l; m1 <= l; m1++) { |
334 |
< |
// Zero work array |
335 |
< |
for (int ii = 0; ii < 2*l + 1; ii++){ |
336 |
< |
THRCOF[ii] = 0.0; |
334 |
> |
std::pair<int,int> lm = std::make_pair(l, m1); |
335 |
> |
for (int mmm = 0; mmm < (m2Max[lm] - m2Min[lm]); mmm++) { |
336 |
> |
int m2 = m2Min[lm] + mmm; |
337 |
> |
int m3 = -m1-m2; |
338 |
> |
W[l] += w3j[lm][mmm] * QBar[lm] * |
339 |
> |
QBar[std::make_pair(l,m2)] * QBar[std::make_pair(l,m3)]; |
340 |
|
} |
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 |
– |
} |
341 |
|
} |
342 |
|
|
343 |
|
W_hat[l] = W[l] / pow(Q2[l], 1.5); |
398 |
|
RealType Qval = MinQ_ + (i + 0.5) * deltaQ_; |
399 |
|
osq << Qval; |
400 |
|
for (int l = 0; l <= lMax_; l++) { |
401 |
< |
osq << "\t" << (RealType)Q_histogram_[std::make_pair(i,l)] / (RealType)Qcount_[l]; |
401 |
> |
osq << "\t" << (RealType)Q_histogram_[std::make_pair(i,l)] / |
402 |
> |
(RealType)Qcount_[l]; |
403 |
|
} |
404 |
|
osq << "\n"; |
405 |
|
} |
427 |
|
RealType Wval = MinW_ + (i + 0.5) * deltaW_; |
428 |
|
osw << Wval; |
429 |
|
for (int l = 0; l <= lMax_; l++) { |
430 |
< |
osw << "\t" << (RealType)W_histogram_[std::make_pair(i,l)] / (RealType)Wcount_[l]; |
430 |
> |
osw << "\t" << (RealType)W_histogram_[std::make_pair(i,l)] / |
431 |
> |
(RealType)Wcount_[l]; |
432 |
|
} |
433 |
|
osw << "\n"; |
434 |
|
} |