| 2 |
|
#include <cstring> |
| 3 |
|
#include <cmath> |
| 4 |
|
|
| 5 |
+ |
#include <iostream> |
| 6 |
+ |
using namespace std; |
| 7 |
|
|
| 8 |
|
#include "SimInfo.hpp" |
| 9 |
|
#define __C |
| 16 |
|
#include "mpiSimulation.hpp" |
| 17 |
|
#endif |
| 18 |
|
|
| 19 |
+ |
inline double roundMe( double x ){ |
| 20 |
+ |
return ( x >= 0 ) ? floor( x + 0.5 ) : ceil( x - 0.5 ); |
| 21 |
+ |
} |
| 22 |
+ |
|
| 23 |
+ |
|
| 24 |
|
SimInfo* currentInfo; |
| 25 |
|
|
| 26 |
|
SimInfo::SimInfo(){ |
| 165 |
|
} |
| 166 |
|
|
| 167 |
|
|
| 168 |
< |
void SimInfo::getBox(double theBox[9]) { |
| 168 |
> |
void SimInfo::getBoxM (double theBox[9]) { |
| 169 |
|
|
| 170 |
|
int i; |
| 171 |
|
for(i=0; i<9; i++) theBox[i] = Hmat[i]; |
| 172 |
|
} |
| 166 |
– |
|
| 173 |
|
|
| 174 |
+ |
|
| 175 |
+ |
void SimInfo::scaleBox(double scale) { |
| 176 |
+ |
double theBox[9]; |
| 177 |
+ |
int i; |
| 178 |
+ |
|
| 179 |
+ |
for(i=0; i<9; i++) theBox[i] = Hmat[i]*scale; |
| 180 |
+ |
|
| 181 |
+ |
setBoxM(theBox); |
| 182 |
+ |
|
| 183 |
+ |
} |
| 184 |
+ |
|
| 185 |
|
void SimInfo::calcHmatI( void ) { |
| 186 |
|
|
| 187 |
|
double C[3][3]; |
| 306 |
|
// wrap the scaled coordinates |
| 307 |
|
|
| 308 |
|
for(i=0; i<3; i++) |
| 309 |
< |
scaled[i] -= round(scaled[i]); |
| 309 |
> |
scaled[i] -= roundMe(scaled[i]); |
| 310 |
|
|
| 311 |
|
// calc the wrapped real coordinates from the wrapped scaled coordinates |
| 312 |
|
|
| 313 |
|
for(i=0; i<3; i++) |
| 314 |
|
thePos[i] = |
| 315 |
< |
scaled[0]*Hmat[i] + scaled[1]*Hmat[i+3] + scaled[3]*Hmat[i+6]; |
| 315 |
> |
scaled[0]*Hmat[i] + scaled[1]*Hmat[i+3] + scaled[2]*Hmat[i+6]; |
| 316 |
|
} |
| 317 |
|
else{ |
| 318 |
|
// calc the scaled coordinates. |
| 323 |
|
// wrap the scaled coordinates |
| 324 |
|
|
| 325 |
|
for(i=0; i<3; i++) |
| 326 |
< |
scaled[i] -= round(scaled[i]); |
| 326 |
> |
scaled[i] -= roundMe(scaled[i]); |
| 327 |
|
|
| 328 |
|
// calc the wrapped real coordinates from the wrapped scaled coordinates |
| 329 |
|
|
| 377 |
|
fInfo.rt = 0.0; |
| 378 |
|
fInfo.dielect = 0.0; |
| 379 |
|
|
| 363 |
– |
fInfo.box[0] = box_x; |
| 364 |
– |
fInfo.box[1] = box_y; |
| 365 |
– |
fInfo.box[2] = box_z; |
| 366 |
– |
|
| 380 |
|
fInfo.rlist = rList; |
| 381 |
|
fInfo.rcut = rCut; |
| 382 |
|
|