54 |
|
#include "primitives/Molecule.hpp" |
55 |
|
#include "UseTheForce/fCutoffPolicy.h" |
56 |
|
#include "UseTheForce/DarkSide/fElectrostaticSummationMethod.h" |
57 |
+ |
#include "UseTheForce/DarkSide/fScreeningMethod.h" |
58 |
|
#include "UseTheForce/doForces_interface.h" |
59 |
|
#include "UseTheForce/DarkSide/electrostatic_interface.h" |
60 |
|
#include "UseTheForce/notifyCutoffs_interface.h" |
529 |
|
//usePBC and useRF are from simParams |
530 |
|
int usePBC = simParams_->getUsePeriodicBoundaryConditions(); |
531 |
|
int useRF; |
532 |
+ |
int useDW; |
533 |
|
std::string myMethod; |
534 |
|
|
535 |
|
// set the useRF logical |
536 |
|
useRF = 0; |
537 |
+ |
useDW = 0; |
538 |
|
|
539 |
|
|
540 |
|
if (simParams_->haveElectrostaticSummationMethod()) { |
542 |
|
toUpper(myMethod); |
543 |
|
if (myMethod == "REACTION_FIELD") { |
544 |
|
useRF=1; |
545 |
+ |
} else { |
546 |
+ |
if (myMethod == "SHIFTED_POTENTIAL") { |
547 |
+ |
useDW = 1; |
548 |
+ |
} |
549 |
|
} |
550 |
|
} |
551 |
|
|
613 |
|
temp = useRF; |
614 |
|
MPI_Allreduce(&temp, &useRF, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD); |
615 |
|
|
616 |
+ |
temp = useDW; |
617 |
+ |
MPI_Allreduce(&temp, &useDW, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD); |
618 |
+ |
|
619 |
|
#endif |
620 |
|
|
621 |
|
fInfo_.SIM_uses_PBC = usePBC; |
631 |
|
fInfo_.SIM_uses_Shapes = useShape; |
632 |
|
fInfo_.SIM_uses_FLARB = useFLARB; |
633 |
|
fInfo_.SIM_uses_RF = useRF; |
634 |
+ |
fInfo_.SIM_uses_DampedWolf = useDW; |
635 |
|
|
636 |
|
if( myMethod == "REACTION_FIELD") { |
637 |
|
|
646 |
|
simError(); |
647 |
|
} |
648 |
|
} |
649 |
+ |
|
650 |
|
} |
651 |
|
|
652 |
|
void SimInfo::setupFortranSim() { |
836 |
|
sprintf(painCave.errMsg, |
837 |
|
"SimCreator Warning: No value was set for switchingRadius.\n" |
838 |
|
"\tOOPSE will use a default value of\n" |
839 |
< |
"\t0.95 * cutoffRadius for the switchingRadius\n"); |
839 |
> |
"\t0.85 * cutoffRadius for the switchingRadius\n"); |
840 |
|
painCave.isFatal = 0; |
841 |
|
simError(); |
842 |
< |
rsw = 0.95 * rcut; |
842 |
> |
rsw = 0.85 * rcut; |
843 |
|
} else{ |
844 |
|
rsw = simParams_->getSwitchingRadius(); |
845 |
|
} |
907 |
|
|
908 |
|
int errorOut; |
909 |
|
int esm = NONE; |
910 |
+ |
int sm = UNDAMPED; |
911 |
|
double alphaVal; |
912 |
|
double dielectric; |
913 |
|
|
921 |
|
if (myMethod == "NONE") { |
922 |
|
esm = NONE; |
923 |
|
} else { |
924 |
< |
if (myMethod == "UNDAMPED_WOLF") { |
925 |
< |
esm = UNDAMPED_WOLF; |
924 |
> |
if (myMethod == "SWITCHING_FUNCTION") { |
925 |
> |
esm = SWITCHING_FUNCTION; |
926 |
|
} else { |
927 |
< |
if (myMethod == "DAMPED_WOLF") { |
928 |
< |
esm = DAMPED_WOLF; |
929 |
< |
if (!simParams_->haveDampingAlpha()) { |
930 |
< |
//throw error |
931 |
< |
sprintf( painCave.errMsg, |
919 |
< |
"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); |
920 |
< |
painCave.isFatal = 0; |
921 |
< |
simError(); |
922 |
< |
} |
923 |
< |
} else { |
924 |
< |
if (myMethod == "REACTION_FIELD") { |
925 |
< |
esm = REACTION_FIELD; |
927 |
> |
if (myMethod == "SHIFTED_POTENTIAL") { |
928 |
> |
esm = SHIFTED_POTENTIAL; |
929 |
> |
} else { |
930 |
> |
if (myMethod == "SHIFTED_FORCE") { |
931 |
> |
esm = SHIFTED_FORCE; |
932 |
|
} else { |
933 |
< |
// throw error |
934 |
< |
sprintf( painCave.errMsg, |
935 |
< |
"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() ); |
936 |
< |
painCave.isFatal = 1; |
937 |
< |
simError(); |
938 |
< |
} |
939 |
< |
} |
933 |
> |
if (myMethod == "REACTION_FIELD") { |
934 |
> |
esm = REACTION_FIELD; |
935 |
> |
} else { |
936 |
> |
// throw error |
937 |
> |
sprintf( painCave.errMsg, |
938 |
> |
"SimInfo error: Unknown electrostaticSummationMethod. (Input file specified %s .)\n\telectrostaticSummationMethod must be one of: \"none\", \"shifted_potential\", \"shifted_force\", or \"reaction_field\".", myMethod.c_str() ); |
939 |
> |
painCave.isFatal = 1; |
940 |
> |
simError(); |
941 |
> |
} |
942 |
> |
} |
943 |
> |
} |
944 |
|
} |
945 |
|
} |
946 |
|
} |
947 |
+ |
|
948 |
+ |
if (simParams_->haveScreeningMethod()) { |
949 |
+ |
std::string myScreen = simParams_->getScreeningMethod(); |
950 |
+ |
toUpper(myScreen); |
951 |
+ |
if (myScreen == "UNDAMPED") { |
952 |
+ |
sm = UNDAMPED; |
953 |
+ |
} else { |
954 |
+ |
if (myScreen == "DAMPED") { |
955 |
+ |
sm = DAMPED; |
956 |
+ |
if (!simParams_->haveDampingAlpha()) { |
957 |
+ |
//throw error |
958 |
+ |
sprintf( painCave.errMsg, |
959 |
+ |
"SimInfo warning: dampingAlpha was not specified in the input file. A default value of %f (1/ang) will be used.", alphaVal); |
960 |
+ |
painCave.isFatal = 0; |
961 |
+ |
simError(); |
962 |
+ |
} else { |
963 |
+ |
// throw error |
964 |
+ |
sprintf( painCave.errMsg, |
965 |
+ |
"SimInfo error: Unknown electrostaticSummationMethod. (Input file specified %s .)\n\telectrostaticSummationMethod must be one of: \"undamped\" or \"damped\".", myScreen.c_str() ); |
966 |
+ |
painCave.isFatal = 1; |
967 |
+ |
simError(); |
968 |
+ |
} |
969 |
+ |
} |
970 |
+ |
} |
971 |
+ |
} |
972 |
|
// let's pass some summation method variables to fortran |
973 |
|
setElectrostaticSummationMethod( &esm ); |
974 |
< |
setDampedWolfAlpha( &alphaVal ); |
974 |
> |
setScreeningMethod( &sm ); |
975 |
> |
setDampingAlpha( &alphaVal ); |
976 |
|
setReactionFieldDielectric( &dielectric ); |
977 |
|
initFortranFF( &esm, &errorOut ); |
978 |
|
} |