ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/brains/SimInfo.cpp
(Generate patch)

Comparing trunk/src/brains/SimInfo.cpp (file contents):
Revision 580 by chrisfen, Tue Aug 30 18:23:50 2005 UTC vs.
Revision 598 by chrisfen, Thu Sep 15 00:14:35 2005 UTC

# Line 52 | Line 52
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"
# Line 462 | Line 464 | namespace oopse {
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" );
# Line 520 | Line 523 | namespace oopse {
523      //usePBC and useRF are from simParams
524      int usePBC = simParams_->getPBC();
525      int useRF = simParams_->getUseRF();
523    int useUW = simParams_->getUseUndampedWolf();
524    int useDW = simParams_->getUseDampedWolf();
526  
527      //loop over all of the atom types
528      for (i = atomTypes.begin(); i != atomTypes.end(); ++i) {
# Line 608 | Line 609 | namespace oopse {
609      fInfo_.SIM_uses_Shapes = useShape;
610      fInfo_.SIM_uses_FLARB = useFLARB;
611      fInfo_.SIM_uses_RF = useRF;
611    fInfo_.SIM_uses_UW = useUW;
612    fInfo_.SIM_uses_DW = useDW;
612  
613      if( fInfo_.SIM_uses_Dipoles && fInfo_.SIM_uses_RF) {
614  
# Line 841 | Line 840 | namespace oopse {
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) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines