| 52 |  | #include "brains/SimInfo.hpp" | 
| 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 , &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" ); | 
| 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 |  |  | 
| 840 |  | } | 
| 841 |  | } | 
| 842 |  |  | 
| 843 | < | void SimInfo::setupCutoff() { | 
| 843 | > | void SimInfo::setupCutoff() { | 
| 844 |  | getCutoff(rcut_, rsw_); | 
| 845 |  | double rnblist = rcut_ + 1; // skin of neighbor list | 
| 846 |  |  | 
| 847 |  | //Pass these cutoff radius etc. to fortran. This function should be called once and only once | 
| 848 | < | notifyFortranCutoffs(&rcut_, &rsw_, &rnblist); | 
| 848 | > |  | 
| 849 | > | int cp =  TRADITIONAL_CUTOFF_POLICY; | 
| 850 | > | if (simParams_->haveCutoffPolicy()) { | 
| 851 | > | std::string myPolicy = simParams_->getCutoffPolicy(); | 
| 852 | > | if (myPolicy == "MIX") { | 
| 853 | > | cp = MIX_CUTOFF_POLICY; | 
| 854 | > | } else { | 
| 855 | > | if (myPolicy == "MAX") { | 
| 856 | > | cp = MAX_CUTOFF_POLICY; | 
| 857 | > | } else { | 
| 858 | > | if (myPolicy == "TRADITIONAL") { | 
| 859 | > | cp = TRADITIONAL_CUTOFF_POLICY; | 
| 860 | > | } else { | 
| 861 | > | // throw error | 
| 862 | > | sprintf( painCave.errMsg, | 
| 863 | > | "SimInfo error: Unknown cutoffPolicy. (Input file specified %s .)\n\tcutoffPolicy must be one of: \"Mix\", \"Max\", or \"Traditional\".", myPolicy.c_str() ); | 
| 864 | > | painCave.isFatal = 1; | 
| 865 | > | simError(); | 
| 866 | > | } | 
| 867 | > | } | 
| 868 | > | } | 
| 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 |  | } |