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 |
< |
|
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 |
< |
} |
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 |
> |
} |
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() { |