| 1 |
|
#include <math.h> |
| 2 |
+ |
|
| 3 |
|
#include "Atom.hpp" |
| 4 |
|
#include "SRI.hpp" |
| 5 |
|
#include "AbstractClasses.hpp" |
| 40 |
|
} |
| 41 |
|
} |
| 42 |
|
|
| 43 |
+ |
|
| 44 |
+ |
if( theInfo->useInitXSstate ){ |
| 45 |
|
// retrieve eta array from simInfo if it exists |
| 46 |
|
data = info->getProperty(ETAVALUE_ID); |
| 47 |
|
if(data){ |
| 48 |
|
etaValue = dynamic_cast<DoubleArrayData*>(data); |
| 49 |
< |
|
| 49 |
> |
|
| 50 |
|
if(etaValue){ |
| 51 |
< |
etaArray = etaValue->getData(); |
| 52 |
< |
|
| 53 |
< |
for(i = 0; i < 3; i++){ |
| 54 |
< |
for (j = 0; j < 3; j++){ |
| 55 |
< |
eta[i][j] = etaArray[3*i+j]; |
| 56 |
< |
oldEta[i][j] = eta[i][j]; |
| 57 |
< |
} |
| 58 |
< |
} |
| 56 |
< |
|
| 51 |
> |
etaArray = etaValue->getData(); |
| 52 |
> |
|
| 53 |
> |
for(i = 0; i < 3; i++){ |
| 54 |
> |
for (j = 0; j < 3; j++){ |
| 55 |
> |
eta[i][j] = etaArray[3*i+j]; |
| 56 |
> |
oldEta[i][j] = eta[i][j]; |
| 57 |
> |
} |
| 58 |
> |
} |
| 59 |
|
} |
| 60 |
|
} |
| 61 |
+ |
} |
| 62 |
|
|
| 63 |
|
} |
| 64 |
|
|
| 117 |
|
} |
| 118 |
|
} |
| 119 |
|
|
| 120 |
< |
template<typename T> void NPTf<T>::getVelScaleA(double sc[3], double vel[3]) { |
| 120 |
> |
template<typename T> void NPTf<T>::calcVelScale(void){ |
| 121 |
|
int i,j; |
| 119 |
– |
double vScale[3][3]; |
| 122 |
|
|
| 123 |
|
for (i = 0; i < 3; i++ ) { |
| 124 |
|
for (j = 0; j < 3; j++ ) { |
| 129 |
|
} |
| 130 |
|
} |
| 131 |
|
} |
| 132 |
+ |
} |
| 133 |
|
|
| 134 |
+ |
template<typename T> void NPTf<T>::getVelScaleA(double sc[3], double vel[3]) { |
| 135 |
+ |
|
| 136 |
|
info->matVecMul3( vScale, vel, sc ); |
| 137 |
|
} |
| 138 |
|
|
| 139 |
|
template<typename T> void NPTf<T>::getVelScaleB(double sc[3], int index ){ |
| 140 |
< |
int i,j; |
| 140 |
> |
int j; |
| 141 |
|
double myVel[3]; |
| 142 |
|
double vScale[3][3]; |
| 138 |
– |
|
| 139 |
– |
for (i = 0; i < 3; i++ ) { |
| 140 |
– |
for (j = 0; j < 3; j++ ) { |
| 141 |
– |
vScale[i][j] = eta[i][j]; |
| 143 |
|
|
| 143 |
– |
if (i == j) { |
| 144 |
– |
vScale[i][j] += chi; |
| 145 |
– |
} |
| 146 |
– |
} |
| 147 |
– |
} |
| 148 |
– |
|
| 144 |
|
for (j = 0; j < 3; j++) |
| 145 |
|
myVel[j] = oldVel[3*index + j]; |
| 146 |
|
|
| 203 |
|
if (scaleMat[i][i] < smallScale) smallScale = scaleMat[i][i]; |
| 204 |
|
} |
| 205 |
|
|
| 206 |
< |
if ((bigScale > 1.1) || (smallScale < 0.9)) { |
| 206 |
> |
if ((bigScale > 1.01) || (smallScale < 0.99)) { |
| 207 |
|
sprintf( painCave.errMsg, |
| 208 |
< |
"NPTf error: Attempting a Box scaling of more than 10 percent.\n" |
| 208 |
> |
"NPTf error: Attempting a Box scaling of more than 1 percent.\n" |
| 209 |
|
" Check your tauBarostat, as it is probably too small!\n\n" |
| 210 |
|
" scaleMat = [%lf\t%lf\t%lf]\n" |
| 211 |
|
" [%lf\t%lf\t%lf]\n" |
| 215 |
|
scaleMat[2][0],scaleMat[2][1],scaleMat[2][2]); |
| 216 |
|
painCave.isFatal = 1; |
| 217 |
|
simError(); |
| 218 |
< |
} else if (offDiagMax > 0.1) { |
| 218 |
> |
} else if (offDiagMax > 0.01) { |
| 219 |
|
sprintf( painCave.errMsg, |
| 220 |
< |
"NPTf error: Attempting an off-diagonal Box scaling of more than 10 percent.\n" |
| 220 |
> |
"NPTf error: Attempting an off-diagonal Box scaling of more than 1 percent.\n" |
| 221 |
|
" Check your tauBarostat, as it is probably too small!\n\n" |
| 222 |
|
" scaleMat = [%lf\t%lf\t%lf]\n" |
| 223 |
|
" [%lf\t%lf\t%lf]\n" |
| 278 |
|
conservedQuantity = totalEnergy + thermostat_kinetic + thermostat_potential + |
| 279 |
|
barostat_kinetic + barostat_potential; |
| 280 |
|
|
| 286 |
– |
// cout.width(8); |
| 287 |
– |
// cout.precision(8); |
| 288 |
– |
|
| 289 |
– |
// cerr << info->getTime() << "\t" << Energy << "\t" << thermostat_kinetic << |
| 290 |
– |
// "\t" << thermostat_potential << "\t" << barostat_kinetic << |
| 291 |
– |
// "\t" << barostat_potential << "\t" << conservedQuantity << endl; |
| 292 |
– |
|
| 281 |
|
return conservedQuantity; |
| 282 |
|
|
| 283 |
|
} |
| 287 |
|
const int BUFFERSIZE = 2000; // size of the read buffer |
| 288 |
|
char buffer[BUFFERSIZE]; |
| 289 |
|
|
| 290 |
< |
sprintf(buffer,"\t%f\t%f;", chi, integralOfChidt); |
| 290 |
> |
sprintf(buffer,"\t%G\t%G;", chi, integralOfChidt); |
| 291 |
|
parameters += buffer; |
| 292 |
|
|
| 293 |
|
for(int i = 0; i < 3; i++){ |
| 294 |
< |
sprintf(buffer,"\t%g\t%g\t%g;", eta[3*i], eta[3*i+1], eta[3*i+2]); |
| 294 |
> |
sprintf(buffer,"\t%G\t%G\t%G;", eta[i][0], eta[i][1], eta[i][2]); |
| 295 |
|
parameters += buffer; |
| 296 |
|
} |
| 297 |
|
|