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 1157 by tim, Tue May 11 20:33:41 2004 UTC vs.
Revision 1167 by tim, Wed May 12 16:38:45 2004 UTC

# Line 453 | Line 453 | void SimInfo::refreshSim(){
453    
454    getFortranGroupArray(this, mfact, ngroup, groupList, groupStart);
455    //it may not be a good idea to pass the address of first element in vector
456 <  //since c++ standard does not require vector to be stored continously in meomory
457 <  //Most of the compilers will organize the memory of vector continously
456 >  //since c++ standard does not require vector to be stored continuously in meomory
457 >  //Most of the compilers will organize the memory of vector continuously
458    setFsimulation( &fInfo, &n_global, &n_atoms, identArray, &n_exclude, excl,
459                    &nGlobalExcludes, globalExcludes, molMembershipArray,
460                    &mfact[0], &ngroup, &groupList[0], &groupStart[0], &isError);
# Line 579 | Line 579 | void getFortranGroupArray(SimInfo* info, vector<double
579    Atom* cutoffAtom;
580    vector<Atom*>::iterator iterAtom;
581    int atomIndex;
582 +  double totalMass;
583    
584    mfact.clear();
585    groupList.clear();
# Line 590 | Line 591 | void getFortranGroupArray(SimInfo* info, vector<double
591    myMols = info->molecules;
592    numMol = info->n_mol;
593    for(int i  = 0; i < numMol; i++){
593    numAtom = myMols[i].getNAtoms();
594    myAtoms = myMols[i].getMyAtoms();
595
596    
597    for(int j = 0; j < numAtom; j++){
598
599    
600 #ifdef IS_MPI      
601      atomIndex = myAtoms[j]->getGlobalIndex();
602 #else
603      atomIndex = myAtoms[j]->getIndex();
604 #endif
605
606      if(myMols[i].belongToCutoffGroup(atomIndex))
607        continue;
608      else{
609        mfact.push_back(myAtoms[j]->getMass());
610        groupList.push_back(myAtoms[j]->getIndex() + 1);
611        groupStart.push_back(curIndex++);  
612      }
613    }
614      
594      numCutoffGroups = myMols[i].getNCutoffGroups();
595      for(myCutoffGroup =myMols[i].beginCutoffGroup(iterCutoff); myCutoffGroup != NULL;
596                                                    myCutoffGroup =myMols[i].nextCutoffGroup(iterCutoff)){
597 +
598 +      totalMass = myCutoffGroup->getMass();
599        
600        for(cutoffAtom = myCutoffGroup->beginAtom(iterAtom); cutoffAtom != NULL;
601 <                                           cutoffAtom = myCutoffGroup->beginAtom(iterAtom)){
601 >                                           cutoffAtom = myCutoffGroup->nextAtom(iterAtom)){
602 >        mfact.push_back(cutoffAtom->getMass()/totalMass);
603          groupList.push_back(cutoffAtom->getIndex() + 1);
604        }  
605                                
606        groupStart.push_back(curIndex);
607        curIndex += myCutoffGroup->getNumAtom();
626    }
627    
628  }
608  
609 +    }//end for(myCutoffGroup =myMols[i].beginCutoffGroup(iterCutoff))
610 +
611 +  }//end for(int i  = 0; i < numMol; i++)
612 +  
613    ngroup = groupStart.size();
614   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines