--- trunk/OOPSE/libmdtools/SimInfo.cpp 2004/05/11 20:33:41 1157 +++ trunk/OOPSE/libmdtools/SimInfo.cpp 2004/06/01 18:42:58 1214 @@ -62,7 +62,9 @@ SimInfo::SimInfo(){ useReactionField = 0; useGB = 0; useEAM = 0; - + useSolidThermInt = 0; + useLiquidThermInt = 0; + haveCutoffGroups = false; excludes = Exclude::Instance(); @@ -444,20 +446,20 @@ void SimInfo::refreshSim(){ excl = excludes->getFortranArray(); #ifdef IS_MPI - n_global = mpiSim->getTotAtoms(); + n_global = mpiSim->getNAtomsGlobal(); #else n_global = n_atoms; #endif isError = 0; - getFortranGroupArray(this, mfact, ngroup, groupList, groupStart); + getFortranGroupArrays(this, FglobalGroupMembership, mfact); //it may not be a good idea to pass the address of first element in vector - //since c++ standard does not require vector to be stored continously in meomory - //Most of the compilers will organize the memory of vector continously + //since c++ standard does not require vector to be stored continuously in meomory + //Most of the compilers will organize the memory of vector continuously setFsimulation( &fInfo, &n_global, &n_atoms, identArray, &n_exclude, excl, &nGlobalExcludes, globalExcludes, molMembershipArray, - &mfact[0], &ngroup, &groupList[0], &groupStart[0], &isError); + &mfact[0], &ngroup, &FglobalGroupMembership[0], &isError); if( isError ){ @@ -565,12 +567,13 @@ GenericData* SimInfo::getProperty(const string& propNa } -void getFortranGroupArray(SimInfo* info, vector& mfact, int& ngroup, - vector& groupList, vector& groupStart){ +void SimInfo::getFortranGroupArrays(SimInfo* info, + vector& FglobalGroupMembership, + vector& mfact){ + Molecule* myMols; Atom** myAtoms; int numAtom; - int curIndex; double mtot; int numMol; int numCutoffGroups; @@ -579,53 +582,37 @@ void getFortranGroupArray(SimInfo* info, vector::iterator iterAtom; int atomIndex; + double totalMass; mfact.clear(); - groupList.clear(); - groupStart.clear(); + FglobalGroupMembership.clear(); - //Be careful, fortran array begin at 1 - curIndex = 1; + // Fix the silly fortran indexing problem +#ifdef IS_MPI + numAtom = mpiSim->getNAtomsGlobal(); +#else + numAtom = n_atoms; +#endif + for (int i = 0; i < numAtom; i++) + FglobalGroupMembership.push_back(globalGroupMembership[i] + 1); + myMols = info->molecules; numMol = info->n_mol; for(int i = 0; i < numMol; i++){ - numAtom = myMols[i].getNAtoms(); - myAtoms = myMols[i].getMyAtoms(); + numCutoffGroups = myMols[i].getNCutoffGroups(); + for(myCutoffGroup =myMols[i].beginCutoffGroup(iterCutoff); + myCutoffGroup != NULL; + myCutoffGroup =myMols[i].nextCutoffGroup(iterCutoff)){ - - for(int j = 0; j < numAtom; j++){ - - -#ifdef IS_MPI - atomIndex = myAtoms[j]->getGlobalIndex(); -#else - atomIndex = myAtoms[j]->getIndex(); -#endif - - if(myMols[i].belongToCutoffGroup(atomIndex)) - continue; - else{ - mfact.push_back(myAtoms[j]->getMass()); - groupList.push_back(myAtoms[j]->getIndex() + 1); - groupStart.push_back(curIndex++); - } - } + totalMass = myCutoffGroup->getMass(); - numCutoffGroups = myMols[i].getNCutoffGroups(); - for(myCutoffGroup =myMols[i].beginCutoffGroup(iterCutoff); myCutoffGroup != NULL; - myCutoffGroup =myMols[i].nextCutoffGroup(iterCutoff)){ - - for(cutoffAtom = myCutoffGroup->beginAtom(iterAtom); cutoffAtom != NULL; - cutoffAtom = myCutoffGroup->beginAtom(iterAtom)){ - groupList.push_back(cutoffAtom->getIndex() + 1); + for(cutoffAtom = myCutoffGroup->beginAtom(iterAtom); + cutoffAtom != NULL; + cutoffAtom = myCutoffGroup->nextAtom(iterAtom)){ + mfact.push_back(cutoffAtom->getMass()/totalMass); } - - groupStart.push_back(curIndex); - curIndex += myCutoffGroup->getNumAtom(); } - } - ngroup = groupStart.size(); }