48#include "brains/Thermo.hpp"
51#include "utils/Constants.hpp"
52#include "utils/simError.h"
68 void NPTi::evolveEtaA() {
69 eta += dt2 * (instaVol * (instaPress - targetPressure) /
70 (Constants::pressureConvert * NkBT * tb2));
74 void NPTi::evolveEtaB() {
76 eta = oldEta + dt2 * (instaVol * (instaPress - targetPressure) /
77 (Constants::pressureConvert * NkBT * tb2));
80 void NPTi::calcVelScale() { vScale = thermostat.first + eta; }
86 void NPTi::getVelScaleB(
Vector3d& sc,
int index) {
87 sc = oldVel[index] * vScale;
93 sc = (oldPos[index] + pos) / (RealType)2.0 - COM;
97 void NPTi::scaleSimBox() {
100 scaleFactor = exp(dt * eta);
102 if ((scaleFactor > 1.1) || (scaleFactor < 0.9)) {
103 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
104 "NPTi error: Attempting a Box scaling of more than 10 percent"
105 " check your tauBarostat, as it is probably too small!\n"
106 " eta = %lf, scaleFactor = %lf\n",
108 painCave.isFatal = 1;
117 bool NPTi::etaConverged() {
return (fabs(prevEta - eta) <= etaTolerance); }
119 RealType NPTi::calcConservedQuantity() {
120 thermostat = snap->getThermostat();
130 fkBT = info_->
getNdf() * Constants::kB * targetTemp;
132 RealType conservedQuantity;
134 RealType thermostat_kinetic;
135 RealType thermostat_potential;
136 RealType barostat_kinetic;
137 RealType barostat_potential;
139 Energy = thermo.getTotalEnergy();
141 thermostat_kinetic = fkBT * tt2 * thermostat.first * thermostat.first /
142 (2.0 * Constants::energyConvert);
144 thermostat_potential = fkBT * thermostat.second / Constants::energyConvert;
147 3.0 * NkBT * tb2 * eta * eta / (2.0 * Constants::energyConvert);
150 (targetPressure * thermo.getVolume() / Constants::pressureConvert) /
151 Constants::energyConvert;
153 conservedQuantity = Energy + thermostat_kinetic + thermostat_potential +
154 barostat_kinetic + barostat_potential;
156 return conservedQuantity;
159 void NPTi::loadEta() {
160 Mat3x3d etaMat = snap->getBarostat();
172 void NPTi::saveEta() {
177 snap->setBarostat(etaMat);
One of the heavy-weight classes of OpenMD, SimInfo maintains objects and variables relating to the cu...
int getNdf()
Returns the number of degrees of freedom.
int getNGlobalIntegrableObjects()
Returns the total number of integrable objects (total number of rigid bodies plus the total number of...
Mat3x3d getHmat()
Returns the H-Matrix.
void setHmat(const Mat3x3d &m)
Sets the H-Matrix.
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.