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

Comparing trunk/OOPSE-2.0/src/brains/SimInfo.cpp (file contents):
Revision 2279 by chrisfen, Tue Aug 30 18:23:50 2005 UTC vs.
Revision 2309 by chrisfen, Sun Sep 18 20:45:38 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/DarkSide/fElectrostaticSummationMethod.h"
57   #include "UseTheForce/doForces_interface.h"
58 + #include "UseTheForce/DarkSide/electrostatic_interface.h"
59   #include "UseTheForce/notifyCutoffs_interface.h"
60   #include "utils/MemoryUtils.hpp"
61   #include "utils/simError.h"
# Line 462 | Line 465 | namespace oopse {
465      //setup fortran force field
466      /** @deprecate */    
467      int isError = 0;
468 <    initFortranFF( &fInfo_.SIM_uses_RF, &fInfo_.SIM_uses_UW,
469 <                   &fInfo_.SIM_uses_DW, &isError );
468 >    
469 >    setupElectrostaticSummationMethod( isError );
470 >
471      if(isError){
472        sprintf( painCave.errMsg,
473                 "ForceField error: There was an error initializing the forceField in fortran.\n" );
# Line 519 | Line 523 | namespace oopse {
523      int useElectrostatics = 0;
524      //usePBC and useRF are from simParams
525      int usePBC = simParams_->getPBC();
522    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 584 | Line 585 | namespace oopse {
585      temp = useFLARB;
586      MPI_Allreduce(&temp, &useFLARB, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
587  
587    temp = useRF;
588    MPI_Allreduce(&temp, &useRF, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
589
590    temp = useUW;
591    MPI_Allreduce(&temp, &useUW, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);  
592
593    temp = useDW;
594    MPI_Allreduce(&temp, &useDW, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);  
595    
588   #endif
589  
590      fInfo_.SIM_uses_PBC = usePBC;    
# Line 607 | Line 599 | namespace oopse {
599      fInfo_.SIM_uses_EAM = useEAM;
600      fInfo_.SIM_uses_Shapes = useShape;
601      fInfo_.SIM_uses_FLARB = useFLARB;
610    fInfo_.SIM_uses_RF = useRF;
611    fInfo_.SIM_uses_UW = useUW;
612    fInfo_.SIM_uses_DW = useDW;
602  
603      if( fInfo_.SIM_uses_Dipoles && fInfo_.SIM_uses_RF) {
604  
# Line 841 | Line 830 | namespace oopse {
830      }
831    }
832  
833 <  void SimInfo::setupCutoff() {
833 >  void SimInfo::setupCutoff() {    
834      getCutoff(rcut_, rsw_);    
835      double rnblist = rcut_ + 1; // skin of neighbor list
836  
837      //Pass these cutoff radius etc. to fortran. This function should be called once and only once
838 <    notifyFortranCutoffs(&rcut_, &rsw_, &rnblist);
838 >    
839 >    int cp =  TRADITIONAL_CUTOFF_POLICY;
840 >    if (simParams_->haveCutoffPolicy()) {
841 >      std::string myPolicy = simParams_->getCutoffPolicy();
842 >      if (myPolicy == "MIX") {
843 >        cp = MIX_CUTOFF_POLICY;
844 >      } else {
845 >        if (myPolicy == "MAX") {
846 >          cp = MAX_CUTOFF_POLICY;
847 >        } else {
848 >          if (myPolicy == "TRADITIONAL") {            
849 >            cp = TRADITIONAL_CUTOFF_POLICY;
850 >          } else {
851 >            // throw error        
852 >            sprintf( painCave.errMsg,
853 >                     "SimInfo error: Unknown cutoffPolicy. (Input file specified %s .)\n\tcutoffPolicy must be one of: \"Mix\", \"Max\", or \"Traditional\".", myPolicy.c_str() );
854 >            painCave.isFatal = 1;
855 >            simError();
856 >          }    
857 >        }          
858 >      }
859 >    }
860 >    notifyFortranCutoffs(&rcut_, &rsw_, &rnblist, &cp);
861 >    // also send cutoff notification to electrostatics
862 >    setElectrostaticCutoffRadius(&rcut_);
863    }
864  
865 +  void SimInfo::setupElectrostaticSummationMethod( int isError ) {    
866 +    
867 +    int errorOut;
868 +    int esm =  NONE;
869 +    double alphaVal;
870 +    double dielectric;
871 +
872 +    errorOut = isError;
873 +    alphaVal = simParams_->getDampingAlpha();
874 +    dielectric = simParams_->getDielectric();
875 +
876 +    if (simParams_->haveElectrostaticSummationMethod()) {
877 +      std::string myMethod = simParams_->getElectrostaticSummationMethod();
878 +      if (myMethod == "NONE") {
879 +        esm = NONE;
880 +      } else {
881 +        if (myMethod == "UNDAMPED_WOLF") {
882 +          esm = UNDAMPED_WOLF;
883 +        } else {
884 +          if (myMethod == "DAMPED_WOLF") {            
885 +            esm = DAMPED_WOLF;
886 +            if (!simParams_->haveDampingAlpha()) {
887 +              //throw error
888 +              sprintf( painCave.errMsg,
889 +                       "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);
890 +              painCave.isFatal = 0;
891 +              simError();
892 +            }
893 +          } else {
894 +            if (myMethod == "REACTION_FIELD") {
895 +              esm = REACTION_FIELD;
896 +            } else {
897 +              // throw error        
898 +              sprintf( painCave.errMsg,
899 +                       "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() );
900 +              painCave.isFatal = 1;
901 +              simError();
902 +            }    
903 +          }          
904 +        }
905 +      }
906 +    }
907 +    // let's pass some summation method variables to fortran
908 +    setElectrostaticSummationMethod( &esm );
909 +    setDampedWolfAlpha( &alphaVal );
910 +    setReactionFieldDielectric( &dielectric );
911 +    initFortranFF( &esm, &errorOut );
912 +  }
913 +
914    void SimInfo::addProperty(GenericData* genData) {
915      properties_.addProperty(genData);  
916    }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines