51#include "brains/Thermo.hpp"
54#include "utils/Constants.hpp"
55#include "utils/simError.h"
71 void NPTi::evolveEtaA() {
72 eta += dt2 * (instaVol * (instaPress - targetPressure) /
73 (Constants::pressureConvert * NkBT * tb2));
77 void NPTi::evolveEtaB() {
79 eta = oldEta + dt2 * (instaVol * (instaPress - targetPressure) /
80 (Constants::pressureConvert * NkBT * tb2));
83 void NPTi::calcVelScale() { vScale = thermostat.first + eta; }
85 void NPTi::getVelScaleA(Vector3d& sc,
const Vector3d& vel) {
89 void NPTi::getVelScaleB(Vector3d& sc,
int index) {
90 sc = oldVel[index] * vScale;
93 void NPTi::getPosScale(
const Vector3d& pos,
const Vector3d& COM,
int index,
96 sc = (oldPos[index] + pos) / (RealType)2.0 - COM;
100 void NPTi::scaleSimBox() {
101 RealType scaleFactor;
103 scaleFactor = exp(dt * eta);
105 if ((scaleFactor > 1.1) || (scaleFactor < 0.9)) {
106 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
107 "NPTi error: Attempting a Box scaling of more than 10 percent"
108 " check your tauBarostat, as it is probably too small!\n"
109 " eta = %lf, scaleFactor = %lf\n",
111 painCave.isFatal = 1;
114 Mat3x3d hmat = snap->getHmat();
120 bool NPTi::etaConverged() {
return (fabs(prevEta - eta) <= etaTolerance); }
122 RealType NPTi::calcConservedQuantity() {
123 thermostat = snap->getThermostat();
128 NkBT = info_->getNGlobalIntegrableObjects() * Constants::kB * targetTemp;
133 fkBT = info_->getNdf() * Constants::kB * targetTemp;
135 RealType conservedQuantity;
137 RealType thermostat_kinetic;
138 RealType thermostat_potential;
139 RealType barostat_kinetic;
140 RealType barostat_potential;
142 Energy = thermo.getTotalEnergy();
144 thermostat_kinetic = fkBT * tt2 * thermostat.first * thermostat.first /
145 (2.0 * Constants::energyConvert);
147 thermostat_potential = fkBT * thermostat.second / Constants::energyConvert;
150 3.0 * NkBT * tb2 * eta * eta / (2.0 * Constants::energyConvert);
153 (targetPressure * thermo.getVolume() / Constants::pressureConvert) /
154 Constants::energyConvert;
156 conservedQuantity = Energy + thermostat_kinetic + thermostat_potential +
157 barostat_kinetic + barostat_potential;
159 return conservedQuantity;
162 void NPTi::loadEta() {
163 Mat3x3d etaMat = snap->getBarostat();
175 void NPTi::saveEta() {
180 snap->setBarostat(etaMat);
One of the heavy-weight classes of OpenMD, SimInfo maintains objects and variables relating to the cu...
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.