--- trunk/OOPSE_old/src/mdtools/libmdCode/SimInfo.cpp 2003/02/27 18:47:45 289 +++ trunk/OOPSE_old/src/mdtools/libmdCode/SimInfo.cpp 2003/02/27 21:25:47 290 @@ -1,14 +1,17 @@ #include +#include + #include "SimInfo.hpp" #define __C #include "fSimulation.h" +#include "simError.h" + extern "C"{ - void wrapsimmod_( void (*wrapFunction)(void (*fSub)( int*, double*, - double*, double*))); + void wrapsimmod_( void (*wrapFunction)(void (*fSub)( simtype*, int* ))); } -void wrapSimInfo(void (*fSub)( int*, double*, double*, double*)); +void wrapSimInfo(void (*fSub)( simtype*, int* )); SimInfo* currentInfo; @@ -33,21 +36,43 @@ void SimInfo::refreshSim(){ void SimInfo::refreshSim(){ - - double box[3]; - - box[0] = box_x; - box[1] = box_y; - box[2] = box_z; - + simtype fInfo; + int isError; - setFsimulation( &n_atoms, box, &rList, &rCut,&ensemble, - &mixingRule,&usePBC); -} + fInfo.box[0] = box_x; + fInfo.box[1] = box_y; + fInfo.box[2] = box_z; + fInfo.rlist = rList; + fInfo.rcut = rCut; + fInfo.rlistsq = rlist * rlist; + fInfo.rcutsq = rCut * rCut; + fInfo.rcut6 = fInfo.rcutsq * fInfo.rcutsq * fInfo.rcutsq; + fInfo.natoms = n_atoms; + fInfo.usePBC = usePBC; + strcpy( fInfo.ensemble, ensemble ); + strcpy( fInfo.mixingRule, mixingRule ); -void wrapSimInfo(void (*fSub)( int*, double*, double*, double*)){ + isError = 0; + setFsimulation( &fInfo, &isError ); + + if( isError ){ + + sprintf( painCave.errMsg, + "There was an error setting the simulation information in fortran.\n" ); + painCave.isFatal = 1; + simError(); + } + +#ifdef IS_MPI + sprintf( checkPointMsg, + "succesfully sent the simulation information to fortran.\n"); + MPIcheckPoint(); +#endif // is_mpi +} + +void wrapSimInfo(void (*fSub)( simtype*, int* )){ currentInfo->setInternal(fSub); }