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 1544 by gezelter, Fri Mar 18 19:31:52 2011 UTC vs.
Revision 1553 by gezelter, Fri Apr 29 17:25:12 2011 UTC

# Line 54 | Line 54
54   #include "math/Vector3.hpp"
55   #include "primitives/Molecule.hpp"
56   #include "primitives/StuntDouble.hpp"
57 #include "UseTheForce/DarkSide/neighborLists_interface.h"
58 #include "UseTheForce/doForces_interface.h"
57   #include "utils/MemoryUtils.hpp"
58   #include "utils/simError.h"
59   #include "selection/SelectionManager.hpp"
60   #include "io/ForceFieldOptions.hpp"
61   #include "UseTheForce/ForceField.hpp"
62   #include "nonbonded/SwitchingFunction.hpp"
65
66 #ifdef IS_MPI
67 #include "UseTheForce/mpiComponentPlan.h"
68 #include "UseTheForce/DarkSide/simParallel_interface.h"
69 #endif
63  
64   using namespace std;
65   namespace OpenMD {
# Line 777 | Line 770 | namespace OpenMD {
770      temp = usesElectrostatic;
771      MPI_Allreduce(&temp, &usesElectrostaticAtoms_, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);
772   #endif
780    fInfo_.SIM_uses_PBC = usesPeriodicBoundaries_;    
781    fInfo_.SIM_uses_DirectionalAtoms = usesDirectionalAtoms_;
782    fInfo_.SIM_uses_MetallicAtoms = usesMetallicAtoms_;
783    fInfo_.SIM_requires_SkipCorrection = usesElectrostaticAtoms_;
784    fInfo_.SIM_requires_SelfCorrection = usesElectrostaticAtoms_;
785    fInfo_.SIM_uses_AtomicVirial = usesAtomicVirial_;
773    }
774  
775 +
776 +  vector<int> SimInfo::getGlobalAtomIndices() {
777 +    SimInfo::MoleculeIterator mi;
778 +    Molecule* mol;
779 +    Molecule::AtomIterator ai;
780 +    Atom* atom;
781 +
782 +    vector<int> GlobalAtomIndices(getNAtoms(), 0);
783 +    
784 +    for (mol = beginMolecule(mi); mol != NULL; mol  = nextMolecule(mi)) {
785 +      
786 +      for (atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) {
787 +        GlobalAtomIndices[atom->getLocalIndex()] = atom->getGlobalIndex();
788 +      }
789 +    }
790 +    return GlobalAtomIndices;
791 +  }
792 +
793 +
794 +  vector<int> SimInfo::getGlobalGroupIndices() {
795 +    SimInfo::MoleculeIterator mi;
796 +    Molecule* mol;
797 +    Molecule::CutoffGroupIterator ci;
798 +    CutoffGroup* cg;
799 +
800 +    vector<int> GlobalGroupIndices;
801 +    
802 +    for (mol = beginMolecule(mi); mol != NULL; mol  = nextMolecule(mi)) {
803 +      
804 +      //local index of cutoff group is trivial, it only depends on the
805 +      //order of travesing
806 +      for (cg = mol->beginCutoffGroup(ci); cg != NULL;
807 +           cg = mol->nextCutoffGroup(ci)) {
808 +        GlobalGroupIndices.push_back(cg->getGlobalIndex());
809 +      }        
810 +    }
811 +    return GlobalGroupIndices;
812 +  }
813 +
814 +
815    void SimInfo::setupFortran() {
816      int isError;
817      int nExclude, nOneTwo, nOneThree, nOneFour;
# Line 853 | Line 880 | namespace OpenMD {
880      int* oneThreeList = oneThreeInteractions_.getPairList();
881      int* oneFourList = oneFourInteractions_.getPairList();
882  
883 <    setFortranSim( &fInfo_, &nGlobalAtoms_, &nAtoms_, &identArray[0],
884 <                   &nExclude, excludeList,
885 <                   &nOneTwo, oneTwoList,
886 <                   &nOneThree, oneThreeList,
887 <                   &nOneFour, oneFourList,
888 <                   &molMembershipArray[0], &mfact[0], &nCutoffGroups_,
889 <                   &fortranGlobalGroupMembership[0], &isError);
883 >    //setFortranSim( &fInfo_, &nGlobalAtoms_, &nAtoms_, &identArray_[0],
884 >    //               &nExclude, excludeList,
885 >    //               &nOneTwo, oneTwoList,
886 >    //               &nOneThree, oneThreeList,
887 >    //               &nOneFour, oneFourList,
888 >    //               &molMembershipArray[0], &mfact[0], &nCutoffGroups_,
889 >    //               &fortranGlobalGroupMembership[0], &isError);
890      
891 <    if( isError ){
892 <      
893 <      sprintf( painCave.errMsg,
894 <               "There was an error setting the simulation information in fortran.\n" );
895 <      painCave.isFatal = 1;
896 <      painCave.severity = OPENMD_ERROR;
897 <      simError();
898 <    }
891 >    // if( isError ){
892 >    //  
893 >    //  sprintf( painCave.errMsg,
894 >    //         "There was an error setting the simulation information in fortran.\n" );
895 >    //  painCave.isFatal = 1;
896 >    //  painCave.severity = OPENMD_ERROR;
897 >    //  simError();
898 >    //}
899      
900      
901 <    sprintf( checkPointMsg,
902 <             "succesfully sent the simulation information to fortran.\n");
901 >    // sprintf( checkPointMsg,
902 >    //          "succesfully sent the simulation information to fortran.\n");
903      
904 <    errorCheckPoint();
904 >    // errorCheckPoint();
905      
906      // Setup number of neighbors in neighbor list if present
907 <    if (simParams_->haveNeighborListNeighbors()) {
908 <      int nlistNeighbors = simParams_->getNeighborListNeighbors();
909 <      setNeighbors(&nlistNeighbors);
910 <    }
907 >    //if (simParams_->haveNeighborListNeighbors()) {
908 >    //  int nlistNeighbors = simParams_->getNeighborListNeighbors();
909 >    //  setNeighbors(&nlistNeighbors);
910 >    //}
911    
912   #ifdef IS_MPI    
913 <    //SimInfo is responsible for creating localToGlobalAtomIndex and
887 <    //localToGlobalGroupIndex
888 <    vector<int> localToGlobalAtomIndex(getNAtoms(), 0);
889 <    vector<int> localToGlobalCutoffGroupIndex;
890 <    mpiSimData parallelData;
913 >    // mpiSimData parallelData;
914  
892    for (mol = beginMolecule(mi); mol != NULL; mol  = nextMolecule(mi)) {
893
894      //local index(index in DataStorge) of atom is important
895      for (atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) {
896        localToGlobalAtomIndex[atom->getLocalIndex()] = atom->getGlobalIndex() + 1;
897      }
898
899      //local index of cutoff group is trivial, it only depends on the order of travesing
900      for (cg = mol->beginCutoffGroup(ci); cg != NULL; cg = mol->nextCutoffGroup(ci)) {
901        localToGlobalCutoffGroupIndex.push_back(cg->getGlobalIndex() + 1);
902      }        
903        
904    }
905
915      //fill up mpiSimData struct
916 <    parallelData.nMolGlobal = getNGlobalMolecules();
917 <    parallelData.nMolLocal = getNMolecules();
918 <    parallelData.nAtomsGlobal = getNGlobalAtoms();
919 <    parallelData.nAtomsLocal = getNAtoms();
920 <    parallelData.nGroupsGlobal = getNGlobalCutoffGroups();
921 <    parallelData.nGroupsLocal = getNCutoffGroups();
922 <    parallelData.myNode = worldRank;
923 <    MPI_Comm_size(MPI_COMM_WORLD, &(parallelData.nProcessors));
916 >    // parallelData.nMolGlobal = getNGlobalMolecules();
917 >    // parallelData.nMolLocal = getNMolecules();
918 >    // parallelData.nAtomsGlobal = getNGlobalAtoms();
919 >    // parallelData.nAtomsLocal = getNAtoms();
920 >    // parallelData.nGroupsGlobal = getNGlobalCutoffGroups();
921 >    // parallelData.nGroupsLocal = getNCutoffGroups();
922 >    // parallelData.myNode = worldRank;
923 >    // MPI_Comm_size(MPI_COMM_WORLD, &(parallelData.nProcessors));
924  
925      //pass mpiSimData struct and index arrays to fortran
926 <    setFsimParallel(&parallelData, &(parallelData.nAtomsLocal),
927 <                    &localToGlobalAtomIndex[0],  &(parallelData.nGroupsLocal),
928 <                    &localToGlobalCutoffGroupIndex[0], &isError);
926 >    //setFsimParallel(&parallelData, &(parallelData.nAtomsLocal),
927 >    //                &localToGlobalAtomIndex[0],  &(parallelData.nGroupsLocal),
928 >    //                &localToGlobalCutoffGroupIndex[0], &isError);
929  
930 <    if (isError) {
931 <      sprintf(painCave.errMsg,
932 <              "mpiRefresh errror: fortran didn't like something we gave it.\n");
933 <      painCave.isFatal = 1;
934 <      simError();
935 <    }
930 >    // if (isError) {
931 >    //   sprintf(painCave.errMsg,
932 >    //           "mpiRefresh errror: fortran didn't like something we gave it.\n");
933 >    //   painCave.isFatal = 1;
934 >    //   simError();
935 >    // }
936  
937 <    sprintf(checkPointMsg, " mpiRefresh successful.\n");
938 <    errorCheckPoint();
937 >    // sprintf(checkPointMsg, " mpiRefresh successful.\n");
938 >    // errorCheckPoint();
939   #endif
940  
941 <    initFortranFF(&isError);
942 <    if (isError) {
943 <      sprintf(painCave.errMsg,
944 <              "initFortranFF errror: fortran didn't like something we gave it.\n");
945 <      painCave.isFatal = 1;
946 <      simError();
947 <    }
948 <    fortranInitialized_ = true;
941 >    // initFortranFF(&isError);
942 >    // if (isError) {
943 >    //   sprintf(painCave.errMsg,
944 >    //           "initFortranFF errror: fortran didn't like something we gave it.\n");
945 >    //   painCave.isFatal = 1;
946 >    //   simError();
947 >    // }
948 >    // fortranInitialized_ = true;
949    }
950  
951    void SimInfo::addProperty(GenericData* genData) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines