23 |
|
// |
24 |
|
// Hoover, W. G., 1986, Phys. Rev. A, 34, 2499. |
25 |
|
|
26 |
< |
template<typename T> NPTi<T>::NPTi ( SimInfo *theInfo, ForceFields* the_ff): |
26 |
> |
NPTi::NPTi ( SimInfo *theInfo, ForceFields* the_ff): |
27 |
|
T( theInfo, the_ff ) |
28 |
|
{ |
29 |
|
GenericData* data; |
35 |
|
|
36 |
|
if( theInfo->useInitXSstate ){ |
37 |
|
// retrieve eta from simInfo if |
38 |
< |
data = info->getProperty(ETAVALUE_ID); |
38 |
> |
data = info->getPropertyByName(ETAVALUE_ID); |
39 |
|
if(data){ |
40 |
|
etaValue = dynamic_cast<DoubleVectorGenericData*>(data); |
41 |
|
|
47 |
|
} |
48 |
|
} |
49 |
|
|
50 |
< |
template<typename T> NPTi<T>::~NPTi() { |
50 |
> |
NPTi::~NPTi() { |
51 |
|
//nothing for now |
52 |
|
} |
53 |
|
|
54 |
< |
template<typename T> void NPTi<T>::resetIntegrator() { |
55 |
< |
eta = 0.0; |
56 |
< |
T::resetIntegrator(); |
57 |
< |
} |
58 |
< |
|
59 |
< |
template<typename T> void NPTi<T>::evolveEtaA() { |
54 |
> |
void NPTi::evolveEtaA() { |
55 |
|
eta += dt2 * ( instaVol * (instaPress - targetPressure) / |
56 |
|
(p_convert*NkBT*tb2)); |
57 |
|
oldEta = eta; |
58 |
|
} |
59 |
|
|
60 |
< |
template<typename T> void NPTi<T>::evolveEtaB() { |
60 |
> |
void NPTi::evolveEtaB() { |
61 |
|
|
62 |
|
prevEta = eta; |
63 |
|
eta = oldEta + dt2 * ( instaVol * (instaPress - targetPressure) / |
64 |
|
(p_convert*NkBT*tb2)); |
65 |
|
} |
66 |
|
|
67 |
< |
template<typename T> void NPTi<T>::calcVelScale(void) { |
67 |
> |
void NPTi::calcVelScale() { |
68 |
|
vScale = chi + eta; |
69 |
|
} |
70 |
|
|
71 |
< |
template<typename T> void NPTi<T>::getVelScaleA(double sc[3], double vel[3]) { |
72 |
< |
int i; |
78 |
< |
|
79 |
< |
for(i=0; i<3; i++) sc[i] = vel[i] * vScale; |
71 |
> |
void NPTi::getVelScaleA(Vector3d& sc, const Vector3d& vel) { |
72 |
> |
sc = vel * vScale; |
73 |
|
} |
74 |
|
|
75 |
< |
template<typename T> void NPTi<T>::getVelScaleB(double sc[3], int index ){ |
76 |
< |
int i; |
84 |
< |
|
85 |
< |
for(i=0; i<3; i++) sc[i] = oldVel[index*3 + i] * vScale; |
75 |
> |
void NPTi::getVelScaleB(Vector3d& sc, int index ){ |
76 |
> |
sc = oldVel[index] * vScale; |
77 |
|
} |
78 |
|
|
79 |
|
|
80 |
< |
template<typename T> void NPTi<T>::getPosScale(double pos[3], double COM[3], |
81 |
< |
int index, double sc[3]){ |
82 |
< |
int j; |
83 |
< |
|
84 |
< |
for(j=0; j<3; j++) |
94 |
< |
sc[j] = ( oldPos[index*3+j] + pos[j]) / 2.0 - COM[j]; |
95 |
< |
|
96 |
< |
for(j=0; j<3; j++) |
97 |
< |
sc[j] *= eta; |
80 |
> |
void NPTi::getPosScale(const Vector3d& pos, const Vector3d& COM, |
81 |
> |
int index, Vector3d& sc){ |
82 |
> |
/**@todo*/ |
83 |
> |
sc = oldPos[index] + pos/2.0 -COM; |
84 |
> |
sc *= eta; |
85 |
|
} |
86 |
|
|
87 |
< |
template<typename T> void NPTi<T>::scaleSimBox( void ){ |
87 |
> |
void NPTi::scaleSimBox(){ |
88 |
|
|
89 |
|
double scaleFactor; |
90 |
|
|
104 |
|
|
105 |
|
} |
106 |
|
|
107 |
< |
template<typename T> bool NPTi<T>::etaConverged() { |
107 |
> |
bool NPTi::etaConverged() { |
108 |
|
|
109 |
|
return ( fabs(prevEta - eta) <= etaTolerance ); |
110 |
|
} |
111 |
|
|
112 |
< |
template<typename T> double NPTi<T>::getConservedQuantity(void){ |
112 |
> |
double NPTi::calcConservedQuantity(){ |
113 |
|
|
114 |
|
double conservedQuantity; |
115 |
|
double Energy; |
135 |
|
conservedQuantity = Energy + thermostat_kinetic + thermostat_potential + |
136 |
|
barostat_kinetic + barostat_potential; |
137 |
|
|
151 |
– |
// cout.width(8); |
152 |
– |
// cout.precision(8); |
153 |
– |
|
154 |
– |
// cerr << info->getTime() << "\t" << Energy << "\t" << thermostat_kinetic << |
155 |
– |
// "\t" << thermostat_potential << "\t" << barostat_kinetic << |
156 |
– |
// "\t" << barostat_potential << "\t" << conservedQuantity << endl; |
138 |
|
return conservedQuantity; |
139 |
|
} |
140 |
|
|
160 |
– |
template<typename T> string NPTi<T>::getAdditionalParameters(void){ |
161 |
– |
string parameters; |
162 |
– |
const int BUFFERSIZE = 2000; // size of the read buffer |
163 |
– |
char buffer[BUFFERSIZE]; |
164 |
– |
|
165 |
– |
sprintf(buffer,"\t%G\t%G;", chi, integralOfChidt); |
166 |
– |
parameters += buffer; |
167 |
– |
|
168 |
– |
sprintf(buffer,"\t%G\t0\t0;", eta); |
169 |
– |
parameters += buffer; |
170 |
– |
|
171 |
– |
sprintf(buffer,"\t0\t%G\t0;", eta); |
172 |
– |
parameters += buffer; |
173 |
– |
|
174 |
– |
sprintf(buffer,"\t0\t0\t%G;", eta); |
175 |
– |
parameters += buffer; |
176 |
– |
|
177 |
– |
return parameters; |
178 |
– |
|
179 |
– |
} |