--- trunk/OOPSE/libmdtools/SimInfo.cpp 2004/04/29 16:03:38 1143 +++ trunk/OOPSE/libmdtools/SimInfo.cpp 2004/05/01 18:52:38 1144 @@ -72,6 +72,8 @@ SimInfo::SimInfo(){ has_minimizer = false; the_minimizer =NULL; + ngroup = 0; + wrapMeSimInfo( this ); } @@ -84,7 +86,7 @@ SimInfo::~SimInfo(){ for(i = properties.begin(); i != properties.end(); i++) delete (*i).second; - + } void SimInfo::setBox(double newBox[3]) { @@ -437,11 +439,10 @@ void SimInfo::refreshSim(){ //fInfo.SIM_uses_RF = 0; fInfo.SIM_uses_GB = useGB; fInfo.SIM_uses_EAM = useEAM; - fInfo.SIM_uses_molecular_cutoffs = useMolecularCutoffs; n_exclude = excludes->getSize(); excl = excludes->getFortranArray(); - + #ifdef IS_MPI n_global = mpiSim->getTotAtoms(); #else @@ -449,10 +450,12 @@ void SimInfo::refreshSim(){ #endif 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 ){ @@ -590,4 +593,56 @@ GenericData* SimInfo::getProperty(const string& propNa else 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) + +}