--- trunk/OOPSE/libmdtools/SimInfo.cpp 2003/07/01 21:33:45 569 +++ trunk/OOPSE/libmdtools/SimInfo.cpp 2003/07/08 20:56:10 574 @@ -2,6 +2,8 @@ #include #include +#include +using namespace std; #include "SimInfo.hpp" #define __C @@ -14,6 +16,11 @@ #include "mpiSimulation.hpp" #endif +inline double roundMe( double x ){ + return ( x >= 0 ) ? floor( x + 0.5 ) : ceil( x - 0.5 ); +} + + SimInfo* currentInfo; SimInfo::SimInfo(){ @@ -158,13 +165,23 @@ void SimInfo::setBoxM( double theBox[9] ){ } -void SimInfo::getBox(double theBox[9]) { +void SimInfo::getBoxM (double theBox[9]) { int i; for(i=0; i<9; i++) theBox[i] = Hmat[i]; } - + +void SimInfo::scaleBox(double scale) { + double theBox[9]; + int i; + + for(i=0; i<9; i++) theBox[i] = Hmat[i]*scale; + + setBoxM(theBox); + +} + void SimInfo::calcHmatI( void ) { double C[3][3]; @@ -289,13 +306,13 @@ void SimInfo::wrapVector( double thePos[3] ){ // wrap the scaled coordinates for(i=0; i<3; i++) - scaled[i] -= round(scaled[i]); + scaled[i] -= roundMe(scaled[i]); // calc the wrapped real coordinates from the wrapped scaled coordinates for(i=0; i<3; i++) thePos[i] = - scaled[0]*Hmat[i] + scaled[1]*Hmat[i+3] + scaled[3]*Hmat[i+6]; + scaled[0]*Hmat[i] + scaled[1]*Hmat[i+3] + scaled[2]*Hmat[i+6]; } else{ // calc the scaled coordinates. @@ -306,7 +323,7 @@ void SimInfo::wrapVector( double thePos[3] ){ // wrap the scaled coordinates for(i=0; i<3; i++) - scaled[i] -= round(scaled[i]); + scaled[i] -= roundMe(scaled[i]); // calc the wrapped real coordinates from the wrapped scaled coordinates @@ -360,10 +377,6 @@ void SimInfo::refreshSim(){ fInfo.rt = 0.0; fInfo.dielect = 0.0; - fInfo.box[0] = box_x; - fInfo.box[1] = box_y; - fInfo.box[2] = box_z; - fInfo.rlist = rList; fInfo.rcut = rCut;