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

Comparing trunk/src/brains/SimInfo.cpp (file contents):
Revision 557 by chuckv, Tue May 31 22:31:54 2005 UTC vs.
Revision 603 by chrisfen, Fri Sep 16 16:07:39 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 , &isError );
467 >    
468 >    setupElectrostaticSummationMethod( isError );
469 >
470      if(isError){
471        sprintf( painCave.errMsg,
472                 "ForceField error: There was an error initializing the forceField in fortran.\n" );
# Line 518 | Line 522 | namespace oopse {
522      int useElectrostatics = 0;
523      //usePBC and useRF are from simParams
524      int usePBC = simParams_->getPBC();
521    int useRF = simParams_->getUseRF();
525  
526      //loop over all of the atom types
527      for (i = atomTypes.begin(); i != atomTypes.end(); ++i) {
# Line 581 | Line 584 | namespace oopse {
584      temp = useFLARB;
585      MPI_Allreduce(&temp, &useFLARB, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
586  
584    temp = useRF;
585    MPI_Allreduce(&temp, &useRF, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
586    
587   #endif
588  
589      fInfo_.SIM_uses_PBC = usePBC;    
# Line 598 | Line 598 | namespace oopse {
598      fInfo_.SIM_uses_EAM = useEAM;
599      fInfo_.SIM_uses_Shapes = useShape;
600      fInfo_.SIM_uses_FLARB = useFLARB;
601    fInfo_.SIM_uses_RF = useRF;
601  
602      if( fInfo_.SIM_uses_Dipoles && fInfo_.SIM_uses_RF) {
603  
# Line 830 | Line 829 | namespace oopse {
829      }
830    }
831  
832 <  void SimInfo::setupCutoff() {
832 >  void SimInfo::setupCutoff() {    
833      getCutoff(rcut_, rsw_);    
834      double rnblist = rcut_ + 1; // skin of neighbor list
835  
836      //Pass these cutoff radius etc. to fortran. This function should be called once and only once
837 <    notifyFortranCutoffs(&rcut_, &rsw_, &rnblist);
837 >    
838 >    int cp =  TRADITIONAL_CUTOFF_POLICY;
839 >    if (simParams_->haveCutoffPolicy()) {
840 >      std::string myPolicy = simParams_->getCutoffPolicy();
841 >      if (myPolicy == "MIX") {
842 >        cp = MIX_CUTOFF_POLICY;
843 >      } else {
844 >        if (myPolicy == "MAX") {
845 >          cp = MAX_CUTOFF_POLICY;
846 >        } else {
847 >          if (myPolicy == "TRADITIONAL") {            
848 >            cp = TRADITIONAL_CUTOFF_POLICY;
849 >          } else {
850 >            // throw error        
851 >            sprintf( painCave.errMsg,
852 >                     "SimInfo error: Unknown cutoffPolicy. (Input file specified %s .)\n\tcutoffPolicy must be one of: \"Mix\", \"Max\", or \"Traditional\".", myPolicy.c_str() );
853 >            painCave.isFatal = 1;
854 >            simError();
855 >          }    
856 >        }          
857 >      }
858 >    }
859 >    notifyFortranCutoffs(&rcut_, &rsw_, &rnblist, &cp);
860 >  }
861 >
862 >  void SimInfo::setupElectrostaticSummationMethod( int isError ) {    
863 >    
864 >    int errorOut;
865 >    int esm =  NONE;
866 >    double alphaVal;
867 >
868 >    errorOut = isError;
869 >
870 >    if (simParams_->haveElectrostaticSummationMethod()) {
871 >      std::string myCorrection = simParams_->getElectrostaticSummationMethod();
872 >      if (myMethod == "NONE") {
873 >        esm = NONE;
874 >      } else {
875 >        if (myMethod == "UNDAMPED_WOLF") {
876 >          esm = UNDAMPED_WOLF;
877 >        } else {
878 >          if (myMethod == "DAMPED_WOLF") {            
879 >            esm = WOLF;
880 >            if (!simParams_->haveDampingAlpha()) {
881 >              //throw error
882 >              sprintf( painCave.errMsg,
883 >                       "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.", simParams_->getDampingAlpha());
884 >              painCave.isFatal = 0;
885 >              simError();
886 >            }
887 >            alphaVal = simParams_->getDampingAlpha();
888 >          } else {
889 >            if (myMethod == "REACTION_FIELD") {
890 >              esm = REACTION_FIELD;
891 >            } else {
892 >              // throw error        
893 >              sprintf( painCave.errMsg,
894 >                       "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() );
895 >              painCave.isFatal = 1;
896 >              simError();
897 >            }    
898 >          }          
899 >        }
900 >      }
901 >    }
902 >    initFortranFF( &fInfo_.SIM_uses_RF, &esm, &alphaVal, &errorOut );
903    }
904  
905    void SimInfo::addProperty(GenericData* genData) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines