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 1143 by gezelter, Wed Apr 28 22:06:29 2004 UTC vs.
Revision 1144 by tim, Sat May 1 18:52:38 2004 UTC

# Line 72 | Line 72 | SimInfo::SimInfo(){
72    has_minimizer = false;
73    the_minimizer =NULL;
74  
75 +  ngroup = 0;
76 +
77    wrapMeSimInfo( this );
78   }
79  
# Line 84 | Line 86 | SimInfo::~SimInfo(){
86    
87    for(i = properties.begin(); i != properties.end(); i++)
88      delete (*i).second;
89 <    
89 >  
90   }
91  
92   void SimInfo::setBox(double newBox[3]) {
# Line 437 | Line 439 | void SimInfo::refreshSim(){
439    //fInfo.SIM_uses_RF = 0;
440    fInfo.SIM_uses_GB = useGB;
441    fInfo.SIM_uses_EAM = useEAM;
440  fInfo.SIM_uses_molecular_cutoffs = useMolecularCutoffs;
442  
443    n_exclude = excludes->getSize();
444    excl = excludes->getFortranArray();
445 <
445 >  
446   #ifdef IS_MPI
447    n_global = mpiSim->getTotAtoms();
448   #else
# Line 449 | Line 450 | void SimInfo::refreshSim(){
450   #endif
451  
452    isError = 0;
453 +
454 + getFortranGroupArray(this, mfact, ngroup, groupList, groupStart);
455  
456    setFsimulation( &fInfo, &n_global, &n_atoms, identArray, &n_exclude, excl,
457 <                  &nGlobalExcludes, globalExcludes, molMembershipArray,
458 <                  &isError );
457 >                                    &nGlobalExcludes, globalExcludes, molMembershipArray,
458 >                                    &mfact[0], &ngroup, &groupList[0], &groupStart[0], &isError );
459  
460    if( isError ){
461  
# Line 590 | Line 593 | GenericData* SimInfo::getProperty(const string& propNa
593    else  
594      return NULL;  
595   }
596 +
597 +
598 + void getFortranGroupArray(SimInfo* info, vector<double>& mfact, int& ngroup,
599 +                                                          vector<int>& groupList, vector<int>& groupStart){
600 +  Molecule* mol;
601 +  int numAtom;
602 +  int curIndex;
603  
604 +  mfact.clear();
605 +  groupList.clear();
606 +  groupStart.clear();
607 +
608 +  //Be careful, fortran array begin at 1
609 +  curIndex = 1;
610 +    
611 +  if(info->useMolecularCutoffs){
612 +    //if using molecular cutoff
613 +    ngroup = info->n_mol;
614 +
615 +    for(int i = 0; i < ngroup; i ++){
616 +      mol = &(info->molecules[i]);
617 +      numAtom = mol->getNAtoms();
618 +      
619 +      for(int j=0; j < numAtom; j++){
620 + #ifdef IS_MPI
621 +        groupList.push_back((info->atoms[i])->getGlobalIndex() + 1);
622 + #else
623 +        groupList.push_back((info->atoms[i])->getIndex() + 1);
624 + #endif
625 +      }//for(int j=0; j < numAtom; j++)
626 +            
627 +      groupStart.push_back(curIndex);
628 +      curIndex += numAtom;
629 +      
630 +    }//end for(int i =0 ; i < ngroup; i++)    
631 +  }
632 +  else{
633 +    //using atomic cutoff, every single atom is just a group
634 +    ngroup = info->n_atoms;
635 +    for(int i =0 ; i < ngroup; i++){
636 +      groupStart.push_back(curIndex++);
637 +
638 + #ifdef IS_MPI
639 +      groupList.push_back((info->atoms[i])->getGlobalIndex() + 1);
640 + #else
641 +      groupList.push_back((info->atoms[i])->getIndex() + 1);
642 + #endif
643 +
644 +    }//end for(int i =0 ; i < ngroup; i++)
645 +
646 +  }//end if (info->useMolecularCutoffs)
647 +
648 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines