1 |
< |
#include <math.h> |
1 |
> |
/* |
2 |
> |
* Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
3 |
> |
* |
4 |
> |
* The University of Notre Dame grants you ("Licensee") a |
5 |
> |
* non-exclusive, royalty free, license to use, modify and |
6 |
> |
* redistribute this software in source and binary code form, provided |
7 |
> |
* that the following conditions are met: |
8 |
> |
* |
9 |
> |
* 1. Acknowledgement of the program authors must be made in any |
10 |
> |
* publication of scientific results based in part on use of the |
11 |
> |
* program. An acceptable form of acknowledgement is citation of |
12 |
> |
* the article in which the program was described (Matthew |
13 |
> |
* A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher |
14 |
> |
* J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented |
15 |
> |
* Parallel Simulation Engine for Molecular Dynamics," |
16 |
> |
* J. Comput. Chem. 26, pp. 252-271 (2005)) |
17 |
> |
* |
18 |
> |
* 2. Redistributions of source code must retain the above copyright |
19 |
> |
* notice, this list of conditions and the following disclaimer. |
20 |
> |
* |
21 |
> |
* 3. Redistributions in binary form must reproduce the above copyright |
22 |
> |
* notice, this list of conditions and the following disclaimer in the |
23 |
> |
* documentation and/or other materials provided with the |
24 |
> |
* distribution. |
25 |
> |
* |
26 |
> |
* This software is provided "AS IS," without a warranty of any |
27 |
> |
* kind. All express or implied conditions, representations and |
28 |
> |
* warranties, including any implied warranty of merchantability, |
29 |
> |
* fitness for a particular purpose or non-infringement, are hereby |
30 |
> |
* excluded. The University of Notre Dame and its licensors shall not |
31 |
> |
* be liable for any damages suffered by licensee as a result of |
32 |
> |
* using, modifying or distributing the software or its |
33 |
> |
* derivatives. In no event will the University of Notre Dame or its |
34 |
> |
* licensors be liable for any lost revenue, profit or data, or for |
35 |
> |
* direct, indirect, special, consequential, incidental or punitive |
36 |
> |
* damages, however caused and regardless of the theory of liability, |
37 |
> |
* arising out of the use of or inability to use software, even if the |
38 |
> |
* University of Notre Dame has been advised of the possibility of |
39 |
> |
* such damages. |
40 |
> |
*/ |
41 |
> |
|
42 |
> |
#include "integrators/NVT.hpp" |
43 |
> |
#include "primitives/Molecule.hpp" |
44 |
> |
#include "utils/simError.h" |
45 |
> |
#include "utils/OOPSEConstant.hpp" |
46 |
|
|
47 |
< |
#include "Atom.hpp" |
4 |
< |
#include "SRI.hpp" |
5 |
< |
#include "AbstractClasses.hpp" |
6 |
< |
#include "SimInfo.hpp" |
7 |
< |
#include "ForceFields.hpp" |
8 |
< |
#include "Thermo.hpp" |
9 |
< |
#include "ReadWrite.hpp" |
10 |
< |
#include "Integrator.hpp" |
11 |
< |
#include "simError.h" |
47 |
> |
namespace oopse { |
48 |
|
|
49 |
+ |
NVT::NVT(SimInfo* info) : VelocityVerletIntegrator(info), chiTolerance_ (1e-6), maxIterNum_(4) { |
50 |
|
|
51 |
< |
// Basic thermostating via Hoover, Phys.Rev.A, 1985, Vol. 31 (5) 1695-1697 |
51 |
> |
Globals* simParams = info_->getSimParams(); |
52 |
|
|
53 |
< |
template<typename T> NVT<T>::NVT ( SimInfo *theInfo, ForceFields* the_ff): |
54 |
< |
T( theInfo, the_ff ) |
55 |
< |
{ |
56 |
< |
GenericData* data; |
20 |
< |
DoubleData * chiValue; |
21 |
< |
DoubleData * integralOfChidtValue; |
22 |
< |
|
23 |
< |
chiValue = NULL; |
24 |
< |
integralOfChidtValue = NULL; |
25 |
< |
|
26 |
< |
chi = 0.0; |
27 |
< |
have_tau_thermostat = 0; |
28 |
< |
have_target_temp = 0; |
29 |
< |
have_chi_tolerance = 0; |
30 |
< |
integralOfChidt = 0.0; |
31 |
< |
|
32 |
< |
|
33 |
< |
if( theInfo->useInitXSstate ){ |
34 |
< |
|
35 |
< |
// retrieve chi and integralOfChidt from simInfo |
36 |
< |
data = info->getProperty(CHIVALUE_ID); |
37 |
< |
if(data){ |
38 |
< |
chiValue = dynamic_cast<DoubleData*>(data); |
53 |
> |
if (!simParams->getUseIntialExtendedSystemState()) { |
54 |
> |
Snapshot* currSnapshot = info_->getSnapshotManager()->getCurrentSnapshot(); |
55 |
> |
currSnapshot->setChi(0.0); |
56 |
> |
currSnapshot->setIntegralOfChiDt(0.0); |
57 |
|
} |
58 |
|
|
59 |
< |
data = info->getProperty(INTEGRALOFCHIDT_ID); |
60 |
< |
if(data){ |
61 |
< |
integralOfChidtValue = dynamic_cast<DoubleData*>(data); |
59 |
> |
if (!simParams->haveTargetTemp()) { |
60 |
> |
sprintf(painCave.errMsg, "You can't use the NVT integrator without a targetTemp_!\n"); |
61 |
> |
painCave.isFatal = 1; |
62 |
> |
painCave.severity = OOPSE_ERROR; |
63 |
> |
simError(); |
64 |
> |
} else { |
65 |
> |
targetTemp_ = simParams->getTargetTemp(); |
66 |
|
} |
45 |
– |
|
46 |
– |
// chi and integralOfChidt should appear by pair |
47 |
– |
if(chiValue && integralOfChidtValue){ |
48 |
– |
chi = chiValue->getData(); |
49 |
– |
integralOfChidt = integralOfChidtValue->getData(); |
50 |
– |
} |
51 |
– |
} |
67 |
|
|
68 |
< |
oldVel = new double[3*integrableObjects.size()]; |
54 |
< |
oldJi = new double[3*integrableObjects.size()]; |
55 |
< |
} |
68 |
> |
// We must set tauThermostat_. |
69 |
|
|
70 |
< |
template<typename T> NVT<T>::~NVT() { |
71 |
< |
delete[] oldVel; |
72 |
< |
delete[] oldJi; |
60 |
< |
} |
70 |
> |
if (!simParams->haveTauThermostat()) { |
71 |
> |
sprintf(painCave.errMsg, "If you use the constant temperature\n" |
72 |
> |
"\tintegrator, you must set tauThermostat_.\n"); |
73 |
|
|
74 |
< |
template<typename T> void NVT<T>::moveA() { |
74 |
> |
painCave.severity = OOPSE_ERROR; |
75 |
> |
painCave.isFatal = 1; |
76 |
> |
simError(); |
77 |
> |
} else { |
78 |
> |
tauThermostat_ = simParams->getTauThermostat(); |
79 |
> |
} |
80 |
|
|
81 |
< |
int i, j; |
82 |
< |
DirectionalAtom* dAtom; |
66 |
< |
double Tb[3], ji[3]; |
67 |
< |
double mass; |
68 |
< |
double vel[3], pos[3], frc[3]; |
81 |
> |
update(); |
82 |
> |
} |
83 |
|
|
84 |
< |
double instTemp; |
84 |
> |
void NVT::doUpdate() { |
85 |
> |
oldVel_.resize(info_->getNIntegrableObjects()); |
86 |
> |
oldJi_.resize(info_->getNIntegrableObjects()); |
87 |
> |
} |
88 |
> |
void NVT::moveA() { |
89 |
> |
SimInfo::MoleculeIterator i; |
90 |
> |
Molecule::IntegrableObjectIterator j; |
91 |
> |
Molecule* mol; |
92 |
> |
StuntDouble* integrableObject; |
93 |
> |
Vector3d Tb; |
94 |
> |
Vector3d ji; |
95 |
> |
RealType mass; |
96 |
> |
Vector3d vel; |
97 |
> |
Vector3d pos; |
98 |
> |
Vector3d frc; |
99 |
|
|
100 |
< |
// We need the temperature at time = t for the chi update below: |
100 |
> |
RealType chi = currentSnapshot_->getChi(); |
101 |
> |
RealType integralOfChidt = currentSnapshot_->getIntegralOfChiDt(); |
102 |
> |
|
103 |
> |
// We need the temperature at time = t for the chi update below: |
104 |
|
|
105 |
< |
instTemp = tStats->getTemperature(); |
105 |
> |
RealType instTemp = thermo.getTemperature(); |
106 |
|
|
107 |
< |
for( i=0; i < integrableObjects.size(); i++ ){ |
107 |
> |
for (mol = info_->beginMolecule(i); mol != NULL; mol = info_->nextMolecule(i)) { |
108 |
> |
for (integrableObject = mol->beginIntegrableObject(j); integrableObject != NULL; |
109 |
> |
integrableObject = mol->nextIntegrableObject(j)) { |
110 |
|
|
111 |
< |
integrableObjects[i]->getVel( vel ); |
112 |
< |
integrableObjects[i]->getPos( pos ); |
113 |
< |
integrableObjects[i]->getFrc( frc ); |
111 |
> |
vel = integrableObject->getVel(); |
112 |
> |
pos = integrableObject->getPos(); |
113 |
> |
frc = integrableObject->getFrc(); |
114 |
|
|
115 |
< |
mass = integrableObjects[i]->getMass(); |
115 |
> |
mass = integrableObject->getMass(); |
116 |
|
|
117 |
< |
for (j=0; j < 3; j++) { |
118 |
< |
// velocity half step (use chi from previous step here): |
119 |
< |
vel[j] += dt2 * ((frc[j] / mass ) * eConvert - vel[j]*chi); |
120 |
< |
// position whole step |
121 |
< |
pos[j] += dt * vel[j]; |
122 |
< |
} |
117 |
> |
// velocity half step (use chi from previous step here): |
118 |
> |
//vel[j] += dt2 * ((frc[j] / mass ) * OOPSEConstant::energyConvert - vel[j]*chi); |
119 |
> |
vel += dt2 *OOPSEConstant::energyConvert/mass*frc - dt2*chi*vel; |
120 |
> |
|
121 |
> |
// position whole step |
122 |
> |
//pos[j] += dt * vel[j]; |
123 |
> |
pos += dt * vel; |
124 |
|
|
125 |
< |
integrableObjects[i]->setVel( vel ); |
126 |
< |
integrableObjects[i]->setPos( pos ); |
125 |
> |
integrableObject->setVel(vel); |
126 |
> |
integrableObject->setPos(pos); |
127 |
|
|
128 |
< |
if( integrableObjects[i]->isDirectional() ){ |
128 |
> |
if (integrableObject->isDirectional()) { |
129 |
|
|
130 |
< |
// get and convert the torque to body frame |
130 |
> |
//convert the torque to body frame |
131 |
> |
Tb = integrableObject->lab2Body(integrableObject->getTrq()); |
132 |
|
|
133 |
< |
integrableObjects[i]->getTrq( Tb ); |
99 |
< |
integrableObjects[i]->lab2Body( Tb ); |
133 |
> |
// get the angular momentum, and propagate a half step |
134 |
|
|
135 |
< |
// get the angular momentum, and propagate a half step |
135 |
> |
ji = integrableObject->getJ(); |
136 |
|
|
137 |
< |
integrableObjects[i]->getJ( ji ); |
137 |
> |
//ji[j] += dt2 * (Tb[j] * OOPSEConstant::energyConvert - ji[j]*chi); |
138 |
> |
ji += dt2*OOPSEConstant::energyConvert*Tb - dt2*chi *ji; |
139 |
> |
rotAlgo->rotate(integrableObject, ji, dt); |
140 |
|
|
141 |
< |
for (j=0; j < 3; j++) |
142 |
< |
ji[j] += dt2 * (Tb[j] * eConvert - ji[j]*chi); |
141 |
> |
integrableObject->setJ(ji); |
142 |
> |
} |
143 |
> |
} |
144 |
|
|
108 |
– |
this->rotationPropagation( integrableObjects[i], ji ); |
109 |
– |
|
110 |
– |
integrableObjects[i]->setJ( ji ); |
145 |
|
} |
146 |
< |
} |
147 |
< |
|
114 |
< |
if(nConstrained) |
115 |
< |
constrainA(); |
146 |
> |
|
147 |
> |
rattle->constraintA(); |
148 |
|
|
149 |
< |
// Finally, evolve chi a half step (just like a velocity) using |
150 |
< |
// temperature at time t, not time t+dt/2 |
149 |
> |
// Finally, evolve chi a half step (just like a velocity) using |
150 |
> |
// temperature at time t, not time t+dt/2 |
151 |
|
|
152 |
< |
//std::cerr << "targetTemp = " << targetTemp << " instTemp = " << instTemp << " tauThermostat = " << tauThermostat << " integral of Chi = " << integralOfChidt << "\n"; |
153 |
< |
|
154 |
< |
chi += dt2 * ( instTemp / targetTemp - 1.0) / (tauThermostat*tauThermostat); |
123 |
< |
integralOfChidt += chi*dt2; |
152 |
> |
|
153 |
> |
chi += dt2 * (instTemp / targetTemp_ - 1.0) / (tauThermostat_ * tauThermostat_); |
154 |
> |
integralOfChidt += chi * dt2; |
155 |
|
|
156 |
< |
} |
157 |
< |
|
127 |
< |
template<typename T> void NVT<T>::moveB( void ){ |
128 |
< |
int i, j, k; |
129 |
< |
double Tb[3], ji[3]; |
130 |
< |
double vel[3], frc[3]; |
131 |
< |
double mass; |
132 |
< |
double instTemp; |
133 |
< |
double oldChi, prevChi; |
134 |
< |
|
135 |
< |
// Set things up for the iteration: |
136 |
< |
|
137 |
< |
oldChi = chi; |
138 |
< |
|
139 |
< |
for( i=0; i < integrableObjects.size(); i++ ){ |
140 |
< |
|
141 |
< |
integrableObjects[i]->getVel( vel ); |
142 |
< |
|
143 |
< |
for (j=0; j < 3; j++) |
144 |
< |
oldVel[3*i + j] = vel[j]; |
145 |
< |
|
146 |
< |
if( integrableObjects[i]->isDirectional() ){ |
147 |
< |
|
148 |
< |
integrableObjects[i]->getJ( ji ); |
149 |
< |
|
150 |
< |
for (j=0; j < 3; j++) |
151 |
< |
oldJi[3*i + j] = ji[j]; |
152 |
< |
|
153 |
< |
} |
156 |
> |
currentSnapshot_->setChi(chi); |
157 |
> |
currentSnapshot_->setIntegralOfChiDt(integralOfChidt); |
158 |
|
} |
159 |
|
|
160 |
< |
// do the iteration: |
160 |
> |
void NVT::moveB() { |
161 |
> |
SimInfo::MoleculeIterator i; |
162 |
> |
Molecule::IntegrableObjectIterator j; |
163 |
> |
Molecule* mol; |
164 |
> |
StuntDouble* integrableObject; |
165 |
> |
|
166 |
> |
Vector3d Tb; |
167 |
> |
Vector3d ji; |
168 |
> |
Vector3d vel; |
169 |
> |
Vector3d frc; |
170 |
> |
RealType mass; |
171 |
> |
RealType instTemp; |
172 |
> |
int index; |
173 |
> |
// Set things up for the iteration: |
174 |
|
|
175 |
< |
for (k=0; k < 4; k++) { |
175 |
> |
RealType chi = currentSnapshot_->getChi(); |
176 |
> |
RealType oldChi = chi; |
177 |
> |
RealType prevChi; |
178 |
> |
RealType integralOfChidt = currentSnapshot_->getIntegralOfChiDt(); |
179 |
|
|
180 |
< |
instTemp = tStats->getTemperature(); |
180 |
> |
index = 0; |
181 |
> |
for (mol = info_->beginMolecule(i); mol != NULL; mol = info_->nextMolecule(i)) { |
182 |
> |
for (integrableObject = mol->beginIntegrableObject(j); integrableObject != NULL; |
183 |
> |
integrableObject = mol->nextIntegrableObject(j)) { |
184 |
> |
oldVel_[index] = integrableObject->getVel(); |
185 |
> |
oldJi_[index] = integrableObject->getJ(); |
186 |
|
|
187 |
< |
// evolve chi another half step using the temperature at t + dt/2 |
187 |
> |
++index; |
188 |
> |
} |
189 |
> |
|
190 |
> |
} |
191 |
|
|
192 |
< |
prevChi = chi; |
165 |
< |
chi = oldChi + dt2 * ( instTemp / targetTemp - 1.0) / |
166 |
< |
(tauThermostat*tauThermostat); |
192 |
> |
// do the iteration: |
193 |
|
|
194 |
< |
for( i=0; i < integrableObjects.size(); i++ ){ |
194 |
> |
for(int k = 0; k < maxIterNum_; k++) { |
195 |
> |
index = 0; |
196 |
> |
instTemp = thermo.getTemperature(); |
197 |
|
|
198 |
< |
integrableObjects[i]->getFrc( frc ); |
171 |
< |
integrableObjects[i]->getVel(vel); |
198 |
> |
// evolve chi another half step using the temperature at t + dt/2 |
199 |
|
|
200 |
< |
mass = integrableObjects[i]->getMass(); |
200 |
> |
prevChi = chi; |
201 |
> |
chi = oldChi + dt2 * (instTemp / targetTemp_ - 1.0) / (tauThermostat_ * tauThermostat_); |
202 |
|
|
203 |
< |
// velocity half step |
204 |
< |
for (j=0; j < 3; j++) |
205 |
< |
vel[j] = oldVel[3*i+j] + dt2 * ((frc[j] / mass ) * eConvert - oldVel[3*i + j]*chi); |
203 |
> |
for (mol = info_->beginMolecule(i); mol != NULL; mol = info_->nextMolecule(i)) { |
204 |
> |
for (integrableObject = mol->beginIntegrableObject(j); integrableObject != NULL; |
205 |
> |
integrableObject = mol->nextIntegrableObject(j)) { |
206 |
|
|
207 |
< |
integrableObjects[i]->setVel( vel ); |
207 |
> |
frc = integrableObject->getFrc(); |
208 |
> |
vel = integrableObject->getVel(); |
209 |
|
|
210 |
< |
if( integrableObjects[i]->isDirectional() ){ |
210 |
> |
mass = integrableObject->getMass(); |
211 |
|
|
212 |
< |
// get and convert the torque to body frame |
212 |
> |
// velocity half step |
213 |
> |
//for(j = 0; j < 3; j++) |
214 |
> |
// vel[j] = oldVel_[3*i+j] + dt2 * ((frc[j] / mass ) * OOPSEConstant::energyConvert - oldVel_[3*i + j]*chi); |
215 |
> |
vel = oldVel_[index] + dt2/mass*OOPSEConstant::energyConvert * frc - dt2*chi*oldVel_[index]; |
216 |
> |
|
217 |
> |
integrableObject->setVel(vel); |
218 |
|
|
219 |
< |
integrableObjects[i]->getTrq( Tb ); |
186 |
< |
integrableObjects[i]->lab2Body( Tb ); |
219 |
> |
if (integrableObject->isDirectional()) { |
220 |
|
|
221 |
< |
for (j=0; j < 3; j++) |
189 |
< |
ji[j] = oldJi[3*i + j] + dt2 * (Tb[j] * eConvert - oldJi[3*i+j]*chi); |
221 |
> |
// get and convert the torque to body frame |
222 |
|
|
223 |
< |
integrableObjects[i]->setJ( ji ); |
192 |
< |
} |
193 |
< |
} |
194 |
< |
|
195 |
< |
if(nConstrained) |
196 |
< |
constrainB(); |
223 |
> |
Tb = integrableObject->lab2Body(integrableObject->getTrq()); |
224 |
|
|
225 |
< |
if (fabs(prevChi - chi) <= chiTolerance) break; |
226 |
< |
} |
225 |
> |
//for(j = 0; j < 3; j++) |
226 |
> |
// ji[j] = oldJi_[3*i + j] + dt2 * (Tb[j] * OOPSEConstant::energyConvert - oldJi_[3*i+j]*chi); |
227 |
> |
ji = oldJi_[index] + dt2*OOPSEConstant::energyConvert*Tb - dt2*chi *oldJi_[index]; |
228 |
|
|
229 |
< |
integralOfChidt += dt2*chi; |
230 |
< |
} |
229 |
> |
integrableObject->setJ(ji); |
230 |
> |
} |
231 |
|
|
204 |
– |
template<typename T> void NVT<T>::resetIntegrator( void ){ |
232 |
|
|
233 |
< |
chi = 0.0; |
234 |
< |
integralOfChidt = 0.0; |
235 |
< |
} |
233 |
> |
++index; |
234 |
> |
} |
235 |
> |
} |
236 |
> |
|
237 |
|
|
238 |
< |
template<typename T> int NVT<T>::readyCheck() { |
238 |
> |
rattle->constraintB(); |
239 |
|
|
240 |
< |
//check parent's readyCheck() first |
241 |
< |
if (T::readyCheck() == -1) |
214 |
< |
return -1; |
240 |
> |
if (fabs(prevChi - chi) <= chiTolerance_) |
241 |
> |
break; |
242 |
|
|
243 |
< |
// First check to see if we have a target temperature. |
217 |
< |
// Not having one is fatal. |
243 |
> |
} |
244 |
|
|
245 |
< |
if (!have_target_temp) { |
220 |
< |
sprintf( painCave.errMsg, |
221 |
< |
"You can't use the NVT integrator without a targetTemp!\n" |
222 |
< |
); |
223 |
< |
painCave.isFatal = 1; |
224 |
< |
painCave.severity = OOPSE_ERROR; |
225 |
< |
simError(); |
226 |
< |
return -1; |
227 |
< |
} |
245 |
> |
integralOfChidt += dt2 * chi; |
246 |
|
|
247 |
< |
// We must set tauThermostat. |
248 |
< |
|
231 |
< |
if (!have_tau_thermostat) { |
232 |
< |
sprintf( painCave.errMsg, |
233 |
< |
"If you use the constant temperature\n" |
234 |
< |
"\tintegrator, you must set tauThermostat.\n"); |
235 |
< |
painCave.severity = OOPSE_ERROR; |
236 |
< |
painCave.isFatal = 1; |
237 |
< |
simError(); |
238 |
< |
return -1; |
247 |
> |
currentSnapshot_->setChi(chi); |
248 |
> |
currentSnapshot_->setIntegralOfChiDt(integralOfChidt); |
249 |
|
} |
250 |
|
|
251 |
< |
if (!have_chi_tolerance) { |
252 |
< |
sprintf( painCave.errMsg, |
253 |
< |
"In NVT integrator: setting chi tolerance to 1e-6\n"); |
244 |
< |
chiTolerance = 1e-6; |
245 |
< |
have_chi_tolerance = 1; |
246 |
< |
painCave.severity = OOPSE_INFO; |
247 |
< |
painCave.isFatal = 0; |
248 |
< |
simError(); |
251 |
> |
void NVT::resetIntegrator() { |
252 |
> |
currentSnapshot_->setChi(0.0); |
253 |
> |
currentSnapshot_->setIntegralOfChiDt(0.0); |
254 |
|
} |
255 |
+ |
|
256 |
+ |
RealType NVT::calcConservedQuantity() { |
257 |
|
|
258 |
< |
return 1; |
258 |
> |
RealType chi = currentSnapshot_->getChi(); |
259 |
> |
RealType integralOfChidt = currentSnapshot_->getIntegralOfChiDt(); |
260 |
> |
RealType conservedQuantity; |
261 |
> |
RealType fkBT; |
262 |
> |
RealType Energy; |
263 |
> |
RealType thermostat_kinetic; |
264 |
> |
RealType thermostat_potential; |
265 |
> |
|
266 |
> |
fkBT = info_->getNdf() *OOPSEConstant::kB *targetTemp_; |
267 |
|
|
268 |
< |
} |
268 |
> |
Energy = thermo.getTotalE(); |
269 |
|
|
270 |
< |
template<typename T> double NVT<T>::getConservedQuantity(void){ |
270 |
> |
thermostat_kinetic = fkBT * tauThermostat_ * tauThermostat_ * chi * chi / (2.0 * OOPSEConstant::energyConvert); |
271 |
|
|
272 |
< |
double conservedQuantity; |
258 |
< |
double fkBT; |
259 |
< |
double Energy; |
260 |
< |
double thermostat_kinetic; |
261 |
< |
double thermostat_potential; |
272 |
> |
thermostat_potential = fkBT * integralOfChidt / OOPSEConstant::energyConvert; |
273 |
|
|
274 |
< |
fkBT = (double)(info->ndf) * kB * targetTemp; |
274 |
> |
conservedQuantity = Energy + thermostat_kinetic + thermostat_potential; |
275 |
|
|
276 |
< |
Energy = tStats->getTotalE(); |
276 |
> |
return conservedQuantity; |
277 |
> |
} |
278 |
|
|
267 |
– |
thermostat_kinetic = fkBT* tauThermostat * tauThermostat * chi * chi / |
268 |
– |
(2.0 * eConvert); |
279 |
|
|
280 |
< |
thermostat_potential = fkBT * integralOfChidt / eConvert; |
271 |
< |
|
272 |
< |
conservedQuantity = Energy + thermostat_kinetic + thermostat_potential; |
273 |
< |
|
274 |
< |
return conservedQuantity; |
275 |
< |
} |
276 |
< |
|
277 |
< |
template<typename T> string NVT<T>::getAdditionalParameters(void){ |
278 |
< |
string parameters; |
279 |
< |
const int BUFFERSIZE = 2000; // size of the read buffer |
280 |
< |
char buffer[BUFFERSIZE]; |
281 |
< |
|
282 |
< |
sprintf(buffer,"\t%G\t%G;", chi, integralOfChidt); |
283 |
< |
parameters += buffer; |
284 |
< |
|
285 |
< |
return parameters; |
286 |
< |
} |
280 |
> |
}//end namespace oopse |