# | Line 71 | Line 71 | namespace OpenMD { | |
---|---|---|
71 | nGlobalIntegrableObjects_(0), nGlobalRigidBodies_(0), | |
72 | nAtoms_(0), nBonds_(0), nBends_(0), nTorsions_(0), nInversions_(0), | |
73 | nRigidBodies_(0), nIntegrableObjects_(0), nCutoffGroups_(0), | |
74 | < | nConstraints_(0), sman_(NULL), fortranInitialized_(false), |
74 | > | nConstraints_(0), sman_(NULL), topologyDone_(false), |
75 | calcBoxDipole_(false), useAtomicVirial_(true) { | |
76 | ||
77 | MoleculeStamp* molStamp; | |
# | Line 812 | Line 812 | namespace OpenMD { | |
812 | } | |
813 | ||
814 | ||
815 | < | void SimInfo::setupFortran() { |
816 | < | int isError; |
815 | > | void SimInfo::prepareTopology() { |
816 | int nExclude, nOneTwo, nOneThree, nOneFour; | |
818 | – | vector<int> fortranGlobalGroupMembership; |
819 | – | |
820 | – | isError = 0; |
821 | – | |
822 | – | //globalGroupMembership_ is filled by SimCreator |
823 | – | for (int i = 0; i < nGlobalAtoms_; i++) { |
824 | – | fortranGlobalGroupMembership.push_back(globalGroupMembership_[i] + 1); |
825 | – | } |
817 | ||
818 | //calculate mass ratio of cutoff group | |
828 | – | vector<RealType> mfact; |
819 | SimInfo::MoleculeIterator mi; | |
820 | Molecule* mol; | |
821 | Molecule::CutoffGroupIterator ci; | |
# | Line 834 | Line 824 | namespace OpenMD { | |
824 | Atom* atom; | |
825 | RealType totalMass; | |
826 | ||
827 | < | //to avoid memory reallocation, reserve enough space for mfact |
828 | < | mfact.reserve(getNCutoffGroups()); |
827 | > | //to avoid memory reallocation, reserve enough space for massFactors_ |
828 | > | massFactors_.clear(); |
829 | > | massFactors_.reserve(getNCutoffGroups()); |
830 | ||
831 | for(mol = beginMolecule(mi); mol != NULL; mol = nextMolecule(mi)) { | |
832 | < | for (cg = mol->beginCutoffGroup(ci); cg != NULL; cg = mol->nextCutoffGroup(ci)) { |
832 | > | for (cg = mol->beginCutoffGroup(ci); cg != NULL; |
833 | > | cg = mol->nextCutoffGroup(ci)) { |
834 | ||
835 | totalMass = cg->getMass(); | |
836 | for(atom = cg->beginAtom(ai); atom != NULL; atom = cg->nextAtom(ai)) { | |
837 | // Check for massless groups - set mfact to 1 if true | |
838 | if (totalMass != 0) | |
839 | < | mfact.push_back(atom->getMass()/totalMass); |
839 | > | massFactors_.push_back(atom->getMass()/totalMass); |
840 | else | |
841 | < | mfact.push_back( 1.0 ); |
841 | > | massFactors_.push_back( 1.0 ); |
842 | } | |
843 | } | |
844 | } | |
# | Line 860 | Line 852 | namespace OpenMD { | |
852 | identArray_.push_back(atom->getIdent()); | |
853 | } | |
854 | } | |
863 | – | |
864 | – | //fill molMembershipArray |
865 | – | //molMembershipArray is filled by SimCreator |
866 | – | vector<int> molMembershipArray(nGlobalAtoms_); |
867 | – | for (int i = 0; i < nGlobalAtoms_; i++) { |
868 | – | molMembershipArray[i] = globalMolMembership_[i] + 1; |
869 | – | } |
855 | ||
856 | < | //setup fortran simulation |
856 | > | //scan topology |
857 | ||
858 | nExclude = excludedInteractions_.getSize(); | |
859 | nOneTwo = oneTwoInteractions_.getSize(); | |
# | Line 888 | Line 873 | namespace OpenMD { | |
873 | // &molMembershipArray[0], &mfact[0], &nCutoffGroups_, | |
874 | // &fortranGlobalGroupMembership[0], &isError); | |
875 | ||
876 | < | // 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"); |
903 | < | |
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 | < | //} |
911 | < | |
912 | < | #ifdef IS_MPI |
913 | < | // mpiSimData parallelData; |
914 | < | |
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)); |
924 | < | |
925 | < | //pass mpiSimData struct and index arrays to fortran |
926 | < | //setFsimParallel(¶llelData, &(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 | < | // } |
936 | < | |
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; |
876 | > | topologyDone_ = true; |
877 | } | |
878 | ||
879 | void SimInfo::addProperty(GenericData* genData) { |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |