ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/brains/SimInfo.cpp
(Generate patch)

Comparing branches/development/src/brains/SimInfo.cpp (file contents):
Revision 1540 by gezelter, Mon Jan 17 21:34:36 2011 UTC vs.
Revision 1549 by gezelter, Wed Apr 27 18:38:15 2011 UTC

# Line 783 | Line 783 | namespace OpenMD {
783      fInfo_.SIM_requires_SkipCorrection = usesElectrostaticAtoms_;
784      fInfo_.SIM_requires_SelfCorrection = usesElectrostaticAtoms_;
785      fInfo_.SIM_uses_AtomicVirial = usesAtomicVirial_;
786 +  }
787 +
788 +
789 +  vector<int> SimInfo::getGlobalAtomIndices() {
790 +    SimInfo::MoleculeIterator mi;
791 +    Molecule* mol;
792 +    Molecule::AtomIterator ai;
793 +    Atom* atom;
794 +
795 +    vector<int> GlobalAtomIndices(getNAtoms(), 0);
796 +    
797 +    for (mol = beginMolecule(mi); mol != NULL; mol  = nextMolecule(mi)) {
798 +      
799 +      for (atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) {
800 +        GlobalAtomIndices[atom->getLocalIndex()] = atom->getGlobalIndex();
801 +      }
802 +    }
803 +    return GlobalAtomIndices;
804 +  }
805 +
806 +
807 +  vector<int> SimInfo::getGlobalGroupIndices() {
808 +    SimInfo::MoleculeIterator mi;
809 +    Molecule* mol;
810 +    Molecule::CutoffGroupIterator ci;
811 +    CutoffGroup* cg;
812 +
813 +    vector<int> GlobalGroupIndices;
814 +    
815 +    for (mol = beginMolecule(mi); mol != NULL; mol  = nextMolecule(mi)) {
816 +      
817 +      //local index of cutoff group is trivial, it only depends on the
818 +      //order of travesing
819 +      for (cg = mol->beginCutoffGroup(ci); cg != NULL;
820 +           cg = mol->nextCutoffGroup(ci)) {
821 +        GlobalGroupIndices.push_back(cg->getGlobalIndex());
822 +      }        
823 +    }
824 +    return GlobalGroupIndices;
825    }
826  
827 +
828    void SimInfo::setupFortran() {
829      int isError;
830      int nExclude, nOneTwo, nOneThree, nOneFour;
# Line 824 | Line 864 | namespace OpenMD {
864        }      
865      }
866  
867 <    //fill ident array of local atoms (it is actually ident of
828 <    //AtomType, it is so confusing !!!)
829 <    vector<int> identArray;
867 >    // Build the identArray_
868  
869 <    //to avoid memory reallocation, reserve enough space identArray
870 <    identArray.reserve(getNAtoms());
833 <    
869 >    identArray_.clear();
870 >    identArray_.reserve(getNAtoms());    
871      for(mol = beginMolecule(mi); mol != NULL; mol = nextMolecule(mi)) {        
872        for(atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) {
873 <        identArray.push_back(atom->getIdent());
873 >        identArray_.push_back(atom->getIdent());
874        }
875      }    
876  
# Line 856 | Line 893 | namespace OpenMD {
893      int* oneThreeList = oneThreeInteractions_.getPairList();
894      int* oneFourList = oneFourInteractions_.getPairList();
895  
896 <    setFortranSim( &fInfo_, &nGlobalAtoms_, &nAtoms_, &identArray[0],
896 >    setFortranSim( &fInfo_, &nGlobalAtoms_, &nAtoms_, &identArray_[0],
897                     &nExclude, excludeList,
898                     &nOneTwo, oneTwoList,
899                     &nOneThree, oneThreeList,
# Line 886 | Line 923 | namespace OpenMD {
923      }
924    
925   #ifdef IS_MPI    
889    //SimInfo is responsible for creating localToGlobalAtomIndex and
890    //localToGlobalGroupIndex
891    vector<int> localToGlobalAtomIndex(getNAtoms(), 0);
892    vector<int> localToGlobalCutoffGroupIndex;
926      mpiSimData parallelData;
927  
895    for (mol = beginMolecule(mi); mol != NULL; mol  = nextMolecule(mi)) {
896
897      //local index(index in DataStorge) of atom is important
898      for (atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) {
899        localToGlobalAtomIndex[atom->getLocalIndex()] = atom->getGlobalIndex() + 1;
900      }
901
902      //local index of cutoff group is trivial, it only depends on the order of travesing
903      for (cg = mol->beginCutoffGroup(ci); cg != NULL; cg = mol->nextCutoffGroup(ci)) {
904        localToGlobalCutoffGroupIndex.push_back(cg->getGlobalIndex() + 1);
905      }        
906        
907    }
908
928      //fill up mpiSimData struct
929      parallelData.nMolGlobal = getNGlobalMolecules();
930      parallelData.nMolLocal = getNMolecules();
# Line 917 | Line 936 | namespace OpenMD {
936      MPI_Comm_size(MPI_COMM_WORLD, &(parallelData.nProcessors));
937  
938      //pass mpiSimData struct and index arrays to fortran
939 <    setFsimParallel(&parallelData, &(parallelData.nAtomsLocal),
940 <                    &localToGlobalAtomIndex[0],  &(parallelData.nGroupsLocal),
941 <                    &localToGlobalCutoffGroupIndex[0], &isError);
939 >    //setFsimParallel(&parallelData, &(parallelData.nAtomsLocal),
940 >    //                &localToGlobalAtomIndex[0],  &(parallelData.nGroupsLocal),
941 >    //                &localToGlobalCutoffGroupIndex[0], &isError);
942  
943      if (isError) {
944        sprintf(painCave.errMsg,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines