52 |
|
#include "brains/SimInfo.hpp" |
53 |
|
#include "math/Vector3.hpp" |
54 |
|
#include "primitives/Molecule.hpp" |
55 |
+ |
#include "UseTheForce/fCutoffPolicy.h" |
56 |
|
#include "UseTheForce/doForces_interface.h" |
57 |
|
#include "UseTheForce/notifyCutoffs_interface.h" |
58 |
|
#include "utils/MemoryUtils.hpp" |
463 |
|
//setup fortran force field |
464 |
|
/** @deprecate */ |
465 |
|
int isError = 0; |
466 |
< |
initFortranFF( &fInfo_.SIM_uses_RF , &isError ); |
466 |
> |
initFortranFF( &fInfo_.SIM_uses_RF, &fInfo_.SIM_uses_UW, |
467 |
> |
&fInfo_.SIM_uses_DW, &isError ); |
468 |
|
if(isError){ |
469 |
|
sprintf( painCave.errMsg, |
470 |
|
"ForceField error: There was an error initializing the forceField in fortran.\n" ); |
521 |
|
//usePBC and useRF are from simParams |
522 |
|
int usePBC = simParams_->getPBC(); |
523 |
|
int useRF = simParams_->getUseRF(); |
524 |
+ |
int useUW = simParams_->getUseUndampedWolf(); |
525 |
+ |
int useDW = simParams_->getUseDampedWolf(); |
526 |
|
|
527 |
|
//loop over all of the atom types |
528 |
|
for (i = atomTypes.begin(); i != atomTypes.end(); ++i) { |
587 |
|
|
588 |
|
temp = useRF; |
589 |
|
MPI_Allreduce(&temp, &useRF, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD); |
590 |
+ |
|
591 |
+ |
temp = useUW; |
592 |
+ |
MPI_Allreduce(&temp, &useUW, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD); |
593 |
+ |
|
594 |
+ |
temp = useDW; |
595 |
+ |
MPI_Allreduce(&temp, &useDW, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD); |
596 |
|
|
597 |
|
#endif |
598 |
|
|
609 |
|
fInfo_.SIM_uses_Shapes = useShape; |
610 |
|
fInfo_.SIM_uses_FLARB = useFLARB; |
611 |
|
fInfo_.SIM_uses_RF = useRF; |
612 |
+ |
fInfo_.SIM_uses_UW = useUW; |
613 |
+ |
fInfo_.SIM_uses_DW = useDW; |
614 |
|
|
615 |
|
if( fInfo_.SIM_uses_Dipoles && fInfo_.SIM_uses_RF) { |
616 |
|
|
842 |
|
} |
843 |
|
} |
844 |
|
|
845 |
< |
void SimInfo::setupCutoff() { |
845 |
> |
void SimInfo::setupCutoff() { |
846 |
|
getCutoff(rcut_, rsw_); |
847 |
|
double rnblist = rcut_ + 1; // skin of neighbor list |
848 |
|
|
849 |
|
//Pass these cutoff radius etc. to fortran. This function should be called once and only once |
850 |
< |
notifyFortranCutoffs(&rcut_, &rsw_, &rnblist); |
850 |
> |
|
851 |
> |
int cp = TRADITIONAL_CUTOFF_POLICY; |
852 |
> |
if (simParams_->haveCutoffPolicy()) { |
853 |
> |
std::string myPolicy = simParams_->getCutoffPolicy(); |
854 |
> |
if (myPolicy == "MIX") { |
855 |
> |
cp = MIX_CUTOFF_POLICY; |
856 |
> |
} else { |
857 |
> |
if (myPolicy == "MAX") { |
858 |
> |
cp = MAX_CUTOFF_POLICY; |
859 |
> |
} else { |
860 |
> |
if (myPolicy == "TRADITIONAL") { |
861 |
> |
cp = TRADITIONAL_CUTOFF_POLICY; |
862 |
> |
} else { |
863 |
> |
// throw error |
864 |
> |
sprintf( painCave.errMsg, |
865 |
> |
"SimInfo error: Unknown cutoffPolicy. (Input file specified %s .)\n\tcutoffPolicy must be one of: \"Mix\", \"Max\", or \"Traditional\".", myPolicy.c_str() ); |
866 |
> |
painCave.isFatal = 1; |
867 |
> |
simError(); |
868 |
> |
} |
869 |
> |
} |
870 |
> |
} |
871 |
> |
} |
872 |
> |
notifyFortranCutoffs(&rcut_, &rsw_, &rnblist, &cp); |
873 |
|
} |
874 |
|
|
875 |
|
void SimInfo::addProperty(GenericData* genData) { |
1015 |
|
|
1016 |
|
/* |
1017 |
|
Return intertia tensor for entire system and angular momentum Vector. |
1018 |
+ |
|
1019 |
+ |
|
1020 |
+ |
[ Ixx -Ixy -Ixz ] |
1021 |
+ |
J =| -Iyx Iyy -Iyz | |
1022 |
+ |
[ -Izx -Iyz Izz ] |
1023 |
|
*/ |
1024 |
|
|
1025 |
|
void SimInfo::getInertiaTensor(Mat3x3d &inertiaTensor, Vector3d &angularMomentum){ |
1071 |
|
inertiaTensor(0,1) = -xy; |
1072 |
|
inertiaTensor(0,2) = -xz; |
1073 |
|
inertiaTensor(1,0) = -xy; |
1074 |
< |
inertiaTensor(2,0) = xx + zz; |
1074 |
> |
inertiaTensor(1,1) = xx + zz; |
1075 |
|
inertiaTensor(1,2) = -yz; |
1076 |
|
inertiaTensor(2,0) = -xz; |
1077 |
|
inertiaTensor(2,1) = -yz; |
1099 |
|
SimInfo::MoleculeIterator i; |
1100 |
|
Molecule* mol; |
1101 |
|
|
1102 |
< |
Vector3d thisq(0.0); |
1103 |
< |
Vector3d thisv(0.0); |
1102 |
> |
Vector3d thisr(0.0); |
1103 |
> |
Vector3d thisp(0.0); |
1104 |
|
|
1105 |
< |
double thisMass = 0.0; |
1105 |
> |
double thisMass; |
1106 |
|
|
1107 |
|
for (mol = beginMolecule(i); mol != NULL; mol = nextMolecule(i)) { |
1108 |
< |
thisq = mol->getCom()-com; |
1109 |
< |
thisv = mol->getComVel()-comVel; |
1110 |
< |
thisMass = mol->getMass(); |
1072 |
< |
angularMomentum += cross( thisq, thisv ) * thisMass; |
1108 |
> |
thisMass = mol->getMass(); |
1109 |
> |
thisr = mol->getCom()-com; |
1110 |
> |
thisp = (mol->getComVel()-comVel)*thisMass; |
1111 |
|
|
1112 |
+ |
angularMomentum += cross( thisr, thisp ); |
1113 |
+ |
|
1114 |
|
} |
1115 |
|
|
1116 |
|
#ifdef IS_MPI |