1 |
|
#include <math.h> |
2 |
+ |
#include "MatVec3.h" |
3 |
|
#include "Atom.hpp" |
4 |
|
#include "SRI.hpp" |
5 |
|
#include "AbstractClasses.hpp" |
40 |
|
} |
41 |
|
} |
42 |
|
|
42 |
– |
// retrieve eta array from simInfo if it exists |
43 |
– |
data = info->getProperty(ETAVALUE_ID); |
44 |
– |
if(data){ |
45 |
– |
etaValue = dynamic_cast<DoubleArrayData*>(data); |
43 |
|
|
44 |
< |
if(etaValue){ |
48 |
< |
etaArray = etaValue->getData(); |
44 |
> |
if( theInfo->useInitXSstate ){ |
45 |
|
|
46 |
< |
for(i = 0; i < 3; i++){ |
47 |
< |
for (j = 0; j < 3; j++){ |
48 |
< |
eta[i][j] = etaArray[3*i+j]; |
49 |
< |
oldEta[i][j] = eta[i][j]; |
50 |
< |
} |
46 |
> |
// retrieve eta array from simInfo if it exists |
47 |
> |
data = info->getProperty(ETAVALUE_ID); |
48 |
> |
if(data){ |
49 |
> |
etaValue = dynamic_cast<DoubleArrayData*>(data); |
50 |
> |
|
51 |
> |
if(etaValue){ |
52 |
> |
etaArray = etaValue->getData(); |
53 |
> |
|
54 |
> |
for(i = 0; i < 3; i++){ |
55 |
> |
for (j = 0; j < 3; j++){ |
56 |
> |
eta[i][j] = etaArray[3*i+j]; |
57 |
> |
oldEta[i][j] = eta[i][j]; |
58 |
> |
} |
59 |
> |
} |
60 |
|
} |
61 |
|
} |
62 |
|
} |
58 |
– |
|
63 |
|
} |
64 |
|
|
65 |
|
template<typename T> NPTxyz<T>::~NPTxyz() { |
117 |
|
} |
118 |
|
} |
119 |
|
|
120 |
< |
template<typename T> void NPTxyz<T>::getVelScaleA(double sc[3], double vel[3]) { |
120 |
> |
template<typename T> void NPTxyz<T>::calcVelScale(void) { |
121 |
|
int i,j; |
118 |
– |
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 |
< |
info->matVecMul3( vScale, vel, sc ); |
134 |
> |
template<typename T> void NPTxyz<T>::getVelScaleA(double sc[3], double vel[3]) { |
135 |
> |
matVecMul3( vScale, vel, sc ); |
136 |
|
} |
137 |
|
|
138 |
|
template<typename T> void NPTxyz<T>::getVelScaleB(double sc[3], int index ){ |
139 |
< |
int i,j; |
139 |
> |
int j; |
140 |
|
double myVel[3]; |
136 |
– |
double vScale[3][3]; |
141 |
|
|
138 |
– |
for (i = 0; i < 3; i++ ) { |
139 |
– |
for (j = 0; j < 3; j++ ) { |
140 |
– |
vScale[i][j] = eta[i][j]; |
141 |
– |
|
142 |
– |
if (i == j) { |
143 |
– |
vScale[i][j] += chi; |
144 |
– |
} |
145 |
– |
} |
146 |
– |
} |
147 |
– |
|
142 |
|
for (j = 0; j < 3; j++) |
143 |
|
myVel[j] = oldVel[3*index + j]; |
144 |
|
|
145 |
< |
info->matVecMul3( vScale, myVel, sc ); |
145 |
> |
matVecMul3( vScale, myVel, sc ); |
146 |
|
} |
147 |
|
|
148 |
|
template<typename T> void NPTxyz<T>::getPosScale(double pos[3], double COM[3], |
153 |
|
for(j=0; j<3; j++) |
154 |
|
rj[j] = ( oldPos[index*3+j] + pos[j]) / 2.0 - COM[j]; |
155 |
|
|
156 |
< |
info->matVecMul3( eta, rj, sc ); |
156 |
> |
matVecMul3( eta, rj, sc ); |
157 |
|
} |
158 |
|
|
159 |
|
template<typename T> void NPTxyz<T>::scaleSimBox( void ){ |
234 |
|
simError(); |
235 |
|
} else { |
236 |
|
info->getBoxM(hm); |
237 |
< |
info->matMul3(hm, scaleMat, hmnew); |
237 |
> |
matMul3(hm, scaleMat, hmnew); |
238 |
|
info->setBoxM(hmnew); |
239 |
|
} |
240 |
|
} |
270 |
|
|
271 |
|
thermostat_potential = fkBT* integralOfChidt / eConvert; |
272 |
|
|
273 |
< |
info->transposeMat3(eta, a); |
274 |
< |
info->matMul3(a, eta, b); |
275 |
< |
trEta = info->matTrace3(b); |
273 |
> |
transposeMat3(eta, a); |
274 |
> |
matMul3(a, eta, b); |
275 |
> |
trEta = matTrace3(b); |
276 |
|
|
277 |
|
barostat_kinetic = NkBT * tb2 * trEta / |
278 |
|
(2.0 * eConvert); |
299 |
|
const int BUFFERSIZE = 2000; // size of the read buffer |
300 |
|
char buffer[BUFFERSIZE]; |
301 |
|
|
302 |
< |
sprintf(buffer,"\t%f\t%f;", chi, integralOfChidt); |
302 |
> |
sprintf(buffer,"\t%G\t%G;", chi, integralOfChidt); |
303 |
|
parameters += buffer; |
304 |
|
|
305 |
|
for(int i = 0; i < 3; i++){ |
306 |
< |
sprintf(buffer,"\t%g\t%g\t%g;", eta[3*i], eta[3*i+1], eta[3*i+2]); |
306 |
> |
sprintf(buffer,"\t%G\t%G\t%G;", eta[i][0], eta[i][1], eta[i][2]); |
307 |
|
parameters += buffer; |
308 |
|
} |
309 |
|
|