51 |
|
#include "io/DumpReader.hpp" |
52 |
|
#include "primitives/Molecule.hpp" |
53 |
|
#include "utils/NumericConstant.hpp" |
54 |
– |
#include "math/SphericalHarmonic.hpp" |
54 |
|
|
55 |
|
namespace oopse { |
56 |
|
|
57 |
|
BondOrderParameter::BondOrderParameter(SimInfo* info, |
58 |
|
const std::string& filename, |
59 |
|
const std::string& sele, |
60 |
< |
double rCut, int lNumber, int nbins) : StaticAnalyser(info, filename), selectionScript_(sele), evaluator_(info), seleMan_(info){ |
60 |
> |
double rCut, int nbins) : StaticAnalyser(info, filename), selectionScript_(sele), evaluator_(info), seleMan_(info){ |
61 |
|
|
62 |
|
setOutputName(getPrefix(filename) + ".bo"); |
63 |
|
|
68 |
|
|
69 |
|
// Set up cutoff radius and order of the Legendre Polynomial: |
70 |
|
|
72 |
– |
lNumber_ = lNumber; |
71 |
|
rCut_ = rCut; |
72 |
< |
mSize_ = 2*lNumber_+1; |
72 |
> |
nBins_ = nbins; |
73 |
> |
Qcount_.resize(lMax_+1); |
74 |
> |
Wcount_.resize(lMax_+1); |
75 |
|
|
76 |
|
// Q can take values from 0 to 1 |
77 |
|
|
78 |
|
MinQ_ = 0.0; |
79 |
< |
MaxQ_ = 1.0; |
79 |
> |
MaxQ_ = 1.1; |
80 |
|
deltaQ_ = (MaxQ_ - MinQ_) / nbins; |
81 |
– |
Q_histogram_.resize(nbins); |
81 |
|
|
82 |
|
// W_6 for icosahedral clusters is 11 / sqrt(4199) = 0.169754, so we'll |
83 |
|
// use values for MinW_ and MaxW_ that are slightly larger than this: |
84 |
|
|
85 |
< |
MinW_ = -0.18; |
86 |
< |
MaxW_ = 0.18; |
85 |
> |
MinW_ = -0.25; |
86 |
> |
MaxW_ = 0.25; |
87 |
|
deltaW_ = (MaxW_ - MinW_) / nbins; |
89 |
– |
W_histogram_.resize(nbins); |
90 |
– |
|
88 |
|
} |
89 |
|
|
90 |
|
BondOrderParameter::~BondOrderParameter() { |
93 |
|
} |
94 |
|
|
95 |
|
void BondOrderParameter::initalizeHistogram() { |
96 |
< |
std::fill(Q_histogram_.begin(), Q_histogram_.end(), 0); |
97 |
< |
std::fill(W_histogram_.begin(), W_histogram_.end(), 0); |
96 |
> |
for (int bin = 0; bin < nBins_; bin++) { |
97 |
> |
for (int l = 0; l <= lMax_; l++) { |
98 |
> |
Q_histogram_[std::make_pair(bin,l)] = 0; |
99 |
> |
W_histogram_[std::make_pair(bin,l)] = 0; |
100 |
> |
} |
101 |
> |
} |
102 |
|
} |
103 |
|
|
104 |
|
void BondOrderParameter::process() { |
105 |
|
Molecule* mol; |
106 |
|
Atom* atom; |
107 |
|
RigidBody* rb; |
108 |
+ |
int myIndex; |
109 |
|
SimInfo::MoleculeIterator mi; |
110 |
|
Molecule::RigidBodyIterator rbIter; |
111 |
|
Molecule::AtomIterator ai; |
112 |
|
StuntDouble* sd; |
113 |
+ |
Vector3d vec; |
114 |
|
RealType costheta; |
115 |
|
RealType phi; |
116 |
|
RealType r; |
117 |
|
RealType dist; |
118 |
< |
std::map<int, ComplexType> QBar_lm; |
119 |
< |
RealType QSq_l; |
120 |
< |
RealType Q_l; |
121 |
< |
int nBonds; |
118 |
> |
std::map<std::pair<int,int>,ComplexType> q; |
119 |
> |
std::vector<RealType> q_l; |
120 |
> |
std::vector<RealType> q2; |
121 |
> |
std::vector<ComplexType> w; |
122 |
> |
std::vector<ComplexType> w_hat; |
123 |
> |
std::map<std::pair<int,int>,ComplexType> QBar; |
124 |
> |
std::vector<RealType> Q2; |
125 |
> |
std::vector<RealType> Q; |
126 |
> |
std::vector<ComplexType> W; |
127 |
> |
std::vector<ComplexType> W_hat; |
128 |
> |
int nBonds, Nbonds; |
129 |
|
SphericalHarmonic sphericalHarmonic; |
130 |
|
int i, j; |
131 |
< |
|
132 |
< |
// Set the l for the spherical harmonic, it doesn't change |
133 |
< |
sphericalHarmonic.setL(lNumber_); |
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; |
137 |
|
|
125 |
– |
|
138 |
|
DumpReader reader(info_, dumpFilename_); |
139 |
|
int nFrames = reader.getNFrames(); |
140 |
|
frameCounter_ = 0; |
141 |
|
|
142 |
+ |
q_l.resize(lMax_+1); |
143 |
+ |
q2.resize(lMax_+1); |
144 |
+ |
w.resize(lMax_+1); |
145 |
+ |
w_hat.resize(lMax_+1); |
146 |
+ |
|
147 |
+ |
Q2.resize(lMax_+1); |
148 |
+ |
Q.resize(lMax_+1); |
149 |
+ |
W.resize(lMax_+1); |
150 |
+ |
W_hat.resize(lMax_+1); |
151 |
+ |
|
152 |
|
for (int istep = 0; istep < nFrames; istep += step_) { |
153 |
|
reader.readFrame(istep); |
154 |
|
frameCounter_++; |
166 |
|
rb = mol->nextRigidBody(rbIter)) { |
167 |
|
rb->updateAtoms(); |
168 |
|
} |
169 |
< |
} |
170 |
< |
|
169 |
> |
} |
170 |
> |
|
171 |
|
// outer loop is over the selected StuntDoubles: |
172 |
|
|
173 |
|
for (sd = seleMan_.beginSelected(i); sd != NULL; |
174 |
|
sd = seleMan_.nextSelected(i)) { |
175 |
|
|
176 |
< |
// For this central atom, zero out nBonds and QBar_lm |
155 |
< |
|
176 |
> |
myIndex = sd->getGlobalIndex(); |
177 |
|
nBonds = 0; |
178 |
< |
|
179 |
< |
for (int m = -lNumber_; m <= lNumber_; m++) { |
180 |
< |
QBar_lm[m] = 0.0; |
178 |
> |
|
179 |
> |
for (int l = 0; l <= lMax_; l++) { |
180 |
> |
for (int m = -l; m <= l; m++) { |
181 |
> |
q[std::make_pair(l,m)] = 0.0; |
182 |
> |
} |
183 |
|
} |
184 |
|
|
185 |
|
// inner loop is over all other atoms in the system: |
189 |
|
for (atom = mol->beginAtom(ai); atom != NULL; |
190 |
|
atom = mol->nextAtom(ai)) { |
191 |
|
|
192 |
+ |
if (atom->getGlobalIndex() != myIndex) { |
193 |
|
|
194 |
< |
Vector3d vec = sd->getPos() - atom->getPos(); |
195 |
< |
currentSnapshot_->wrapVector(vec); |
172 |
< |
|
173 |
< |
// Calculate "bonds" and build Q_lm(r) where |
174 |
< |
// Q_lm = Y_lm(theta(r),phi(r)) |
175 |
< |
// The spherical harmonics are wrt any arbitrary coordinate |
176 |
< |
// system, we choose standard spherical coordinates |
177 |
< |
|
178 |
< |
r = sqrt(pow(vec.x(),2)+pow(vec.y(),2)+pow(vec.z(),2)); |
179 |
< |
|
180 |
< |
// Check to see if neighbor is in bond cutoff |
181 |
< |
|
182 |
< |
if (r < rCut_) { |
183 |
< |
costheta = vec.z() / r; |
184 |
< |
phi = atan2(vec.y(), vec.x()); |
194 |
> |
vec = sd->getPos() - atom->getPos(); |
195 |
> |
currentSnapshot_->wrapVector(vec); |
196 |
|
|
197 |
< |
for(int m = -lNumber_; m <= lNumber_; m++){ |
198 |
< |
sphericalHarmonic.setM(m); |
199 |
< |
QBar_lm[m] += sphericalHarmonic.getValueAt(costheta,phi); |
200 |
< |
} |
201 |
< |
nBonds++; |
202 |
< |
} |
197 |
> |
// Calculate "bonds" and build Q_lm(r) where |
198 |
> |
// Q_lm = Y_lm(theta(r),phi(r)) |
199 |
> |
// The spherical harmonics are wrt any arbitrary coordinate |
200 |
> |
// system, we choose standard spherical coordinates |
201 |
> |
|
202 |
> |
r = vec.length(); |
203 |
> |
|
204 |
> |
// Check to see if neighbor is in bond cutoff |
205 |
> |
|
206 |
> |
if (r < rCut_) { |
207 |
> |
costheta = vec.z() / r; |
208 |
> |
phi = atan2(vec.y(), vec.x()); |
209 |
> |
|
210 |
> |
for (int l = 0; l <= lMax_; l++) { |
211 |
> |
sphericalHarmonic.setL(l); |
212 |
> |
for(int m = -l; m <= l; m++){ |
213 |
> |
sphericalHarmonic.setM(m); |
214 |
> |
q[std::make_pair(l,m)] += sphericalHarmonic.getValueAt(costheta, phi); |
215 |
> |
} |
216 |
> |
} |
217 |
> |
nBonds++; |
218 |
> |
} |
219 |
> |
} |
220 |
|
} |
221 |
|
} |
222 |
|
|
223 |
< |
// Normalize Qbar2 |
224 |
< |
for (int m = -lNumber_;m <= lNumber_; m++){ |
225 |
< |
QBar_lm[m] /= nBonds; |
223 |
> |
|
224 |
> |
for (int l = 0; l <= lMax_; l++) { |
225 |
> |
q_l[l] = 0.0; |
226 |
> |
for(int m = -l; m <= l; m++) { |
227 |
> |
q_l[l] += norm(q[std::make_pair(l,m)]); |
228 |
> |
} |
229 |
> |
q_l[l] *= 4.0*NumericConstant::PI/(RealType)(2*l + 1); |
230 |
> |
q_l[l] = sqrt(q_l[l])/(RealType)nBonds; |
231 |
|
} |
232 |
|
|
233 |
|
// Find second order invariant Q_l |
234 |
< |
|
235 |
< |
QSq_l = 0.0; |
236 |
< |
for (int m = -lNumber_; m <= lNumber_; m++){ |
237 |
< |
QSq_l += norm(QBar_lm[m]); |
234 |
> |
|
235 |
> |
for (int l = 0; l <= lMax_; l++) { |
236 |
> |
q2[l] = 0.0; |
237 |
> |
for (int m = -l; m <= l; m++){ |
238 |
> |
q2[l] += norm(q[std::make_pair(l,m)]); |
239 |
> |
} |
240 |
> |
q_l[l] = sqrt(q2[l] * 4.0 * NumericConstant::PI / |
241 |
> |
(RealType)(2*l + 1))/(RealType)nBonds; |
242 |
|
} |
206 |
– |
Q_l = sqrt(QSq_l*(4.0 * NumericConstant::PI / (2.0*(RealType)lNumber_ + 1))); |
207 |
– |
|
208 |
– |
// Find Third Order Invariant W_l |
243 |
|
|
244 |
< |
// Make arrays for Wigner3jm |
245 |
< |
double* THRCOF = new double[mSize_]; |
246 |
< |
// Variables for Wigner routine |
247 |
< |
double l_ = (double)lNumber_; |
248 |
< |
double m1Pass, m2Min, m2Max; |
249 |
< |
int error, m1, m2, m3; |
250 |
< |
|
251 |
< |
ComplexType W_l; |
252 |
< |
ComplexType W_l_hat; |
253 |
< |
W_l = 0.0; |
254 |
< |
for (int m1 = -lNumber_; m1 <= lNumber_; m1++) { |
255 |
< |
// Zero work array |
256 |
< |
for (int ii = 0; ii < mSize_; ii++){ |
257 |
< |
THRCOF[i] = 0.0; |
258 |
< |
} |
259 |
< |
// Get Wigner coefficients |
260 |
< |
m1Pass = (double)m1; |
261 |
< |
Wigner3jm(&l_, &l_, &l_, &m1Pass, &m2Min, &m2Max, THRCOF, &mSize_, &error); |
262 |
< |
for (int m_index = 1; i < (int)(m2Max - m2Min-1.0); m_index++) { |
263 |
< |
m2 = floor(m2Min) + m_index - 1; |
264 |
< |
m3 = -m1-m2; |
265 |
< |
W_l += THRCOF[m_index]*QBar_lm[m1+lNumber_]*QBar_lm[m2+lNumber_]*QBar_lm[m3+lNumber_]; |
244 |
> |
// Find Third Order Invariant W_l |
245 |
> |
|
246 |
> |
for (int l = 0; l <= lMax_; l++) { |
247 |
> |
w[l] = 0.0; |
248 |
> |
lPass = (double)l; |
249 |
> |
for (int m1 = -l; m1 <= l; m1++) { |
250 |
> |
// Zero work array |
251 |
> |
for (int ii = 0; ii < 2*l + 1; ii++){ |
252 |
> |
THRCOF[ii] = 0.0; |
253 |
> |
} |
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 |
> |
} |
269 |
|
} |
270 |
+ |
|
271 |
+ |
w_hat[l] = w[l] / pow(q2[l], 1.5); |
272 |
|
} |
273 |
|
|
274 |
< |
W_l_hat = W_l / pow(QSq_l, 1.5); |
275 |
< |
|
276 |
< |
// accumulate histogram data for Q_l and W_l_hat: |
277 |
< |
|
278 |
< |
collectHistogram(Q_l, real(W_l_hat)); |
279 |
< |
|
274 |
> |
collectHistogram(q_l, w_hat); |
275 |
> |
|
276 |
> |
Nbonds += nBonds; |
277 |
> |
for (int l = 0; l <= lMax_; l++) { |
278 |
> |
for (int m = -l; m <= l; m++) { |
279 |
> |
QBar[std::make_pair(l,m)] += q[std::make_pair(l,m)]; |
280 |
> |
} |
281 |
> |
} |
282 |
|
} |
283 |
|
} |
284 |
+ |
|
285 |
+ |
// Normalize Qbar2 |
286 |
+ |
for (int l = 0; l <= lMax_; l++) { |
287 |
+ |
for (int m = -l; m <= l; m++){ |
288 |
+ |
QBar[std::make_pair(l,m)] /= Nbonds; |
289 |
+ |
} |
290 |
+ |
} |
291 |
|
|
292 |
< |
writeOrderParameter(); |
292 |
> |
// Find second order invariant Q_l |
293 |
|
|
294 |
+ |
for (int l = 0; l <= lMax_; l++) { |
295 |
+ |
Q2[l] = 0.0; |
296 |
+ |
for (int m = -l; m <= l; m++){ |
297 |
+ |
Q2[l] += norm(QBar[std::make_pair(l,m)]); |
298 |
+ |
} |
299 |
+ |
Q[l] = sqrt(Q2[l] * 4.0 * NumericConstant::PI / (RealType)(2*l + 1)); |
300 |
+ |
} |
301 |
+ |
|
302 |
+ |
// Find Third Order Invariant W_l |
303 |
+ |
|
304 |
+ |
for (int l = 0; l <= lMax_; l++) { |
305 |
+ |
W[l] = 0.0; |
306 |
+ |
lPass = (double)l; |
307 |
+ |
for (int m1 = -l; m1 <= l; m1++) { |
308 |
+ |
// Zero work array |
309 |
+ |
for (int ii = 0; ii < 2*l + 1; ii++){ |
310 |
+ |
THRCOF[ii] = 0.0; |
311 |
+ |
} |
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 |
+ |
} |
327 |
+ |
} |
328 |
+ |
|
329 |
+ |
W_hat[l] = W[l] / pow(Q2[l], 1.5); |
330 |
+ |
} |
331 |
+ |
|
332 |
+ |
writeOrderParameter(Q, W_hat); |
333 |
|
} |
334 |
|
|
335 |
+ |
void BondOrderParameter::collectHistogram(std::vector<RealType> q, |
336 |
+ |
std::vector<ComplexType> what) { |
337 |
|
|
338 |
< |
void BondOrderParameter::collectHistogram(RealType Q_l, RealType W_l_hat) { |
339 |
< |
|
340 |
< |
if (Q_l >= MinQ_ && Q_l < MaxQ_) { |
341 |
< |
int qbin = (Q_l - MinQ_) / deltaQ_; |
342 |
< |
Q_histogram_[qbin] += 1; |
343 |
< |
Qcount_++; |
344 |
< |
sumQ_ += Q_l; |
345 |
< |
sumQ2_ += Q_l * Q_l; |
346 |
< |
} else { |
347 |
< |
sprintf( painCave.errMsg, |
348 |
< |
"Q_l value outside reasonable range\n"); |
349 |
< |
painCave.severity = OOPSE_ERROR; |
261 |
< |
painCave.isFatal = 1; |
262 |
< |
simError(); |
338 |
> |
for (int l = 0; l <= lMax_; l++) { |
339 |
> |
if (q[l] >= MinQ_ && q[l] < MaxQ_) { |
340 |
> |
int qbin = (q[l] - MinQ_) / deltaQ_; |
341 |
> |
Q_histogram_[std::make_pair(qbin,l)] += 1; |
342 |
> |
Qcount_[l]++; |
343 |
> |
} else { |
344 |
> |
sprintf( painCave.errMsg, |
345 |
> |
"q_l value outside reasonable range\n"); |
346 |
> |
painCave.severity = OOPSE_ERROR; |
347 |
> |
painCave.isFatal = 1; |
348 |
> |
simError(); |
349 |
> |
} |
350 |
|
} |
351 |
|
|
352 |
< |
if (W_l_hat >= MinW_ && W_l_hat < MaxW_) { |
353 |
< |
int wbin = (W_l_hat - MinW_) / deltaW_; |
354 |
< |
W_histogram_[wbin] += 1; |
355 |
< |
Wcount_++; |
356 |
< |
sumW_ += W_l_hat; |
357 |
< |
sumW2_ += W_l_hat*W_l_hat; |
358 |
< |
} else { |
359 |
< |
sprintf( painCave.errMsg, |
360 |
< |
"W_l_hat value outside reasonable range\n"); |
361 |
< |
painCave.severity = OOPSE_ERROR; |
362 |
< |
painCave.isFatal = 1; |
363 |
< |
simError(); |
352 |
> |
for (int l = 0; l <= lMax_; l++) { |
353 |
> |
if (real(what[l]) >= MinW_ && real(what[l]) < MaxW_) { |
354 |
> |
int wbin = (real(what[l]) - MinW_) / deltaW_; |
355 |
> |
W_histogram_[std::make_pair(wbin,l)] += 1; |
356 |
> |
Wcount_[l]++; |
357 |
> |
} else { |
358 |
> |
sprintf( painCave.errMsg, |
359 |
> |
"Re[w_hat] value outside reasonable range\n"); |
360 |
> |
painCave.severity = OOPSE_ERROR; |
361 |
> |
painCave.isFatal = 1; |
362 |
> |
simError(); |
363 |
> |
} |
364 |
|
} |
365 |
+ |
|
366 |
|
} |
367 |
|
|
280 |
– |
void BondOrderParameter::writeOrderParameter() { |
368 |
|
|
369 |
+ |
void BondOrderParameter::writeOrderParameter(std::vector<RealType> Q, |
370 |
+ |
std::vector<ComplexType> What) { |
371 |
+ |
|
372 |
|
std::ofstream osq((getOutputFileName() + "q").c_str()); |
373 |
|
|
374 |
|
if (osq.is_open()) { |
285 |
– |
|
286 |
– |
RealType qAvg = sumQ_ / (RealType) Qcount_; |
287 |
– |
RealType qStdDev = sumQ2_ / (RealType) Qcount_ - qAvg*qAvg; |
375 |
|
|
376 |
< |
osq << "# Bond Order Parameter Q_" << lNumber_ << "\n"; |
376 |
> |
osq << "# Bond Order Parameters\n"; |
377 |
|
osq << "# selection: (" << selectionScript_ << ")\n"; |
378 |
< |
osq << "# <Q_" << lNumber_ << ">: " << qAvg << "\n"; |
379 |
< |
osq << "# std. dev.: " << qStdDev << "\n"; |
380 |
< |
|
378 |
> |
osq << "# \n"; |
379 |
> |
for (int l = 0; l <= lMax_; l++) { |
380 |
> |
osq << "# <Q_" << l << ">: " << Q[l] << "\n"; |
381 |
> |
} |
382 |
|
// Normalize by number of frames and write it out: |
383 |
< |
for (int i = 0; i < Q_histogram_.size(); ++i) { |
384 |
< |
RealType Qval = MinQ_ + (i + 0.5) * deltaQ_; |
385 |
< |
osq << Qval << "\t" << Q_histogram_[i] / frameCounter_ << "\n"; |
383 |
> |
for (int i = 0; i < nBins_; ++i) { |
384 |
> |
RealType Qval = MinQ_ + (i + 0.5) * deltaQ_; |
385 |
> |
osq << Qval; |
386 |
> |
for (int l = 0; l <= lMax_; l++) { |
387 |
> |
osq << "\t" << (RealType)Q_histogram_[std::make_pair(i,l)] / (RealType)Qcount_[l]; |
388 |
> |
} |
389 |
> |
osq << "\n"; |
390 |
|
} |
391 |
< |
|
391 |
> |
|
392 |
|
osq.close(); |
393 |
+ |
|
394 |
|
} else { |
395 |
|
sprintf(painCave.errMsg, "BondOrderParameter: unable to open %s\n", |
396 |
|
(getOutputFileName() + "q").c_str()); |
401 |
|
std::ofstream osw((getOutputFileName() + "w").c_str()); |
402 |
|
|
403 |
|
if (osw.is_open()) { |
404 |
< |
|
312 |
< |
RealType wAvg = sumW_ / (RealType) Wcount_; |
313 |
< |
RealType wStdDev = sumW2_ / (RealType) Wcount_ - wAvg*wAvg; |
314 |
< |
|
315 |
< |
osw << "# Bond Order Parameter W_" << lNumber_ << "\n"; |
404 |
> |
osw << "# Bond Order Parameters\n"; |
405 |
|
osw << "# selection: (" << selectionScript_ << ")\n"; |
406 |
< |
osw << "# <W_" << lNumber_ << ">: " << wAvg << "\n"; |
407 |
< |
osw << "# std. dev.: " << wStdDev << "\n"; |
408 |
< |
|
406 |
> |
osw << "# \n"; |
407 |
> |
for (int l = 0; l <= lMax_; l++) { |
408 |
> |
osw << "# <W_" << l << ">: " << real(What[l]) << "\n"; |
409 |
> |
} |
410 |
|
// Normalize by number of frames and write it out: |
411 |
< |
for (int i = 0; i < W_histogram_.size(); ++i) { |
412 |
< |
RealType Wval = MinW_ + (i + 0.5) * deltaW_; |
413 |
< |
osw << Wval << "\t" << W_histogram_[i] / frameCounter_ << "\n"; |
411 |
> |
for (int i = 0; i < nBins_; ++i) { |
412 |
> |
RealType Wval = MinW_ + (i + 0.5) * deltaW_; |
413 |
> |
osw << Wval; |
414 |
> |
for (int l = 0; l <= lMax_; l++) { |
415 |
> |
osw << "\t" << (RealType)W_histogram_[std::make_pair(i,l)] / (RealType)Wcount_[l]; |
416 |
> |
} |
417 |
> |
osw << "\n"; |
418 |
|
} |
419 |
< |
|
419 |
> |
|
420 |
|
osw.close(); |
421 |
|
} else { |
422 |
|
sprintf(painCave.errMsg, "BondOrderParameter: unable to open %s\n", |
424 |
|
painCave.isFatal = 1; |
425 |
|
simError(); |
426 |
|
} |
427 |
+ |
|
428 |
|
} |
429 |
|
} |