ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/SimInfo.cpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/SimInfo.cpp (file contents):
Revision 1212 by chrisfen, Tue Jun 1 17:15:43 2004 UTC vs.
Revision 1218 by gezelter, Wed Jun 2 14:21:54 2004 UTC

# Line 191 | Line 191 | void SimInfo::calcHmatInv( void ) {
191  
192    if( oldOrtho != orthoRhombic ){
193      
194 <    if( orthoRhombic ){
194 >    if( orthoRhombic ) {
195        sprintf( painCave.errMsg,
196 <               "OOPSE is switching from the default Non-Orthorhombic\n"
196 >               "\n\tOOPSE is switching from the default Non-Orthorhombic\n"
197                 "\tto the faster Orthorhombic periodic boundary computations.\n"
198                 "\tThis is usually a good thing, but if you wan't the\n"
199                 "\tNon-Orthorhombic computations, make the orthoBoxTolerance\n"
200                 "\tvariable ( currently set to %G ) smaller.\n",
201                 orthoTolerance);
202 +      painCave.severity = OOPSE_INFO;
203        simError();
204      }
205      else {
206        sprintf( painCave.errMsg,
207 <               "OOPSE is switching from the faster Orthorhombic to the more\n"
207 >               "\n\tOOPSE is switching from the faster Orthorhombic to the more\n"
208                 "\tflexible Non-Orthorhombic periodic boundary computations.\n"
209                 "\tThis is usually because the box has deformed under\n"
210                 "\tNPTf integration. If you wan't to live on the edge with\n"
211                 "\tthe Orthorhombic computations, make the orthoBoxTolerance\n"
212                 "\tvariable ( currently set to %G ) larger.\n",
213                 orthoTolerance);
214 +      painCave.severity = OOPSE_WARNING;
215        simError();
216      }
217    }
# Line 453 | Line 455 | void SimInfo::refreshSim(){
455    
456    isError = 0;
457    
458 <  getFortranGroupArray(this, mfact, ngroup, groupList, groupStart);
458 >  getFortranGroupArrays(this, FglobalGroupMembership, mfact);
459    //it may not be a good idea to pass the address of first element in vector
460    //since c++ standard does not require vector to be stored continuously in meomory
461    //Most of the compilers will organize the memory of vector continuously
462    setFsimulation( &fInfo, &n_global, &n_atoms, identArray, &n_exclude, excl,
463                    &nGlobalExcludes, globalExcludes, molMembershipArray,
464 <                  &mfact[0], &ngroup, &groupList[0], &groupStart[0], &isError);
465 <  
464 >                  &mfact[0], &ngroup, &FglobalGroupMembership[0], &isError);
465 >
466    if( isError ){
467      
468      sprintf( painCave.errMsg,
# Line 504 | Line 506 | void SimInfo::checkCutOffs( void ){
506      
507      if( rCut > maxCutoff ){
508        sprintf( painCave.errMsg,
509 <               "cutoffRadius is too large for the current periodic box.\n"
509 >               "\n\tcutoffRadius is too large for the current periodic box.\n"
510                 "\tCurrent Value of cutoffRadius = %G at time %G\n "
511                 "\tThis is larger than half of at least one of the\n"
512                 "\tperiodic box vectors.  Right now, the Box matrix is:\n"
# Line 516 | Line 518 | void SimInfo::checkCutOffs( void ){
518                 Hmat[0][0], Hmat[0][1], Hmat[0][2],
519                 Hmat[1][0], Hmat[1][1], Hmat[1][2],
520                 Hmat[2][0], Hmat[2][1], Hmat[2][2]);
521 +      painCave.severity = OOPSE_ERROR;
522        painCave.isFatal = 1;
523        simError();
524      }    
525    } else {
526      // initialize this stuff before using it, OK?
527      sprintf( painCave.errMsg,
528 <             "Trying to check cutoffs without a box.\n"
528 >             "\n\tTrying to check cutoffs without a box.\n"
529               "\tOOPSE should have better programmers than that.\n" );
530 +    painCave.severity = OOPSE_ERROR;
531      painCave.isFatal = 1;
532      simError();      
533    }
# Line 567 | Line 571 | GenericData* SimInfo::getProperty(const string& propNa
571   }
572  
573  
574 < void getFortranGroupArray(SimInfo* info, vector<double>& mfact, int& ngroup,
575 <                          vector<int>& groupList, vector<int>& groupStart){
574 > void SimInfo::getFortranGroupArrays(SimInfo* info,
575 >                                    vector<int>& FglobalGroupMembership,
576 >                                    vector<double>& mfact){
577 >  
578    Molecule* myMols;
579    Atom** myAtoms;
580    int numAtom;
575  int curIndex;
581    double mtot;
582    int numMol;
583    int numCutoffGroups;
# Line 584 | Line 589 | void getFortranGroupArray(SimInfo* info, vector<double
589    double totalMass;
590    
591    mfact.clear();
592 <  groupList.clear();
588 <  groupStart.clear();
592 >  FglobalGroupMembership.clear();
593    
590  //Be careful, fortran array begin at 1
591  curIndex = 1;
594  
595 +  // Fix the silly fortran indexing problem
596 + #ifdef IS_MPI
597 +  numAtom = mpiSim->getNAtomsGlobal();
598 + #else
599 +  numAtom = n_atoms;
600 + #endif
601 +  for (int i = 0; i < numAtom; i++)
602 +    FglobalGroupMembership.push_back(globalGroupMembership[i] + 1);
603 +  
604 +
605    myMols = info->molecules;
606    numMol = info->n_mol;
607    for(int i  = 0; i < numMol; i++){
608      numCutoffGroups = myMols[i].getNCutoffGroups();
609 <    for(myCutoffGroup =myMols[i].beginCutoffGroup(iterCutoff); myCutoffGroup != NULL;
610 <                                                  myCutoffGroup =myMols[i].nextCutoffGroup(iterCutoff)){
609 >    for(myCutoffGroup =myMols[i].beginCutoffGroup(iterCutoff);
610 >        myCutoffGroup != NULL;
611 >        myCutoffGroup =myMols[i].nextCutoffGroup(iterCutoff)){
612  
613        totalMass = myCutoffGroup->getMass();
614        
615 <      for(cutoffAtom = myCutoffGroup->beginAtom(iterAtom); cutoffAtom != NULL;
616 <                                           cutoffAtom = myCutoffGroup->nextAtom(iterAtom)){
615 >      for(cutoffAtom = myCutoffGroup->beginAtom(iterAtom);
616 >          cutoffAtom != NULL;
617 >          cutoffAtom = myCutoffGroup->nextAtom(iterAtom)){
618          mfact.push_back(cutoffAtom->getMass()/totalMass);
605 #ifdef IS_MPI        
606        groupList.push_back(cutoffAtom->getGlobalIndex() + 1);
607 #else
608        groupList.push_back(cutoffAtom->getIndex() + 1);
609 #endif
619        }  
620 <                              
621 <      groupStart.push_back(curIndex);
613 <      curIndex += myCutoffGroup->getNumAtom();
620 >    }
621 >  }
622  
615    }//end for(myCutoffGroup =myMols[i].beginCutoffGroup(iterCutoff))
616
617  }//end for(int i  = 0; i < numMol; i++)
618
619
620  //The last cutoff group need more element to indicate the end of the cutoff
621  ngroup = groupStart.size();
623   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines