53 |
|
#include "math/Vector3.hpp" |
54 |
|
#include "primitives/Molecule.hpp" |
55 |
|
#include "UseTheForce/fCutoffPolicy.h" |
56 |
+ |
#include "UseTheForce/fCoulombicCorrection.h" |
57 |
|
#include "UseTheForce/doForces_interface.h" |
58 |
|
#include "UseTheForce/notifyCutoffs_interface.h" |
59 |
|
#include "utils/MemoryUtils.hpp" |
464 |
|
//setup fortran force field |
465 |
|
/** @deprecate */ |
466 |
|
int isError = 0; |
467 |
< |
initFortranFF( &fInfo_.SIM_uses_RF, &fInfo_.SIM_uses_UW, |
468 |
< |
&fInfo_.SIM_uses_DW, &isError ); |
467 |
> |
|
468 |
> |
setupCoulombicCorrection( isError ); |
469 |
> |
|
470 |
|
if(isError){ |
471 |
|
sprintf( painCave.errMsg, |
472 |
|
"ForceField error: There was an error initializing the forceField in fortran.\n" ); |
523 |
|
//usePBC and useRF are from simParams |
524 |
|
int usePBC = simParams_->getPBC(); |
525 |
|
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) { |
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; |
612 |
|
|
613 |
|
if( fInfo_.SIM_uses_Dipoles && fInfo_.SIM_uses_RF) { |
614 |
|
|
869 |
|
} |
870 |
|
notifyFortranCutoffs(&rcut_, &rsw_, &rnblist, &cp); |
871 |
|
} |
872 |
+ |
|
873 |
+ |
void SimInfo::setupCoulombicCorrection( int isError ) { |
874 |
+ |
|
875 |
+ |
int errorOut; |
876 |
+ |
int cc = NONE; |
877 |
+ |
double alphaVal; |
878 |
|
|
879 |
+ |
errorOut = isError; |
880 |
+ |
|
881 |
+ |
if (simParams_->haveCoulombicCorrection()) { |
882 |
+ |
std::string myCorrection = simParams_->getCoulombicCorrection(); |
883 |
+ |
if (myCorrection == "NONE") { |
884 |
+ |
cc = NONE; |
885 |
+ |
} else { |
886 |
+ |
if (myCorrection == "UNDAMPED_WOLF") { |
887 |
+ |
cc = UNDAMPED_WOLF; |
888 |
+ |
} else { |
889 |
+ |
if (myCorrection == "WOLF") { |
890 |
+ |
cc = WOLF; |
891 |
+ |
if (!simParams_->haveDampingAlpha()) { |
892 |
+ |
//throw error |
893 |
+ |
sprintf( painCave.errMsg, |
894 |
+ |
"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()); |
895 |
+ |
painCave.isFatal = 0; |
896 |
+ |
simError(); |
897 |
+ |
} |
898 |
+ |
alphaVal = simParams_->getDampingAlpha(); |
899 |
+ |
} else { |
900 |
+ |
if (myCorrection == "REACTION_FIELD") { |
901 |
+ |
cc = REACTION_FIELD; |
902 |
+ |
} else { |
903 |
+ |
// throw error |
904 |
+ |
sprintf( painCave.errMsg, |
905 |
+ |
"SimInfo error: Unknown coulombicCorrection. (Input file specified %s .)\n\tcoulombicCorrection must be one of: \"none\", \"undamped_wolf\", \"wolf\", or \"reaction_field\".", myCorrection.c_str() ); |
906 |
+ |
painCave.isFatal = 1; |
907 |
+ |
simError(); |
908 |
+ |
} |
909 |
+ |
} |
910 |
+ |
} |
911 |
+ |
} |
912 |
+ |
} |
913 |
+ |
initFortranFF( &fInfo_.SIM_uses_RF, &cc, &alphaVal, &errorOut ); |
914 |
+ |
} |
915 |
+ |
|
916 |
|
void SimInfo::addProperty(GenericData* genData) { |
917 |
|
properties_.addProperty(genData); |
918 |
|
} |