--- trunk/OOPSE/libmdtools/SimInfo.cpp 2004/04/20 16:56:40 1127 +++ trunk/OOPSE/libmdtools/SimInfo.cpp 2004/05/01 18:52:38 1144 @@ -63,6 +63,7 @@ SimInfo::SimInfo(){ useReactionField = 0; useGB = 0; useEAM = 0; + useMolecularCutoffs = 0; excludes = Exclude::Instance(); @@ -71,6 +72,8 @@ SimInfo::SimInfo(){ has_minimizer = false; the_minimizer =NULL; + ngroup = 0; + wrapMeSimInfo( this ); } @@ -83,7 +86,7 @@ SimInfo::~SimInfo(){ for(i = properties.begin(); i != properties.end(); i++) delete (*i).second; - + } void SimInfo::setBox(double newBox[3]) { @@ -439,7 +442,7 @@ void SimInfo::refreshSim(){ n_exclude = excludes->getSize(); excl = excludes->getFortranArray(); - + #ifdef IS_MPI n_global = mpiSim->getTotAtoms(); #else @@ -448,9 +451,11 @@ void SimInfo::refreshSim(){ isError = 0; + getFortranGroupArray(this, mfact, ngroup, groupList, groupStart); + setFsimulation( &fInfo, &n_global, &n_atoms, identArray, &n_exclude, excl, - &nGlobalExcludes, globalExcludes, molMembershipArray, - &isError ); + &nGlobalExcludes, globalExcludes, molMembershipArray, + &mfact[0], &ngroup, &groupList[0], &groupStart[0], &isError ); if( isError ){ @@ -510,11 +515,11 @@ void SimInfo::checkCutOffs( void ){ "\tCurrent Value of LJrcut = %G at time %G\n " "\tThis is larger than half of at least one of the\n" "\tperiodic box vectors. Right now, the Box matrix is:\n" - "\n, %G" + "\n" "\t[ %G %G %G ]\n" "\t[ %G %G %G ]\n" "\t[ %G %G %G ]\n", - rCut, currentTime, maxCutoff, + rCut, currentTime, Hmat[0][0], Hmat[0][1], Hmat[0][2], Hmat[1][0], Hmat[1][1], Hmat[1][2], Hmat[2][0], Hmat[2][1], Hmat[2][2]); @@ -589,3 +594,55 @@ GenericData* SimInfo::getProperty(const string& propNa return NULL; } + +void getFortranGroupArray(SimInfo* info, vector& mfact, int& ngroup, + vector& groupList, vector& groupStart){ + Molecule* mol; + int numAtom; + int curIndex; + + mfact.clear(); + groupList.clear(); + groupStart.clear(); + + //Be careful, fortran array begin at 1 + curIndex = 1; + + if(info->useMolecularCutoffs){ + //if using molecular cutoff + ngroup = info->n_mol; + + for(int i = 0; i < ngroup; i ++){ + mol = &(info->molecules[i]); + numAtom = mol->getNAtoms(); + + for(int j=0; j < numAtom; j++){ +#ifdef IS_MPI + groupList.push_back((info->atoms[i])->getGlobalIndex() + 1); +#else + groupList.push_back((info->atoms[i])->getIndex() + 1); +#endif + }//for(int j=0; j < numAtom; j++) + + groupStart.push_back(curIndex); + curIndex += numAtom; + + }//end for(int i =0 ; i < ngroup; i++) + } + else{ + //using atomic cutoff, every single atom is just a group + ngroup = info->n_atoms; + for(int i =0 ; i < ngroup; i++){ + groupStart.push_back(curIndex++); + +#ifdef IS_MPI + groupList.push_back((info->atoms[i])->getGlobalIndex() + 1); +#else + groupList.push_back((info->atoms[i])->getIndex() + 1); +#endif + + }//end for(int i =0 ; i < ngroup; i++) + + }//end if (info->useMolecularCutoffs) + +}