| 24 |
|
// Hoover, W. G., 1986, Phys. Rev. A, 34, 2499. |
| 25 |
|
|
| 26 |
|
NPTxyz::NPTxyz ( SimInfo *theInfo, ForceFields* the_ff): |
| 27 |
< |
Integrator( theInfo, the_ff ) |
| 27 |
> |
NPT( theInfo, the_ff ) |
| 28 |
|
{ |
| 29 |
|
GenericData* data; |
| 30 |
< |
DoubleArrayData * etaValue; |
| 31 |
< |
vector<double> etaArray; |
| 30 |
> |
double *etaArray; |
| 31 |
|
int i,j; |
| 32 |
|
|
| 33 |
|
for(i = 0; i < 3; i++){ |
| 40 |
|
|
| 41 |
|
// retrieve eta array from simInfo if it exists |
| 42 |
|
data = info->getProperty(ETAVALUE_ID); |
| 43 |
< |
if(data){ |
| 44 |
< |
etaValue = dynamic_cast<DoubleArrayData*>(data); |
| 45 |
< |
|
| 46 |
< |
if(etaValue){ |
| 47 |
< |
etaArray = etaValue->getData(); |
| 48 |
< |
|
| 43 |
> |
if(data != NULL){ |
| 44 |
> |
|
| 45 |
> |
int test = data->getDarray(etaArray); |
| 46 |
> |
|
| 47 |
> |
if( test == 9 ){ |
| 48 |
> |
|
| 49 |
|
for(i = 0; i < 3; i++){ |
| 50 |
< |
for (j = 0; j < 3; j++){ |
| 51 |
< |
eta[i][j] = etaArray[3*i+j]; |
| 52 |
< |
oldEta[i][j] = eta[i][j]; |
| 53 |
< |
} |
| 54 |
< |
} |
| 50 |
> |
for (j = 0; j < 3; j++){ |
| 51 |
> |
eta[i][j] = etaArray[3*i+j]; |
| 52 |
> |
oldEta[i][j] = eta[i][j]; |
| 53 |
> |
} |
| 54 |
> |
} |
| 55 |
> |
delete[] etaArray; |
| 56 |
|
} |
| 57 |
+ |
else |
| 58 |
+ |
std::cerr << "NPTxyz error: etaArray is not length 9 (actual = " << test |
| 59 |
+ |
<< ").\n" |
| 60 |
+ |
<< " Simulation wil proceed with eta = 0;\n"; |
| 61 |
|
} |
| 58 |
– |
|
| 62 |
|
} |
| 63 |
|
|
| 64 |
|
NPTxyz::~NPTxyz() { |
| 74 |
|
for (j = 0; j < 3; j++) |
| 75 |
|
eta[i][j] = 0.0; |
| 76 |
|
|
| 77 |
< |
Integrator::resetIntegrator(); |
| 77 |
> |
NPT::resetIntegrator(); |
| 78 |
|
} |
| 79 |
|
|
| 80 |
|
void NPTxyz::evolveEtaA() { |
| 303 |
|
|
| 304 |
|
} |
| 305 |
|
|
| 306 |
< |
string NPTxyz::getAdditionalParameters(void){ |
| 304 |
< |
string parameters; |
| 305 |
< |
const int BUFFERSIZE = 2000; // size of the read buffer |
| 306 |
< |
char buffer[BUFFERSIZE]; |
| 306 |
> |
char* NPTxyz::getAdditionalParameters(void){ |
| 307 |
|
|
| 308 |
< |
sprintf(buffer,"\t%lf\t%lf;", chi, integralOfChidt); |
| 309 |
< |
parameters += buffer; |
| 308 |
> |
sprintf(addParamBuffer, |
| 309 |
> |
"\t%G\t%G;" |
| 310 |
> |
"\t%G\t%G\t%G;" |
| 311 |
> |
"\t%G\t%G\t%G;" |
| 312 |
> |
"\t%G\t%G\t%G;", |
| 313 |
> |
chi, integralOfChidt, |
| 314 |
> |
eta[0][0], eta[0][1], eta[0][2], |
| 315 |
> |
eta[1][0], eta[1][1], eta[1][2], |
| 316 |
> |
eta[2][0], eta[2][1], eta[2][2] |
| 317 |
> |
); |
| 318 |
|
|
| 319 |
< |
for(int i = 0; i < 3; i++){ |
| 312 |
< |
sprintf(buffer,"\t%lf\t%lf\t%lf;", eta[3*i], eta[3*i+1], eta[3*i+2]); |
| 313 |
< |
parameters += buffer; |
| 314 |
< |
} |
| 315 |
< |
|
| 316 |
< |
return parameters; |
| 317 |
< |
|
| 319 |
> |
return addParamBuffer; |
| 320 |
|
} |