| 55 |
|
#include "primitives/Molecule.hpp" |
| 56 |
|
#include "primitives/StuntDouble.hpp" |
| 57 |
|
#include "UseTheForce/DarkSide/neighborLists_interface.h" |
| 58 |
+ |
#include "UseTheForce/doForces_interface.h" |
| 59 |
|
#include "utils/MemoryUtils.hpp" |
| 60 |
|
#include "utils/simError.h" |
| 61 |
|
#include "selection/SelectionManager.hpp" |
| 132 |
|
//equal to the total number of atoms minus number of atoms belong to |
| 133 |
|
//cutoff group defined in meta-data file plus the number of cutoff |
| 134 |
|
//groups defined in meta-data file |
| 135 |
+ |
std::cerr << "nGA = " << nGlobalAtoms_ << "\n"; |
| 136 |
+ |
std::cerr << "nCA = " << nCutoffAtoms << "\n"; |
| 137 |
+ |
std::cerr << "nG = " << nGroups << "\n"; |
| 138 |
+ |
|
| 139 |
|
nGlobalCutoffGroups_ = nGlobalAtoms_ - nCutoffAtoms + nGroups; |
| 140 |
+ |
|
| 141 |
+ |
std::cerr << "nGCG = " << nGlobalCutoffGroups_ << "\n"; |
| 142 |
|
|
| 143 |
|
//every free atom (atom does not belong to rigid bodies) is an |
| 144 |
|
//integrable object therefore the total number of integrable objects |
| 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; |
| 864 |
|
} |
| 865 |
|
} |
| 866 |
|
|
| 867 |
< |
//fill ident array of local atoms (it is actually ident of |
| 821 |
< |
//AtomType, it is so confusing !!!) |
| 822 |
< |
vector<int> identArray; |
| 867 |
> |
// Build the identArray_ |
| 868 |
|
|
| 869 |
< |
//to avoid memory reallocation, reserve enough space identArray |
| 870 |
< |
identArray.reserve(getNAtoms()); |
| 826 |
< |
|
| 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 |
|
|
| 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, |
| 923 |
|
} |
| 924 |
|
|
| 925 |
|
#ifdef IS_MPI |
| 882 |
– |
//SimInfo is responsible for creating localToGlobalAtomIndex and |
| 883 |
– |
//localToGlobalGroupIndex |
| 884 |
– |
vector<int> localToGlobalAtomIndex(getNAtoms(), 0); |
| 885 |
– |
vector<int> localToGlobalCutoffGroupIndex; |
| 926 |
|
mpiSimData parallelData; |
| 927 |
|
|
| 888 |
– |
for (mol = beginMolecule(mi); mol != NULL; mol = nextMolecule(mi)) { |
| 889 |
– |
|
| 890 |
– |
//local index(index in DataStorge) of atom is important |
| 891 |
– |
for (atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) { |
| 892 |
– |
localToGlobalAtomIndex[atom->getLocalIndex()] = atom->getGlobalIndex() + 1; |
| 893 |
– |
} |
| 894 |
– |
|
| 895 |
– |
//local index of cutoff group is trivial, it only depends on the order of travesing |
| 896 |
– |
for (cg = mol->beginCutoffGroup(ci); cg != NULL; cg = mol->nextCutoffGroup(ci)) { |
| 897 |
– |
localToGlobalCutoffGroupIndex.push_back(cg->getGlobalIndex() + 1); |
| 898 |
– |
} |
| 899 |
– |
|
| 900 |
– |
} |
| 901 |
– |
|
| 928 |
|
//fill up mpiSimData struct |
| 929 |
|
parallelData.nMolGlobal = getNGlobalMolecules(); |
| 930 |
|
parallelData.nMolLocal = getNMolecules(); |
| 936 |
|
MPI_Comm_size(MPI_COMM_WORLD, &(parallelData.nProcessors)); |
| 937 |
|
|
| 938 |
|
//pass mpiSimData struct and index arrays to fortran |
| 939 |
< |
setFsimParallel(¶llelData, &(parallelData.nAtomsLocal), |
| 940 |
< |
&localToGlobalAtomIndex[0], &(parallelData.nGroupsLocal), |
| 941 |
< |
&localToGlobalCutoffGroupIndex[0], &isError); |
| 939 |
> |
//setFsimParallel(¶llelData, &(parallelData.nAtomsLocal), |
| 940 |
> |
// &localToGlobalAtomIndex[0], &(parallelData.nGroupsLocal), |
| 941 |
> |
// &localToGlobalCutoffGroupIndex[0], &isError); |
| 942 |
|
|
| 943 |
|
if (isError) { |
| 944 |
|
sprintf(painCave.errMsg, |
| 950 |
|
sprintf(checkPointMsg, " mpiRefresh successful.\n"); |
| 951 |
|
errorCheckPoint(); |
| 952 |
|
#endif |
| 953 |
+ |
|
| 954 |
+ |
initFortranFF(&isError); |
| 955 |
+ |
if (isError) { |
| 956 |
+ |
sprintf(painCave.errMsg, |
| 957 |
+ |
"initFortranFF errror: fortran didn't like something we gave it.\n"); |
| 958 |
+ |
painCave.isFatal = 1; |
| 959 |
+ |
simError(); |
| 960 |
+ |
} |
| 961 |
|
fortranInitialized_ = true; |
| 962 |
|
} |
| 963 |
|
|
| 995 |
|
Molecule* mol; |
| 996 |
|
RigidBody* rb; |
| 997 |
|
Atom* atom; |
| 998 |
+ |
CutoffGroup* cg; |
| 999 |
|
SimInfo::MoleculeIterator mi; |
| 1000 |
|
Molecule::RigidBodyIterator rbIter; |
| 1001 |
< |
Molecule::AtomIterator atomIter;; |
| 1001 |
> |
Molecule::AtomIterator atomIter; |
| 1002 |
> |
Molecule::CutoffGroupIterator cgIter; |
| 1003 |
|
|
| 1004 |
|
for (mol = beginMolecule(mi); mol != NULL; mol = nextMolecule(mi)) { |
| 1005 |
|
|
| 1010 |
|
for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) { |
| 1011 |
|
rb->setSnapshotManager(sman_); |
| 1012 |
|
} |
| 1013 |
+ |
|
| 1014 |
+ |
for (cg = mol->beginCutoffGroup(cgIter); cg != NULL; cg = mol->nextCutoffGroup(cgIter)) { |
| 1015 |
+ |
cg->setSnapshotManager(sman_); |
| 1016 |
+ |
} |
| 1017 |
|
} |
| 1018 |
|
|
| 1019 |
|
} |