--- trunk/OOPSE/libmdtools/SimInfo.cpp 2004/05/11 21:14:26 1158 +++ trunk/OOPSE/libmdtools/SimInfo.cpp 2004/06/02 14:21:54 1218 @@ -62,7 +62,9 @@ SimInfo::SimInfo(){ useReactionField = 0; useGB = 0; useEAM = 0; - + useSolidThermInt = 0; + useLiquidThermInt = 0; + haveCutoffGroups = false; excludes = Exclude::Instance(); @@ -189,25 +191,27 @@ void SimInfo::calcHmatInv( void ) { if( oldOrtho != orthoRhombic ){ - if( orthoRhombic ){ + if( orthoRhombic ) { sprintf( painCave.errMsg, - "OOPSE is switching from the default Non-Orthorhombic\n" + "\n\tOOPSE is switching from the default Non-Orthorhombic\n" "\tto the faster Orthorhombic periodic boundary computations.\n" "\tThis is usually a good thing, but if you wan't the\n" "\tNon-Orthorhombic computations, make the orthoBoxTolerance\n" "\tvariable ( currently set to %G ) smaller.\n", orthoTolerance); + painCave.severity = OOPSE_INFO; simError(); } else { sprintf( painCave.errMsg, - "OOPSE is switching from the faster Orthorhombic to the more\n" + "\n\tOOPSE is switching from the faster Orthorhombic to the more\n" "\tflexible Non-Orthorhombic periodic boundary computations.\n" "\tThis is usually because the box has deformed under\n" "\tNPTf integration. If you wan't to live on the edge with\n" "\tthe Orthorhombic computations, make the orthoBoxTolerance\n" "\tvariable ( currently set to %G ) larger.\n", orthoTolerance); + painCave.severity = OOPSE_WARNING; simError(); } } @@ -444,21 +448,21 @@ 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 ){ sprintf( painCave.errMsg, @@ -502,7 +506,7 @@ void SimInfo::checkCutOffs( void ){ if( rCut > maxCutoff ){ sprintf( painCave.errMsg, - "cutoffRadius is too large for the current periodic box.\n" + "\n\tcutoffRadius is too large for the current periodic box.\n" "\tCurrent Value of cutoffRadius = %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" @@ -514,14 +518,16 @@ void SimInfo::checkCutOffs( void ){ 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]); + painCave.severity = OOPSE_ERROR; painCave.isFatal = 1; simError(); } } else { // initialize this stuff before using it, OK? sprintf( painCave.errMsg, - "Trying to check cutoffs without a box.\n" + "\n\tTrying to check cutoffs without a box.\n" "\tOOPSE should have better programmers than that.\n" ); + painCave.severity = OOPSE_ERROR; painCave.isFatal = 1; simError(); } @@ -565,12 +571,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; @@ -582,55 +589,35 @@ void getFortranGroupArray(SimInfo* info, vectorgetNAtomsGlobal(); +#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(); - - - 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++); - } - } - numCutoffGroups = myMols[i].getNCutoffGroups(); - for(myCutoffGroup =myMols[i].beginCutoffGroup(iterCutoff); myCutoffGroup != NULL; - myCutoffGroup =myMols[i].nextCutoffGroup(iterCutoff)){ + for(myCutoffGroup =myMols[i].beginCutoffGroup(iterCutoff); + myCutoffGroup != NULL; + myCutoffGroup =myMols[i].nextCutoffGroup(iterCutoff)){ totalMass = myCutoffGroup->getMass(); - for(cutoffAtom = myCutoffGroup->beginAtom(iterAtom); cutoffAtom != NULL; - cutoffAtom = myCutoffGroup->nextAtom(iterAtom)){ + for(cutoffAtom = myCutoffGroup->beginAtom(iterAtom); + cutoffAtom != NULL; + cutoffAtom = myCutoffGroup->nextAtom(iterAtom)){ mfact.push_back(cutoffAtom->getMass()/totalMass); - groupList.push_back(cutoffAtom->getIndex() + 1); } - - groupStart.push_back(curIndex); - curIndex += myCutoffGroup->getNumAtom(); + } + } - }//end for(myCutoffGroup =myMols[i].beginCutoffGroup(iterCutoff)) - - }//end for(int i = 0; i < numMol; i++) - - ngroup = groupStart.size(); }