| 53 |
|
#include "math/Vector3.hpp" |
| 54 |
|
#include "primitives/Molecule.hpp" |
| 55 |
|
#include "UseTheForce/fCutoffPolicy.h" |
| 56 |
< |
#include "UseTheForce/fCoulombicCorrection.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" |
| 466 |
|
/** @deprecate */ |
| 467 |
|
int isError = 0; |
| 468 |
|
|
| 469 |
< |
setupCoulombicCorrection( isError ); |
| 469 |
> |
setupElectrostaticSummationMethod( isError ); |
| 470 |
|
|
| 471 |
|
if(isError){ |
| 472 |
|
sprintf( painCave.errMsg, |
| 523 |
|
int useElectrostatics = 0; |
| 524 |
|
//usePBC and useRF are from simParams |
| 525 |
|
int usePBC = simParams_->getPBC(); |
| 526 |
< |
int useRF = simParams_->getUseRF(); |
| 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 |
|
|
| 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 |
– |
|
| 599 |
|
#endif |
| 600 |
|
|
| 601 |
|
fInfo_.SIM_uses_PBC = usePBC; |
| 612 |
|
fInfo_.SIM_uses_FLARB = useFLARB; |
| 613 |
|
fInfo_.SIM_uses_RF = useRF; |
| 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(); |
| 870 |
|
} |
| 871 |
|
} |
| 872 |
|
notifyFortranCutoffs(&rcut_, &rsw_, &rnblist, &cp); |
| 873 |
+ |
// also send cutoff notification to electrostatics |
| 874 |
+ |
setElectrostaticCutoffRadius(&rcut_); |
| 875 |
|
} |
| 876 |
|
|
| 877 |
< |
void SimInfo::setupCoulombicCorrection( int isError ) { |
| 877 |
> |
void SimInfo::setupElectrostaticSummationMethod( int isError ) { |
| 878 |
|
|
| 879 |
|
int errorOut; |
| 880 |
< |
int cc = NONE; |
| 880 |
> |
int esm = NONE; |
| 881 |
|
double alphaVal; |
| 882 |
+ |
double dielectric; |
| 883 |
|
|
| 884 |
|
errorOut = isError; |
| 885 |
< |
|
| 886 |
< |
if (simParams_->haveCoulombicCorrection()) { |
| 887 |
< |
std::string myCorrection = simParams_->getCoulombicCorrection(); |
| 888 |
< |
if (myCorrection == "NONE") { |
| 889 |
< |
cc = NONE; |
| 885 |
> |
alphaVal = simParams_->getDampingAlpha(); |
| 886 |
> |
dielectric = simParams_->getDielectric(); |
| 887 |
> |
|
| 888 |
> |
if (simParams_->haveElectrostaticSummationMethod()) { |
| 889 |
> |
std::string myMethod = simParams_->getElectrostaticSummationMethod(); |
| 890 |
> |
if (myMethod == "NONE") { |
| 891 |
> |
esm = NONE; |
| 892 |
|
} else { |
| 893 |
< |
if (myCorrection == "UNDAMPED_WOLF") { |
| 894 |
< |
cc = UNDAMPED_WOLF; |
| 893 |
> |
if (myMethod == "UNDAMPED_WOLF") { |
| 894 |
> |
esm = UNDAMPED_WOLF; |
| 895 |
|
} else { |
| 896 |
< |
if (myCorrection == "WOLF") { |
| 897 |
< |
cc = WOLF; |
| 896 |
> |
if (myMethod == "DAMPED_WOLF") { |
| 897 |
> |
esm = DAMPED_WOLF; |
| 898 |
|
if (!simParams_->haveDampingAlpha()) { |
| 899 |
|
//throw error |
| 900 |
|
sprintf( painCave.errMsg, |
| 901 |
< |
"SimInfo warning: dampingAlpha was not specified in the input file. A default value of %f (1/ang) will be used for the Wolf Coulombic Correction.", simParams_->getDampingAlpha()); |
| 901 |
> |
"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); |
| 902 |
|
painCave.isFatal = 0; |
| 903 |
|
simError(); |
| 904 |
|
} |
| 898 |
– |
alphaVal = simParams_->getDampingAlpha(); |
| 905 |
|
} else { |
| 906 |
< |
if (myCorrection == "REACTION_FIELD") { |
| 907 |
< |
cc = REACTION_FIELD; |
| 906 |
> |
if (myMethod == "REACTION_FIELD") { |
| 907 |
> |
esm = REACTION_FIELD; |
| 908 |
|
} else { |
| 909 |
|
// throw error |
| 910 |
|
sprintf( painCave.errMsg, |
| 911 |
< |
"SimInfo error: Unknown coulombicCorrection. (Input file specified %s .)\n\tcoulombicCorrection must be one of: \"none\", \"undamped_wolf\", \"wolf\", or \"reaction_field\".", myCorrection.c_str() ); |
| 911 |
> |
"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() ); |
| 912 |
|
painCave.isFatal = 1; |
| 913 |
|
simError(); |
| 914 |
|
} |
| 916 |
|
} |
| 917 |
|
} |
| 918 |
|
} |
| 919 |
< |
initFortranFF( &fInfo_.SIM_uses_RF, &cc, &alphaVal, &errorOut ); |
| 919 |
> |
// let's pass some summation method variables to fortran |
| 920 |
> |
setElectrostaticSummationMethod( &esm ); |
| 921 |
> |
setDampedWolfAlpha( &alphaVal ); |
| 922 |
> |
setReactionFieldDielectric( &dielectric ); |
| 923 |
> |
initFortranFF( &esm, &errorOut ); |
| 924 |
|
} |
| 925 |
|
|
| 926 |
|
void SimInfo::addProperty(GenericData* genData) { |