1 |
+ |
#include <stdlib.h> |
2 |
|
#include <math.h> |
3 |
+ |
|
4 |
|
#include "Atom.hpp" |
5 |
|
#include "SRI.hpp" |
6 |
|
#include "AbstractClasses.hpp" |
26 |
|
// Hoover, W. G., 1986, Phys. Rev. A, 34, 2499. |
27 |
|
|
28 |
|
NPTf::NPTf ( SimInfo *theInfo, ForceFields* the_ff): |
29 |
< |
Integrator( theInfo, the_ff ) |
29 |
> |
NPT( theInfo, the_ff ) |
30 |
|
{ |
31 |
|
GenericData* data; |
32 |
< |
DoubleArrayData * etaValue; |
31 |
< |
vector<double> etaArray; |
32 |
> |
double *etaArray; |
33 |
|
int i,j; |
34 |
|
|
35 |
|
for(i = 0; i < 3; i++){ |
40 |
|
} |
41 |
|
} |
42 |
|
|
43 |
< |
// retrieve eta array from simInfo if it exists |
44 |
< |
data = info->getProperty(ETAVALUE_ID); |
45 |
< |
if(data){ |
46 |
< |
etaValue = dynamic_cast<DoubleArrayData*>(data); |
47 |
< |
|
48 |
< |
if(etaValue){ |
49 |
< |
etaArray = etaValue->getData(); |
50 |
< |
|
51 |
< |
for(i = 0; i < 3; i++){ |
52 |
< |
for (j = 0; j < 3; j++){ |
53 |
< |
eta[i][j] = etaArray[3*i+j]; |
54 |
< |
oldEta[i][j] = eta[i][j]; |
55 |
< |
} |
56 |
< |
} |
57 |
< |
|
57 |
< |
} |
43 |
> |
// retrieve eta array from simInfo if it exists |
44 |
> |
data = info->getProperty(ETAVALUE_ID); |
45 |
> |
if(data != NULL){ |
46 |
> |
|
47 |
> |
int test = data->getDarray(etaArray); |
48 |
> |
|
49 |
> |
if( test == 9 ){ |
50 |
> |
|
51 |
> |
for(i = 0; i < 3; i++){ |
52 |
> |
for (j = 0; j < 3; j++){ |
53 |
> |
eta[i][j] = etaArray[3*i+j]; |
54 |
> |
oldEta[i][j] = eta[i][j]; |
55 |
> |
} |
56 |
> |
} |
57 |
> |
delete[] etaArray; |
58 |
|
} |
59 |
< |
|
59 |
> |
else |
60 |
> |
std::cerr << "NPTf error: etaArray is not length 9 (actual = " << test |
61 |
> |
<< ").\n" |
62 |
> |
<< " Simulation wil proceed with eta = 0;\n"; |
63 |
> |
} |
64 |
|
} |
65 |
|
|
66 |
|
NPTf::~NPTf() { |
76 |
|
for (j = 0; j < 3; j++) |
77 |
|
eta[i][j] = 0.0; |
78 |
|
|
79 |
< |
Integrator::resetIntegrator(); |
79 |
> |
NPT::resetIntegrator(); |
80 |
|
} |
81 |
|
|
82 |
|
void NPTf::evolveEtaA() { |