63 |
|
#include "utils/MemoryUtils.hpp" |
64 |
|
#include "utils/simError.h" |
65 |
|
#include "selection/SelectionManager.hpp" |
66 |
+ |
#include "io/ForceFieldOptions.hpp" |
67 |
+ |
#include "UseTheForce/ForceField.hpp" |
68 |
|
|
69 |
|
#ifdef IS_MPI |
70 |
|
#include "UseTheForce/mpiComponentPlan.h" |
82 |
|
return result; |
83 |
|
} |
84 |
|
|
85 |
< |
SimInfo::SimInfo(MakeStamps* stamps, std::vector<std::pair<MoleculeStamp*, int> >& molStampPairs, |
86 |
< |
ForceField* ff, Globals* simParams) : |
85 |
< |
stamps_(stamps), forceField_(ff), simParams_(simParams), |
85 |
> |
SimInfo::SimInfo(ForceField* ff, Globals* simParams) : |
86 |
> |
forceField_(ff), simParams_(simParams), |
87 |
|
ndf_(0), ndfRaw_(0), ndfTrans_(0), nZconstraint_(0), |
88 |
|
nGlobalMols_(0), nGlobalAtoms_(0), nGlobalCutoffGroups_(0), |
89 |
|
nGlobalIntegrableObjects_(0), nGlobalRigidBodies_(0), |
91 |
|
nIntegrableObjects_(0), nCutoffGroups_(0), nConstraints_(0), |
92 |
|
sman_(NULL), fortranInitialized_(false) { |
93 |
|
|
93 |
– |
|
94 |
– |
std::vector<std::pair<MoleculeStamp*, int> >::iterator i; |
94 |
|
MoleculeStamp* molStamp; |
95 |
|
int nMolWithSameStamp; |
96 |
|
int nCutoffAtoms = 0; // number of atoms belong to cutoff groups |
98 |
|
CutoffGroupStamp* cgStamp; |
99 |
|
RigidBodyStamp* rbStamp; |
100 |
|
int nRigidAtoms = 0; |
101 |
< |
|
102 |
< |
for (i = molStampPairs.begin(); i !=molStampPairs.end(); ++i) { |
103 |
< |
molStamp = i->first; |
104 |
< |
nMolWithSameStamp = i->second; |
101 |
> |
std::vector<Component*> components = simParams->getComponents(); |
102 |
> |
|
103 |
> |
for (std::vector<Component*>::iterator i = components.begin(); i !=components.end(); ++i) { |
104 |
> |
molStamp = (*i)->getMoleculeStamp(); |
105 |
> |
nMolWithSameStamp = (*i)->getNMol(); |
106 |
|
|
107 |
|
addMoleculeStamp(molStamp, nMolWithSameStamp); |
108 |
|
|
109 |
|
//calculate atoms in molecules |
110 |
|
nGlobalAtoms_ += molStamp->getNAtoms() *nMolWithSameStamp; |
111 |
|
|
112 |
– |
|
112 |
|
//calculate atoms in cutoff groups |
113 |
|
int nAtomsInGroups = 0; |
114 |
|
int nCutoffGroupsInStamp = molStamp->getNCutoffGroups(); |
115 |
|
|
116 |
|
for (int j=0; j < nCutoffGroupsInStamp; j++) { |
117 |
< |
cgStamp = molStamp->getCutoffGroup(j); |
117 |
> |
cgStamp = molStamp->getCutoffGroupStamp(j); |
118 |
|
nAtomsInGroups += cgStamp->getNMembers(); |
119 |
|
} |
120 |
|
|
127 |
|
int nRigidBodiesInStamp = molStamp->getNRigidBodies(); |
128 |
|
|
129 |
|
for (int j=0; j < nRigidBodiesInStamp; j++) { |
130 |
< |
rbStamp = molStamp->getRigidBody(j); |
130 |
> |
rbStamp = molStamp->getRigidBodyStamp(j); |
131 |
|
nAtomsInRigidBodies += rbStamp->getNMembers(); |
132 |
|
} |
133 |
|
|
166 |
|
} |
167 |
|
molecules_.clear(); |
168 |
|
|
170 |
– |
delete stamps_; |
169 |
|
delete sman_; |
170 |
|
delete simParams_; |
171 |
|
delete forceField_; |
272 |
|
} |
273 |
|
} |
274 |
|
|
275 |
< |
}//end for (integrableObject) |
276 |
< |
}// end for (mol) |
275 |
> |
} |
276 |
> |
} |
277 |
|
|
278 |
|
// n_constraints is local, so subtract them on each processor |
279 |
|
ndf_local -= nConstraints_; |
922 |
|
|
923 |
|
void SimInfo::setupCutoff() { |
924 |
|
|
925 |
+ |
ForceFieldOptions& forceFieldOptions_ = forceField_->getForceFieldOptions(); |
926 |
+ |
|
927 |
|
// Check the cutoff policy |
928 |
< |
int cp = TRADITIONAL_CUTOFF_POLICY; |
929 |
< |
if (simParams_->haveCutoffPolicy()) { |
930 |
< |
std::string myPolicy = simParams_->getCutoffPolicy(); |
928 |
> |
int cp = TRADITIONAL_CUTOFF_POLICY; // Set to traditional by default |
929 |
> |
|
930 |
> |
std::string myPolicy; |
931 |
> |
if (forceFieldOptions_.haveCutoffPolicy()){ |
932 |
> |
myPolicy = forceFieldOptions_.getCutoffPolicy(); |
933 |
> |
}else if (simParams_->haveCutoffPolicy()) { |
934 |
> |
myPolicy = simParams_->getCutoffPolicy(); |
935 |
> |
} |
936 |
> |
|
937 |
> |
if (!myPolicy.empty()){ |
938 |
|
toUpper(myPolicy); |
939 |
|
if (myPolicy == "MIX") { |
940 |
|
cp = MIX_CUTOFF_POLICY; |
1098 |
|
} |
1099 |
|
|
1100 |
|
// let's pass some summation method variables to fortran |
1101 |
< |
setElectrostaticSummationMethod( &esm ); |
1102 |
< |
notifyFortranElectrostaticMethod( &esm ); |
1101 |
> |
setElectrostaticSumMethod( &esm ); |
1102 |
> |
setFortranElectrostaticMethod( &esm ); |
1103 |
|
setScreeningMethod( &sm ); |
1104 |
|
setDampingAlpha( &alphaVal ); |
1105 |
|
setReactionFieldDielectric( &dielectric ); |