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 1024 by tim, Wed Aug 30 18:42:29 2006 UTC vs.
Revision 1103 by chuckv, Fri Dec 29 20:21:53 2006 UTC

# Line 59 | Line 59
59   #include "UseTheForce/DarkSide/fElectrostaticScreeningMethod.h"
60   #include "UseTheForce/DarkSide/fSwitchingFunctionType.h"
61   #include "UseTheForce/doForces_interface.h"
62 + #include "UseTheForce/DarkSide/neighborLists_interface.h"
63   #include "UseTheForce/DarkSide/electrostatic_interface.h"
64   #include "UseTheForce/DarkSide/switcheroo_interface.h"
65   #include "utils/MemoryUtils.hpp"
# Line 67 | Line 68
68   #include "io/ForceFieldOptions.hpp"
69   #include "UseTheForce/ForceField.hpp"
70  
71 +
72   #ifdef IS_MPI
73   #include "UseTheForce/mpiComponentPlan.h"
74   #include "UseTheForce/DarkSide/simParallel_interface.h"
# Line 600 | Line 602 | namespace oopse {
602      //setup fortran force field
603      /** @deprecate */    
604      int isError = 0;
605 +    
606 +    setupCutoff();
607      
608      setupElectrostaticSummationMethod( isError );
609      setupSwitchingFunction();
# Line 611 | Line 615 | namespace oopse {
615        painCave.isFatal = 1;
616        simError();
617      }
614  
615    
616    setupCutoff();
618  
619      calcNdf();
620      calcNdfRaw();
# Line 670 | Line 671 | namespace oopse {
671      // set the useRF logical
672      useRF = 0;
673      useSF = 0;
674 +    useSP = 0;
675  
676  
677      if (simParams_->haveElectrostaticSummationMethod()) {
678        std::string myMethod = simParams_->getElectrostaticSummationMethod();
679        toUpper(myMethod);
680        if (myMethod == "REACTION_FIELD"){
681 <        useRF=1;
681 >        useRF = 1;
682        } else if (myMethod == "SHIFTED_FORCE"){
683          useSF = 1;
684        } else if (myMethod == "SHIFTED_POTENTIAL"){
# Line 784 | Line 786 | namespace oopse {
786      fInfo_.SIM_uses_SF = useSF;
787      fInfo_.SIM_uses_SP = useSP;
788      fInfo_.SIM_uses_BoxDipole = useBoxDipole;
787
788    if( myMethod == "REACTION_FIELD") {
789      
790      if (simParams_->haveDielectric()) {
791        fInfo_.dielect = simParams_->getDielectric();
792      } else {
793        sprintf(painCave.errMsg,
794                "SimSetup Error: No Dielectric constant was set.\n"
795                "\tYou are trying to use Reaction Field without"
796                "\tsetting a dielectric constant!\n");
797        painCave.isFatal = 1;
798        simError();
799      }      
800    }
801
789    }
790  
791    void SimInfo::setupFortranSim() {
# Line 883 | Line 870 | namespace oopse {
870               "succesfully sent the simulation information to fortran.\n");
871      MPIcheckPoint();
872   #endif // is_mpi
873 +
874 +    // Setup number of neighbors in neighbor list if present
875 +    if (simParams_->haveNeighborListNeighbors()) {
876 +      setNeighbors(simParams_->getNeighborListNeighbors());
877 +    }
878 +  
879 +
880    }
881  
882  
# Line 1074 | Line 1068 | namespace oopse {
1068      int sm = UNDAMPED;
1069      RealType alphaVal;
1070      RealType dielectric;
1071 <
1071 >    
1072      errorOut = isError;
1079    alphaVal = simParams_->getDampingAlpha();
1080    dielectric = simParams_->getDielectric();
1073  
1074      if (simParams_->haveElectrostaticSummationMethod()) {
1075        std::string myMethod = simParams_->getElectrostaticSummationMethod();
# Line 1094 | Line 1086 | namespace oopse {
1086              if (myMethod == "SHIFTED_FORCE") {            
1087                esm = SHIFTED_FORCE;
1088              } else {
1089 <              if (myMethod == "REACTION_FIELD") {            
1089 >              if (myMethod == "REACTION_FIELD") {
1090                  esm = REACTION_FIELD;
1091 +                dielectric = simParams_->getDielectric();
1092 +                if (!simParams_->haveDielectric()) {
1093 +                  // throw warning
1094 +                  sprintf( painCave.errMsg,
1095 +                           "SimInfo warning: dielectric was not specified in the input file\n\tfor the reaction field correction method.\n"
1096 +                           "\tA default value of %f will be used for the dielectric.\n", dielectric);
1097 +                  painCave.isFatal = 0;
1098 +                  simError();
1099 +                }
1100                } else {
1101                  // throw error        
1102                  sprintf( painCave.errMsg,
# Line 1122 | Line 1123 | namespace oopse {
1123          if (myScreen == "DAMPED") {
1124            sm = DAMPED;
1125            if (!simParams_->haveDampingAlpha()) {
1126 <            //throw error
1126 >            // first set a cutoff dependent alpha value
1127 >            // we assume alpha depends linearly with rcut from 0 to 20.5 ang
1128 >            alphaVal = 0.5125 - rcut_* 0.025;
1129 >            // for values rcut > 20.5, alpha is zero
1130 >            if (alphaVal < 0) alphaVal = 0;
1131 >
1132 >            // throw warning
1133              sprintf( painCave.errMsg,
1134                       "SimInfo warning: dampingAlpha was not specified in the input file.\n"
1135 <                     "\tA default value of %f (1/ang) will be used.\n", alphaVal);
1135 >                     "\tA default value of %f (1/ang) will be used for the cutoff of\n\t%f (ang).\n", alphaVal, rcut_);
1136              painCave.isFatal = 0;
1137              simError();
1138 +          } else {
1139 +            alphaVal = simParams_->getDampingAlpha();
1140            }
1141 +          
1142          } else {
1143            // throw error        
1144            sprintf( painCave.errMsg,
# Line 1443 | Line 1453 | namespace oopse {
1453    
1454    void SimInfo::setIOIndexToIntegrableObject(const std::vector<StuntDouble*>& v) {
1455      IOIndexToIntegrableObject= v;
1456 +  }
1457 +
1458 +  /* Returns the Volume of the simulation based on a ellipsoid with semi-axes
1459 +     based on the radius of gyration V=4/3*Pi*R_1*R_2*R_3
1460 +     where R_i are related to the principle inertia moments R_i = sqrt(C*I_i/N), this reduces to
1461 +     V = 4/3*Pi*(C/N)^3/2*sqrt(det(I)). See S.E. Baltazar et. al. Comp. Mat. Sci. 37 (2006) 526-536.
1462 +  */
1463 +  void SimInfo::getGyrationalVolume(RealType &volume){
1464 +    Mat3x3d intTensor;
1465 +    RealType det;
1466 +    Vector3d dummyAngMom;
1467 +    RealType sysconstants;
1468 +    RealType geomCnst;
1469 +
1470 +    geomCnst = 3.0/2.0;
1471 +    /* Get the inertial tensor and angular momentum for free*/
1472 +    getInertiaTensor(intTensor,dummyAngMom);
1473 +    
1474 +    det = intTensor.determinant();
1475 +    sysconstants = geomCnst/(RealType)nGlobalIntegrableObjects_;
1476 +    volume = 4.0/3.0*NumericConstant::PI*pow(sysconstants,3.0/2.0)*sqrt(det);
1477 +    return;
1478    }
1479  
1480 +  void SimInfo::getGyrationalVolume(RealType &volume, RealType &detI){
1481 +    Mat3x3d intTensor;
1482 +    Vector3d dummyAngMom;
1483 +    RealType sysconstants;
1484 +    RealType geomCnst;
1485 +
1486 +    geomCnst = 3.0/2.0;
1487 +    /* Get the inertial tensor and angular momentum for free*/
1488 +    getInertiaTensor(intTensor,dummyAngMom);
1489 +    
1490 +    detI = intTensor.determinant();
1491 +    sysconstants = geomCnst/(RealType)nGlobalIntegrableObjects_;
1492 +    volume = 4.0/3.0*NumericConstant::PI*pow(sysconstants,3.0/2.0)*sqrt(detI);
1493 +    return;
1494 +  }
1495   /*
1496     void SimInfo::setStuntDoubleFromGlobalIndex(std::vector<StuntDouble*> v) {
1497        assert( v.size() == nAtoms_ + nRigidBodies_);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines