| 1 |
+ |
#include <stdlib.h> |
| 2 |
|
#include <math.h> |
| 3 |
+ |
|
| 4 |
|
#include "Atom.hpp" |
| 5 |
|
#include "SRI.hpp" |
| 6 |
|
#include "AbstractClasses.hpp" |
| 30 |
|
Integrator( theInfo, the_ff ) |
| 31 |
|
{ |
| 32 |
|
GenericData* data; |
| 31 |
– |
DoubleData * chiValue; |
| 32 |
– |
DoubleData * integralOfChidtValue; |
| 33 |
|
|
| 34 |
– |
chiValue = NULL; |
| 35 |
– |
integralOfChidtValue = NULL; |
| 36 |
– |
|
| 34 |
|
chi = 0.0; |
| 35 |
|
integralOfChidt = 0.0; |
| 36 |
|
have_tau_thermostat = 0; |
| 43 |
|
|
| 44 |
|
// retrieve chi and integralOfChidt from simInfo |
| 45 |
|
data = info->getProperty(CHIVALUE_ID); |
| 46 |
< |
if(data){ |
| 47 |
< |
chiValue = dynamic_cast<DoubleData*>(data); |
| 46 |
> |
if(data != NULL ){ |
| 47 |
> |
chi = data->getDval(); |
| 48 |
|
} |
| 49 |
|
|
| 50 |
|
data = info->getProperty(INTEGRALOFCHIDT_ID); |
| 51 |
< |
if(data){ |
| 52 |
< |
integralOfChidtValue = dynamic_cast<DoubleData*>(data); |
| 56 |
< |
} |
| 57 |
< |
|
| 58 |
< |
// chi and integralOfChidt should appear by pair |
| 59 |
< |
if(chiValue && integralOfChidtValue){ |
| 60 |
< |
chi = chiValue->getData(); |
| 61 |
< |
integralOfChidt = integralOfChidtValue->getData(); |
| 51 |
> |
if(data != NULL ){ |
| 52 |
> |
integralOfChidt = data->getDval(); |
| 53 |
|
} |
| 54 |
|
|
| 55 |
|
oldPos = new double[3*nAtoms]; |
| 81 |
|
double COM[3]; |
| 82 |
|
|
| 83 |
|
instaTemp = tStats->getTemperature(); |
| 84 |
+ |
|
| 85 |
|
tStats->getPressureTensor( press ); |
| 86 |
|
instaPress = p_convert * (press[0][0] + press[1][1] + press[2][2]) / 3.0; |
| 87 |
+ |
|
| 88 |
|
instaVol = tStats->getVolume(); |
| 89 |
|
|
| 90 |
|
tStats->getCOM(COM); |
| 179 |
|
int i, j, k; |
| 180 |
|
DirectionalAtom* dAtom; |
| 181 |
|
double Tb[3], ji[3], sc[3]; |
| 182 |
< |
double vel[3], frc[3]; |
| 182 |
> |
double vel[3], frc[3], qVel[3]; |
| 183 |
|
double mass; |
| 184 |
|
|
| 185 |
|
// Set things up for the iteration: |
| 209 |
|
|
| 210 |
|
for (k=0; k < 4; k++) { |
| 211 |
|
|
| 212 |
+ |
atoms[0]->getVel(vel); |
| 213 |
+ |
|
| 214 |
|
instaTemp = tStats->getTemperature(); |
| 215 |
+ |
|
| 216 |
|
instaPress = tStats->getPressure(); |
| 217 |
|
|
| 218 |
|
// evolve chi another half step using the temperature at t + dt/2 |
| 229 |
|
|
| 230 |
|
getVelScaleB( sc, i ); |
| 231 |
|
|
| 232 |
+ |
for(j=0;j<3;j++) |
| 233 |
+ |
qVel[j] = vel[j]; |
| 234 |
+ |
|
| 235 |
|
// velocity half step |
| 236 |
|
for (j=0; j < 3; j++) |
| 237 |
|
vel[j] = oldVel[3*i+j] + dt2 * ((frc[j] / mass ) * eConvert - sc[j]); |
| 273 |
|
} |
| 274 |
|
|
| 275 |
|
void NPT::evolveChiA() { |
| 276 |
+ |
|
| 277 |
|
chi += dt2 * ( instaTemp / targetTemp - 1.0) / tt2; |
| 278 |
|
oldChi = chi; |
| 279 |
|
} |