# | Line 2 | Line 2 | |
---|---|---|
2 | #include <cstring> | |
3 | #include <cmath> | |
4 | ||
5 | + | #include <iostream> |
6 | + | using namespace std; |
7 | ||
8 | #include "SimInfo.hpp" | |
9 | #define __C | |
# | Line 14 | Line 16 | |
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(){ | |
# | Line 158 | Line 165 | void SimInfo::setBoxM( double theBox[9] ){ | |
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]; | |
# | Line 289 | Line 296 | void SimInfo::wrapVector( double thePos[3] ){ | |
296 | // wrap the scaled coordinates | |
297 | ||
298 | for(i=0; i<3; i++) | |
299 | < | scaled[i] -= round(scaled[i]); |
299 | > | scaled[i] -= roundMe(scaled[i]); |
300 | ||
301 | // calc the wrapped real coordinates from the wrapped scaled coordinates | |
302 | ||
303 | for(i=0; i<3; i++) | |
304 | thePos[i] = | |
305 | < | scaled[0]*Hmat[i] + scaled[1]*Hmat[i+3] + scaled[3]*Hmat[i+6]; |
305 | > | scaled[0]*Hmat[i] + scaled[1]*Hmat[i+3] + scaled[2]*Hmat[i+6]; |
306 | } | |
307 | else{ | |
308 | // calc the scaled coordinates. | |
# | Line 306 | Line 313 | void SimInfo::wrapVector( double thePos[3] ){ | |
313 | // wrap the scaled coordinates | |
314 | ||
315 | for(i=0; i<3; i++) | |
316 | < | scaled[i] -= round(scaled[i]); |
316 | > | scaled[i] -= roundMe(scaled[i]); |
317 | ||
318 | // calc the wrapped real coordinates from the wrapped scaled coordinates | |
319 | ||
# | Line 360 | Line 367 | void SimInfo::refreshSim(){ | |
367 | fInfo.rt = 0.0; | |
368 | fInfo.dielect = 0.0; | |
369 | ||
363 | – | fInfo.box[0] = box_x; |
364 | – | fInfo.box[1] = box_y; |
365 | – | fInfo.box[2] = box_z; |
366 | – | |
370 | fInfo.rlist = rList; | |
371 | fInfo.rcut = rCut; | |
372 |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |