53 |
|
#include "brains/SimInfo.hpp" |
54 |
|
#include "math/Vector3.hpp" |
55 |
|
#include "primitives/Molecule.hpp" |
56 |
+ |
#include "primitives/StuntDouble.hpp" |
57 |
|
#include "UseTheForce/fCutoffPolicy.h" |
58 |
|
#include "UseTheForce/DarkSide/fElectrostaticSummationMethod.h" |
59 |
|
#include "UseTheForce/DarkSide/fElectrostaticScreeningMethod.h" |
60 |
|
#include "UseTheForce/DarkSide/fSwitchingFunctionType.h" |
61 |
|
#include "UseTheForce/doForces_interface.h" |
62 |
+ |
#include "UseTheForce/DarkSide/neighborLists_interface.h" |
63 |
|
#include "UseTheForce/DarkSide/electrostatic_interface.h" |
64 |
|
#include "UseTheForce/DarkSide/switcheroo_interface.h" |
65 |
|
#include "utils/MemoryUtils.hpp" |
67 |
|
#include "selection/SelectionManager.hpp" |
68 |
|
#include "io/ForceFieldOptions.hpp" |
69 |
|
#include "UseTheForce/ForceField.hpp" |
70 |
+ |
|
71 |
|
|
72 |
|
#ifdef IS_MPI |
73 |
|
#include "UseTheForce/mpiComponentPlan.h" |
602 |
|
//setup fortran force field |
603 |
|
/** @deprecate */ |
604 |
|
int isError = 0; |
605 |
+ |
|
606 |
+ |
setupCutoff(); |
607 |
|
|
608 |
|
setupElectrostaticSummationMethod( isError ); |
609 |
|
setupSwitchingFunction(); |
615 |
|
painCave.isFatal = 1; |
616 |
|
simError(); |
617 |
|
} |
613 |
– |
|
614 |
– |
|
615 |
– |
setupCutoff(); |
618 |
|
|
619 |
|
calcNdf(); |
620 |
|
calcNdfRaw(); |
671 |
|
// set the useRF logical |
672 |
|
useRF = 0; |
673 |
|
useSF = 0; |
674 |
+ |
useSP = 0; |
675 |
|
|
676 |
|
|
677 |
|
if (simParams_->haveElectrostaticSummationMethod()) { |
678 |
|
std::string myMethod = simParams_->getElectrostaticSummationMethod(); |
679 |
|
toUpper(myMethod); |
680 |
|
if (myMethod == "REACTION_FIELD"){ |
681 |
< |
useRF=1; |
681 |
> |
useRF = 1; |
682 |
|
} else if (myMethod == "SHIFTED_FORCE"){ |
683 |
|
useSF = 1; |
684 |
|
} else if (myMethod == "SHIFTED_POTENTIAL"){ |
786 |
|
fInfo_.SIM_uses_SF = useSF; |
787 |
|
fInfo_.SIM_uses_SP = useSP; |
788 |
|
fInfo_.SIM_uses_BoxDipole = useBoxDipole; |
786 |
– |
|
787 |
– |
if( myMethod == "REACTION_FIELD") { |
788 |
– |
|
789 |
– |
if (simParams_->haveDielectric()) { |
790 |
– |
fInfo_.dielect = simParams_->getDielectric(); |
791 |
– |
} else { |
792 |
– |
sprintf(painCave.errMsg, |
793 |
– |
"SimSetup Error: No Dielectric constant was set.\n" |
794 |
– |
"\tYou are trying to use Reaction Field without" |
795 |
– |
"\tsetting a dielectric constant!\n"); |
796 |
– |
painCave.isFatal = 1; |
797 |
– |
simError(); |
798 |
– |
} |
799 |
– |
} |
800 |
– |
|
789 |
|
} |
790 |
|
|
791 |
|
void SimInfo::setupFortranSim() { |
870 |
|
"succesfully sent the simulation information to fortran.\n"); |
871 |
|
MPIcheckPoint(); |
872 |
|
#endif // is_mpi |
873 |
+ |
|
874 |
+ |
// Setup number of neighbors in neighbor list if present |
875 |
+ |
if (simParams_->haveNeighborListNeighbors()) { |
876 |
+ |
int nlistNeighbors = simParams_->getNeighborListNeighbors(); |
877 |
+ |
setNeighbors(&nlistNeighbors); |
878 |
+ |
} |
879 |
+ |
|
880 |
+ |
|
881 |
|
} |
882 |
|
|
883 |
|
|
1069 |
|
int sm = UNDAMPED; |
1070 |
|
RealType alphaVal; |
1071 |
|
RealType dielectric; |
1072 |
< |
|
1072 |
> |
|
1073 |
|
errorOut = isError; |
1078 |
– |
alphaVal = simParams_->getDampingAlpha(); |
1079 |
– |
dielectric = simParams_->getDielectric(); |
1074 |
|
|
1075 |
|
if (simParams_->haveElectrostaticSummationMethod()) { |
1076 |
|
std::string myMethod = simParams_->getElectrostaticSummationMethod(); |
1087 |
|
if (myMethod == "SHIFTED_FORCE") { |
1088 |
|
esm = SHIFTED_FORCE; |
1089 |
|
} else { |
1090 |
< |
if (myMethod == "REACTION_FIELD") { |
1090 |
> |
if (myMethod == "REACTION_FIELD") { |
1091 |
|
esm = REACTION_FIELD; |
1092 |
+ |
dielectric = simParams_->getDielectric(); |
1093 |
+ |
if (!simParams_->haveDielectric()) { |
1094 |
+ |
// throw warning |
1095 |
+ |
sprintf( painCave.errMsg, |
1096 |
+ |
"SimInfo warning: dielectric was not specified in the input file\n\tfor the reaction field correction method.\n" |
1097 |
+ |
"\tA default value of %f will be used for the dielectric.\n", dielectric); |
1098 |
+ |
painCave.isFatal = 0; |
1099 |
+ |
simError(); |
1100 |
+ |
} |
1101 |
|
} else { |
1102 |
|
// throw error |
1103 |
|
sprintf( painCave.errMsg, |
1124 |
|
if (myScreen == "DAMPED") { |
1125 |
|
sm = DAMPED; |
1126 |
|
if (!simParams_->haveDampingAlpha()) { |
1127 |
< |
//throw error |
1127 |
> |
// first set a cutoff dependent alpha value |
1128 |
> |
// we assume alpha depends linearly with rcut from 0 to 20.5 ang |
1129 |
> |
alphaVal = 0.5125 - rcut_* 0.025; |
1130 |
> |
// for values rcut > 20.5, alpha is zero |
1131 |
> |
if (alphaVal < 0) alphaVal = 0; |
1132 |
> |
|
1133 |
> |
// throw warning |
1134 |
|
sprintf( painCave.errMsg, |
1135 |
|
"SimInfo warning: dampingAlpha was not specified in the input file.\n" |
1136 |
< |
"\tA default value of %f (1/ang) will be used.\n", alphaVal); |
1136 |
> |
"\tA default value of %f (1/ang) will be used for the cutoff of\n\t%f (ang).\n", alphaVal, rcut_); |
1137 |
|
painCave.isFatal = 0; |
1138 |
|
simError(); |
1139 |
+ |
} else { |
1140 |
+ |
alphaVal = simParams_->getDampingAlpha(); |
1141 |
|
} |
1142 |
+ |
|
1143 |
|
} else { |
1144 |
|
// throw error |
1145 |
|
sprintf( painCave.errMsg, |
1448 |
|
return angularMomentum; |
1449 |
|
} |
1450 |
|
|
1451 |
< |
|
1451 |
> |
StuntDouble* SimInfo::getIOIndexToIntegrableObject(int index) { |
1452 |
> |
return IOIndexToIntegrableObject.at(index); |
1453 |
> |
} |
1454 |
> |
|
1455 |
> |
void SimInfo::setIOIndexToIntegrableObject(const std::vector<StuntDouble*>& v) { |
1456 |
> |
IOIndexToIntegrableObject= v; |
1457 |
> |
} |
1458 |
> |
|
1459 |
> |
/* Returns the Volume of the simulation based on a ellipsoid with semi-axes |
1460 |
> |
based on the radius of gyration V=4/3*Pi*R_1*R_2*R_3 |
1461 |
> |
where R_i are related to the principle inertia moments R_i = sqrt(C*I_i/N), this reduces to |
1462 |
> |
V = 4/3*Pi*(C/N)^3/2*sqrt(det(I)). See S.E. Baltazar et. al. Comp. Mat. Sci. 37 (2006) 526-536. |
1463 |
> |
*/ |
1464 |
> |
void SimInfo::getGyrationalVolume(RealType &volume){ |
1465 |
> |
Mat3x3d intTensor; |
1466 |
> |
RealType det; |
1467 |
> |
Vector3d dummyAngMom; |
1468 |
> |
RealType sysconstants; |
1469 |
> |
RealType geomCnst; |
1470 |
> |
|
1471 |
> |
geomCnst = 3.0/2.0; |
1472 |
> |
/* Get the inertial tensor and angular momentum for free*/ |
1473 |
> |
getInertiaTensor(intTensor,dummyAngMom); |
1474 |
> |
|
1475 |
> |
det = intTensor.determinant(); |
1476 |
> |
sysconstants = geomCnst/(RealType)nGlobalIntegrableObjects_; |
1477 |
> |
volume = 4.0/3.0*NumericConstant::PI*pow(sysconstants,3.0/2.0)*sqrt(det); |
1478 |
> |
return; |
1479 |
> |
} |
1480 |
> |
|
1481 |
> |
void SimInfo::getGyrationalVolume(RealType &volume, RealType &detI){ |
1482 |
> |
Mat3x3d intTensor; |
1483 |
> |
Vector3d dummyAngMom; |
1484 |
> |
RealType sysconstants; |
1485 |
> |
RealType geomCnst; |
1486 |
> |
|
1487 |
> |
geomCnst = 3.0/2.0; |
1488 |
> |
/* Get the inertial tensor and angular momentum for free*/ |
1489 |
> |
getInertiaTensor(intTensor,dummyAngMom); |
1490 |
> |
|
1491 |
> |
detI = intTensor.determinant(); |
1492 |
> |
sysconstants = geomCnst/(RealType)nGlobalIntegrableObjects_; |
1493 |
> |
volume = 4.0/3.0*NumericConstant::PI*pow(sysconstants,3.0/2.0)*sqrt(detI); |
1494 |
> |
return; |
1495 |
> |
} |
1496 |
> |
/* |
1497 |
> |
void SimInfo::setStuntDoubleFromGlobalIndex(std::vector<StuntDouble*> v) { |
1498 |
> |
assert( v.size() == nAtoms_ + nRigidBodies_); |
1499 |
> |
sdByGlobalIndex_ = v; |
1500 |
> |
} |
1501 |
> |
|
1502 |
> |
StuntDouble* SimInfo::getStuntDoubleFromGlobalIndex(int index) { |
1503 |
> |
//assert(index < nAtoms_ + nRigidBodies_); |
1504 |
> |
return sdByGlobalIndex_.at(index); |
1505 |
> |
} |
1506 |
> |
*/ |
1507 |
|
}//end namespace oopse |
1508 |
|
|