53 |
|
#include <mpi.h> |
54 |
|
#endif |
55 |
|
|
56 |
+ |
#ifdef _MSC_VER |
57 |
+ |
#define isnan(x) _isnan((x)) |
58 |
+ |
#define isinf(x) (!_finite(x) && !_isnan(x)) |
59 |
+ |
#endif |
60 |
+ |
|
61 |
|
#define HONKING_LARGE_VALUE 1.0e10 |
62 |
|
|
63 |
|
using namespace std; |
70 |
|
failTrialCount_ = 0; |
71 |
|
failRootCount_ = 0; |
72 |
|
|
68 |
– |
int seedValue; |
73 |
|
Globals * simParams = info->getSimParams(); |
74 |
|
RNEMDParameters* rnemdParams = simParams->getRNEMDParameters(); |
75 |
|
|
84 |
|
stringToFluxType_["Px"] = rnemdPx; |
85 |
|
stringToFluxType_["Py"] = rnemdPy; |
86 |
|
stringToFluxType_["Pz"] = rnemdPz; |
87 |
+ |
stringToFluxType_["Pvector"] = rnemdPvector; |
88 |
|
stringToFluxType_["KE+Px"] = rnemdKePx; |
89 |
|
stringToFluxType_["KE+Py"] = rnemdKePy; |
90 |
|
stringToFluxType_["KE+Pvector"] = rnemdKePvector; |
106 |
|
sprintf(painCave.errMsg, |
107 |
|
"RNEMD: No fluxType was set in the md file. This parameter,\n" |
108 |
|
"\twhich must be one of the following values:\n" |
109 |
< |
"\tKE, Px, Py, Pz, KE+Px, KE+Py, KE+Pvector, must be set to\n" |
110 |
< |
"\tuse RNEMD\n"); |
109 |
> |
"\tKE, Px, Py, Pz, Pvector, KE+Px, KE+Py, KE+Pvector\n" |
110 |
> |
"\tmust be set to use RNEMD\n"); |
111 |
|
painCave.isFatal = 1; |
112 |
|
painCave.severity = OPENMD_ERROR; |
113 |
|
simError(); |
205 |
|
break; |
206 |
|
case rnemdPvector: |
207 |
|
hasCorrectFlux = hasMomentumFluxVector; |
208 |
+ |
break; |
209 |
|
case rnemdKePx: |
210 |
|
case rnemdKePy: |
211 |
|
hasCorrectFlux = hasMomentumFlux && hasKineticFlux; |
233 |
|
} |
234 |
|
if (!hasCorrectFlux) { |
235 |
|
sprintf(painCave.errMsg, |
236 |
< |
"RNEMD: The current method,\n" |
231 |
< |
"\t%s, and flux type %s\n" |
236 |
> |
"RNEMD: The current method, %s, and flux type, %s,\n" |
237 |
|
"\tdid not have the correct flux value specified. Options\n" |
238 |
|
"\tinclude: kineticFlux, momentumFlux, and momentumFluxVector\n", |
239 |
|
methStr.c_str(), fluxStr.c_str()); |
243 |
|
} |
244 |
|
|
245 |
|
if (hasKineticFlux) { |
246 |
< |
kineticFlux_ = rnemdParams->getKineticFlux(); |
246 |
> |
// convert the kcal / mol / Angstroms^2 / fs values in the md file |
247 |
> |
// into amu / fs^3: |
248 |
> |
kineticFlux_ = rnemdParams->getKineticFlux() |
249 |
> |
* PhysicalConstants::energyConvert; |
250 |
|
} else { |
251 |
|
kineticFlux_ = 0.0; |
252 |
|
} |
309 |
|
z.title = "Z"; |
310 |
|
z.dataType = "RealType"; |
311 |
|
z.accumulator.reserve(nBins_); |
312 |
< |
for (unsigned int i = 0; i < nBins_; i++) |
312 |
> |
for (int i = 0; i < nBins_; i++) |
313 |
|
z.accumulator.push_back( new Accumulator() ); |
314 |
|
data_[Z] = z; |
315 |
|
outputMap_["Z"] = Z; |
319 |
|
temperature.title = "Temperature"; |
320 |
|
temperature.dataType = "RealType"; |
321 |
|
temperature.accumulator.reserve(nBins_); |
322 |
< |
for (unsigned int i = 0; i < nBins_; i++) |
322 |
> |
for (int i = 0; i < nBins_; i++) |
323 |
|
temperature.accumulator.push_back( new Accumulator() ); |
324 |
|
data_[TEMPERATURE] = temperature; |
325 |
|
outputMap_["TEMPERATURE"] = TEMPERATURE; |
326 |
|
|
327 |
|
OutputData velocity; |
328 |
< |
velocity.units = "amu/fs"; |
328 |
> |
velocity.units = "angstroms/fs"; |
329 |
|
velocity.title = "Velocity"; |
330 |
|
velocity.dataType = "Vector3d"; |
331 |
|
velocity.accumulator.reserve(nBins_); |
332 |
< |
for (unsigned int i = 0; i < nBins_; i++) |
332 |
> |
for (int i = 0; i < nBins_; i++) |
333 |
|
velocity.accumulator.push_back( new VectorAccumulator() ); |
334 |
|
data_[VELOCITY] = velocity; |
335 |
|
outputMap_["VELOCITY"] = VELOCITY; |
339 |
|
density.title = "Density"; |
340 |
|
density.dataType = "RealType"; |
341 |
|
density.accumulator.reserve(nBins_); |
342 |
< |
for (unsigned int i = 0; i < nBins_; i++) |
342 |
> |
for (int i = 0; i < nBins_; i++) |
343 |
|
density.accumulator.push_back( new Accumulator() ); |
344 |
|
data_[DENSITY] = density; |
345 |
|
outputMap_["DENSITY"] = DENSITY; |
502 |
|
+ angMom[2]*angMom[2]/I(2, 2); |
503 |
|
} |
504 |
|
} //angular momenta exchange enabled |
497 |
– |
//energyConvert temporarily disabled |
498 |
– |
//make kineticExchange_ comparable between swap & scale |
499 |
– |
//value = value * 0.5 / PhysicalConstants::energyConvert; |
505 |
|
value *= 0.5; |
506 |
|
break; |
507 |
|
case rnemdPx : |
739 |
|
|
740 |
|
switch(rnemdFluxType_) { |
741 |
|
case rnemdKE: |
737 |
– |
cerr << "KE\n"; |
742 |
|
kineticExchange_ += max_val - min_val; |
743 |
|
break; |
744 |
|
case rnemdPx: |
751 |
|
momentumExchange_.z() += max_val - min_val; |
752 |
|
break; |
753 |
|
default: |
750 |
– |
cerr << "default\n"; |
754 |
|
break; |
755 |
|
} |
756 |
|
} else { |
1530 |
|
vel.x() = binPx[i] / binMass[i]; |
1531 |
|
vel.y() = binPy[i] / binMass[i]; |
1532 |
|
vel.z() = binPz[i] / binMass[i]; |
1533 |
< |
den = binCount[i] * nBins_ / currentSnap_->getVolume(); |
1533 |
> |
|
1534 |
> |
den = binMass[i] * nBins_ * PhysicalConstants::densityConvert |
1535 |
> |
/ currentSnap_->getVolume() ; |
1536 |
> |
|
1537 |
|
temp = 2.0 * binKE[i] / (binDOF[i] * PhysicalConstants::kb * |
1538 |
|
PhysicalConstants::energyConvert); |
1539 |
|
|
1608 |
|
RealType time = currentSnap_->getTime(); |
1609 |
|
RealType avgArea; |
1610 |
|
areaAccumulator_->getAverage(avgArea); |
1611 |
< |
RealType Jz = kineticExchange_ / (2.0 * time * avgArea); |
1611 |
> |
RealType Jz = kineticExchange_ / (2.0 * time * avgArea) |
1612 |
> |
/ PhysicalConstants::energyConvert; |
1613 |
|
Vector3d JzP = momentumExchange_ / (2.0 * time * avgArea); |
1614 |
|
|
1615 |
|
rnemdFile_ << "#######################################################\n"; |
1638 |
|
rnemdFile_ << "# RNEMD report:\n"; |
1639 |
|
rnemdFile_ << "# running time = " << time << " fs\n"; |
1640 |
|
rnemdFile_ << "# target flux:\n"; |
1641 |
< |
rnemdFile_ << "# kinetic = " << kineticFlux_ << "\n"; |
1642 |
< |
rnemdFile_ << "# momentum = " << momentumFluxVector_ << "\n"; |
1641 |
> |
rnemdFile_ << "# kinetic = " |
1642 |
> |
<< kineticFlux_ / PhysicalConstants::energyConvert |
1643 |
> |
<< " (kcal/mol/A^2/fs)\n"; |
1644 |
> |
rnemdFile_ << "# momentum = " << momentumFluxVector_ |
1645 |
> |
<< " (amu/A/fs^2)\n"; |
1646 |
|
rnemdFile_ << "# target one-time exchanges:\n"; |
1647 |
< |
rnemdFile_ << "# kinetic = " << kineticTarget_ << "\n"; |
1648 |
< |
rnemdFile_ << "# momentum = " << momentumTarget_ << "\n"; |
1647 |
> |
rnemdFile_ << "# kinetic = " |
1648 |
> |
<< kineticTarget_ / PhysicalConstants::energyConvert |
1649 |
> |
<< " (kcal/mol)\n"; |
1650 |
> |
rnemdFile_ << "# momentum = " << momentumTarget_ |
1651 |
> |
<< " (amu*A/fs)\n"; |
1652 |
|
rnemdFile_ << "# actual exchange totals:\n"; |
1653 |
< |
rnemdFile_ << "# kinetic = " << kineticExchange_ << "\n"; |
1654 |
< |
rnemdFile_ << "# momentum = " << momentumExchange_ << "\n"; |
1653 |
> |
rnemdFile_ << "# kinetic = " |
1654 |
> |
<< kineticExchange_ / PhysicalConstants::energyConvert |
1655 |
> |
<< " (kcal/mol)\n"; |
1656 |
> |
rnemdFile_ << "# momentum = " << momentumExchange_ |
1657 |
> |
<< " (amu*A/fs)\n"; |
1658 |
|
rnemdFile_ << "# actual flux:\n"; |
1659 |
< |
rnemdFile_ << "# kinetic = " << Jz << "\n"; |
1660 |
< |
rnemdFile_ << "# momentum = " << JzP << "\n"; |
1659 |
> |
rnemdFile_ << "# kinetic = " << Jz |
1660 |
> |
<< " (kcal/mol/A^2/fs)\n"; |
1661 |
> |
rnemdFile_ << "# momentum = " << JzP |
1662 |
> |
<< " (amu/A/fs^2)\n"; |
1663 |
|
rnemdFile_ << "# exchange statistics:\n"; |
1664 |
|
rnemdFile_ << "# attempted = " << trialCount_ << "\n"; |
1665 |
|
rnemdFile_ << "# failed = " << failTrialCount_ << "\n"; |
1677 |
|
if (outputMask_[i]) { |
1678 |
|
rnemdFile_ << "\t" << data_[i].title << |
1679 |
|
"(" << data_[i].units << ")"; |
1680 |
+ |
// add some extra tabs for column alignment |
1681 |
+ |
if (data_[i].dataType == "Vector3d") rnemdFile_ << "\t\t"; |
1682 |
|
} |
1683 |
|
} |
1684 |
|
rnemdFile_ << std::endl; |
1685 |
|
|
1686 |
|
rnemdFile_.precision(8); |
1687 |
|
|
1688 |
< |
for (unsigned int j = 0; j < nBins_; j++) { |
1688 |
> |
for (int j = 0; j < nBins_; j++) { |
1689 |
|
|
1690 |
|
for (unsigned int i = 0; i < outputMask_.size(); ++i) { |
1691 |
|
if (outputMask_[i]) { |
1711 |
|
rnemdFile_ << "#######################################################\n"; |
1712 |
|
|
1713 |
|
|
1714 |
< |
for (unsigned int j = 0; j < nBins_; j++) { |
1714 |
> |
for (int j = 0; j < nBins_; j++) { |
1715 |
|
rnemdFile_ << "#"; |
1716 |
|
for (unsigned int i = 0; i < outputMask_.size(); ++i) { |
1717 |
|
if (outputMask_[i]) { |