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 $ |
46 |
> |
* @version $Id: BondOrderParameter.cpp,v 1.21 2006-11-21 20:44:54 gezelter Exp $ |
47 |
|
* |
48 |
|
*/ |
49 |
|
|
186 |
|
Q.resize(lMax_+1); |
187 |
|
W.resize(lMax_+1); |
188 |
|
W_hat.resize(lMax_+1); |
189 |
+ |
Nbonds = 0; |
190 |
|
|
191 |
|
for (int istep = 0; istep < nFrames; istep += step_) { |
192 |
|
reader.readFrame(istep); |
231 |
|
if (atom->getGlobalIndex() != myIndex) { |
232 |
|
|
233 |
|
vec = sd->getPos() - atom->getPos(); |
234 |
< |
currentSnapshot_->wrapVector(vec); |
234 |
> |
|
235 |
> |
if (usePeriodicBoundaryConditions_) |
236 |
> |
currentSnapshot_->wrapVector(vec); |
237 |
|
|
238 |
|
// Calculate "bonds" and build Q_lm(r) where |
239 |
|
// Q_lm = Y_lm(theta(r),phi(r)) |
261 |
|
} |
262 |
|
} |
263 |
|
|
261 |
– |
|
262 |
– |
for (int l = 0; l <= lMax_; l++) { |
263 |
– |
q_l[l] = 0.0; |
264 |
– |
for(int m = -l; m <= l; m++) { |
265 |
– |
q_l[l] += norm(q[std::make_pair(l,m)]); |
266 |
– |
} |
267 |
– |
q_l[l] *= 4.0*NumericConstant::PI/(RealType)(2*l + 1); |
268 |
– |
q_l[l] = sqrt(q_l[l])/(RealType)nBonds; |
269 |
– |
} |
270 |
– |
|
271 |
– |
// Find second order invariant Q_l |
264 |
|
|
265 |
|
for (int l = 0; l <= lMax_; l++) { |
266 |
|
q2[l] = 0.0; |
267 |
|
for (int m = -l; m <= l; m++){ |
268 |
+ |
q[std::make_pair(l,m)] /= (RealType)nBonds; |
269 |
|
q2[l] += norm(q[std::make_pair(l,m)]); |
270 |
|
} |
271 |
< |
q_l[l] = sqrt(q2[l] * 4.0 * NumericConstant::PI / |
279 |
< |
(RealType)(2*l + 1))/(RealType)nBonds; |
271 |
> |
q_l[l] = sqrt(q2[l] * 4.0 * NumericConstant::PI / (RealType)(2*l + 1)); |
272 |
|
} |
273 |
< |
|
273 |
> |
|
274 |
|
// Find Third Order Invariant W_l |
275 |
|
|
276 |
|
for (int l = 0; l <= lMax_; l++) { |
293 |
|
Nbonds += nBonds; |
294 |
|
for (int l = 0; l <= lMax_; l++) { |
295 |
|
for (int m = -l; m <= l; m++) { |
296 |
< |
QBar[std::make_pair(l,m)] += q[std::make_pair(l,m)]; |
296 |
> |
QBar[std::make_pair(l,m)] += (RealType)nBonds*q[std::make_pair(l,m)]; |
297 |
|
} |
298 |
|
} |
299 |
|
} |
360 |
|
Wcount_[l]++; |
361 |
|
} else { |
362 |
|
sprintf( painCave.errMsg, |
363 |
< |
"Re[w_hat] value outside reasonable range\n"); |
363 |
> |
"Re[w_hat] value (%lf) outside reasonable range\n", real(what[l])); |
364 |
|
painCave.severity = OOPSE_ERROR; |
365 |
|
painCave.isFatal = 1; |
366 |
|
simError(); |
388 |
|
RealType Qval = MinQ_ + (i + 0.5) * deltaQ_; |
389 |
|
osq << Qval; |
390 |
|
for (int l = 0; l <= lMax_; l++) { |
391 |
< |
osq << "\t" << (RealType)Q_histogram_[std::make_pair(i,l)] / |
392 |
< |
(RealType)Qcount_[l]; |
391 |
> |
|
392 |
> |
osq << "\t" << (RealType)Q_histogram_[std::make_pair(i,l)]/(RealType)Qcount_[l]/deltaQ_; |
393 |
|
} |
394 |
|
osq << "\n"; |
395 |
|
} |
410 |
|
osw << "# selection: (" << selectionScript_ << ")\n"; |
411 |
|
osw << "# \n"; |
412 |
|
for (int l = 0; l <= lMax_; l++) { |
413 |
< |
osw << "# <W_" << l << ">: " << real(What[l]) << "\n"; |
413 |
> |
osw << "# <W_" << l << ">: " << real(What[l]) << "\t" << imag(What[l]) << "\n"; |
414 |
|
} |
415 |
|
// Normalize by number of frames and write it out: |
416 |
|
for (int i = 0; i < nBins_; ++i) { |
417 |
|
RealType Wval = MinW_ + (i + 0.5) * deltaW_; |
418 |
|
osw << Wval; |
419 |
|
for (int l = 0; l <= lMax_; l++) { |
420 |
< |
osw << "\t" << (RealType)W_histogram_[std::make_pair(i,l)] / |
421 |
< |
(RealType)Wcount_[l]; |
420 |
> |
|
421 |
> |
osw << "\t" << (RealType)W_histogram_[std::make_pair(i,l)]/(RealType)Wcount_[l]/deltaW_; |
422 |
|
} |
423 |
|
osw << "\n"; |
424 |
|
} |