| 52 |
|
#include "brains/SimInfo.hpp" |
| 53 |
|
#include "math/Vector3.hpp" |
| 54 |
|
#include "primitives/Molecule.hpp" |
| 55 |
+ |
#include "UseTheForce/fCutoffPolicy.h" |
| 56 |
+ |
#include "UseTheForce/DarkSide/fElectrostaticSummationMethod.h" |
| 57 |
|
#include "UseTheForce/doForces_interface.h" |
| 58 |
+ |
#include "UseTheForce/DarkSide/electrostatic_interface.h" |
| 59 |
|
#include "UseTheForce/notifyCutoffs_interface.h" |
| 60 |
|
#include "utils/MemoryUtils.hpp" |
| 61 |
|
#include "utils/simError.h" |
| 465 |
|
//setup fortran force field |
| 466 |
|
/** @deprecate */ |
| 467 |
|
int isError = 0; |
| 468 |
< |
initFortranFF( &fInfo_.SIM_uses_RF, &fInfo_.SIM_uses_UW, |
| 469 |
< |
&fInfo_.SIM_uses_DW, &isError ); |
| 468 |
> |
|
| 469 |
> |
setupElectrostaticSummationMethod( isError ); |
| 470 |
> |
|
| 471 |
|
if(isError){ |
| 472 |
|
sprintf( painCave.errMsg, |
| 473 |
|
"ForceField error: There was an error initializing the forceField in fortran.\n" ); |
| 523 |
|
int useElectrostatics = 0; |
| 524 |
|
//usePBC and useRF are from simParams |
| 525 |
|
int usePBC = simParams_->getPBC(); |
| 526 |
< |
int useRF = simParams_->getUseRF(); |
| 527 |
< |
int useUW = simParams_->getUseUndampedWolf(); |
| 528 |
< |
int useDW = simParams_->getUseDampedWolf(); |
| 526 |
> |
int useRF; |
| 527 |
> |
|
| 528 |
> |
// set the useRF logical |
| 529 |
> |
std::string myMethod = simParams_->getElectrostaticSummationMethod(); |
| 530 |
> |
if (myMethod == "REACTION_FIELD") |
| 531 |
> |
useRF = 1; |
| 532 |
> |
else |
| 533 |
> |
useRF = 0; |
| 534 |
|
|
| 535 |
|
//loop over all of the atom types |
| 536 |
|
for (i = atomTypes.begin(); i != atomTypes.end(); ++i) { |
| 596 |
|
temp = useRF; |
| 597 |
|
MPI_Allreduce(&temp, &useRF, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD); |
| 598 |
|
|
| 590 |
– |
temp = useUW; |
| 591 |
– |
MPI_Allreduce(&temp, &useUW, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD); |
| 592 |
– |
|
| 593 |
– |
temp = useDW; |
| 594 |
– |
MPI_Allreduce(&temp, &useDW, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD); |
| 595 |
– |
|
| 599 |
|
#endif |
| 600 |
|
|
| 601 |
|
fInfo_.SIM_uses_PBC = usePBC; |
| 611 |
|
fInfo_.SIM_uses_Shapes = useShape; |
| 612 |
|
fInfo_.SIM_uses_FLARB = useFLARB; |
| 613 |
|
fInfo_.SIM_uses_RF = useRF; |
| 611 |
– |
fInfo_.SIM_uses_UW = useUW; |
| 612 |
– |
fInfo_.SIM_uses_DW = useDW; |
| 614 |
|
|
| 615 |
< |
if( fInfo_.SIM_uses_Dipoles && fInfo_.SIM_uses_RF) { |
| 615 |
> |
if( fInfo_.SIM_uses_Dipoles && myMethod == "REACTION_FIELD") { |
| 616 |
|
|
| 617 |
|
if (simParams_->haveDielectric()) { |
| 618 |
|
fInfo_.dielect = simParams_->getDielectric(); |
| 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 |
> |
|
| 873 |
> |
|
| 874 |
> |
if (simParams_->haveSkinThickness()) { |
| 875 |
> |
double skinThickness = simParams_->getSkinThickness(); |
| 876 |
> |
} |
| 877 |
> |
|
| 878 |
> |
notifyFortranCutoffs(&rcut_, &rsw_, &rnblist, &cp); |
| 879 |
> |
// also send cutoff notification to electrostatics |
| 880 |
> |
setElectrostaticCutoffRadius(&rcut_); |
| 881 |
|
} |
| 882 |
|
|
| 883 |
+ |
void SimInfo::setupElectrostaticSummationMethod( int isError ) { |
| 884 |
+ |
|
| 885 |
+ |
int errorOut; |
| 886 |
+ |
int esm = NONE; |
| 887 |
+ |
double alphaVal; |
| 888 |
+ |
double dielectric; |
| 889 |
+ |
|
| 890 |
+ |
errorOut = isError; |
| 891 |
+ |
alphaVal = simParams_->getDampingAlpha(); |
| 892 |
+ |
dielectric = simParams_->getDielectric(); |
| 893 |
+ |
|
| 894 |
+ |
if (simParams_->haveElectrostaticSummationMethod()) { |
| 895 |
+ |
std::string myMethod = simParams_->getElectrostaticSummationMethod(); |
| 896 |
+ |
if (myMethod == "NONE") { |
| 897 |
+ |
esm = NONE; |
| 898 |
+ |
} else { |
| 899 |
+ |
if (myMethod == "UNDAMPED_WOLF") { |
| 900 |
+ |
esm = UNDAMPED_WOLF; |
| 901 |
+ |
} else { |
| 902 |
+ |
if (myMethod == "DAMPED_WOLF") { |
| 903 |
+ |
esm = DAMPED_WOLF; |
| 904 |
+ |
if (!simParams_->haveDampingAlpha()) { |
| 905 |
+ |
//throw error |
| 906 |
+ |
sprintf( painCave.errMsg, |
| 907 |
+ |
"SimInfo warning: dampingAlpha was not specified in the input file. A default value of %f (1/ang) will be used for the Damped Wolf Method.", alphaVal); |
| 908 |
+ |
painCave.isFatal = 0; |
| 909 |
+ |
simError(); |
| 910 |
+ |
} |
| 911 |
+ |
} else { |
| 912 |
+ |
if (myMethod == "REACTION_FIELD") { |
| 913 |
+ |
esm = REACTION_FIELD; |
| 914 |
+ |
} else { |
| 915 |
+ |
// throw error |
| 916 |
+ |
sprintf( painCave.errMsg, |
| 917 |
+ |
"SimInfo error: Unknown electrostaticSummationMethod. (Input file specified %s .)\n\telectrostaticSummationMethod must be one of: \"none\", \"undamped_wolf\", \"damped_wolf\", or \"reaction_field\".", myMethod.c_str() ); |
| 918 |
+ |
painCave.isFatal = 1; |
| 919 |
+ |
simError(); |
| 920 |
+ |
} |
| 921 |
+ |
} |
| 922 |
+ |
} |
| 923 |
+ |
} |
| 924 |
+ |
} |
| 925 |
+ |
// let's pass some summation method variables to fortran |
| 926 |
+ |
setElectrostaticSummationMethod( &esm ); |
| 927 |
+ |
setDampedWolfAlpha( &alphaVal ); |
| 928 |
+ |
setReactionFieldDielectric( &dielectric ); |
| 929 |
+ |
initFortranFF( &esm, &errorOut ); |
| 930 |
+ |
} |
| 931 |
+ |
|
| 932 |
|
void SimInfo::addProperty(GenericData* genData) { |
| 933 |
|
properties_.addProperty(genData); |
| 934 |
|
} |