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 2328 by chuckv, Mon Sep 26 15:58:17 2005 UTC vs.
Revision 2404 by chrisfen, Tue Nov 1 19:14:27 2005 UTC

# Line 83 | Line 83 | namespace oopse {
83        MoleculeStamp* molStamp;
84        int nMolWithSameStamp;
85        int nCutoffAtoms = 0; // number of atoms belong to cutoff groups
86 <      int nGroups = 0;          //total cutoff groups defined in meta-data file
86 >      int nGroups = 0;      //total cutoff groups defined in meta-data file
87        CutoffGroupStamp* cgStamp;    
88        RigidBodyStamp* rbStamp;
89        int nRigidAtoms = 0;
# Line 108 | Line 108 | namespace oopse {
108          }
109  
110          nGroups += nCutoffGroupsInStamp * nMolWithSameStamp;
111 +
112          nCutoffAtoms += nAtomsInGroups * nMolWithSameStamp;            
113  
114          //calculate atoms in rigid bodies
# Line 124 | Line 125 | namespace oopse {
125          
126        }
127  
128 <      //every free atom (atom does not belong to cutoff groups) is a cutoff group
129 <      //therefore the total number of cutoff groups in the system is equal to
130 <      //the total number of atoms minus number of atoms belong to cutoff group defined in meta-data
131 <      //file plus the number of cutoff groups defined in meta-data file
128 >      //every free atom (atom does not belong to cutoff groups) is a cutoff
129 >      //group therefore the total number of cutoff groups in the system is
130 >      //equal to the total number of atoms minus number of atoms belong to
131 >      //cutoff group defined in meta-data file plus the number of cutoff
132 >      //groups defined in meta-data file
133        nGlobalCutoffGroups_ = nGlobalAtoms_ - nCutoffAtoms + nGroups;
134  
135 <      //every free atom (atom does not belong to rigid bodies) is an integrable object
136 <      //therefore the total number of  integrable objects in the system is equal to
137 <      //the total number of atoms minus number of atoms belong to  rigid body defined in meta-data
138 <      //file plus the number of  rigid bodies defined in meta-data file
139 <      nGlobalIntegrableObjects_ = nGlobalAtoms_ - nRigidAtoms + nGlobalRigidBodies_;
140 <
135 >      //every free atom (atom does not belong to rigid bodies) is an
136 >      //integrable object therefore the total number of integrable objects
137 >      //in the system is equal to the total number of atoms minus number of
138 >      //atoms belong to rigid body defined in meta-data file plus the number
139 >      //of rigid bodies defined in meta-data file
140 >      nGlobalIntegrableObjects_ = nGlobalAtoms_ - nRigidAtoms
141 >                                                + nGlobalRigidBodies_;
142 >  
143        nGlobalMols_ = molStampIds_.size();
144  
145   #ifdef IS_MPI    
# Line 522 | Line 526 | namespace oopse {
526      int useDirectionalAtom = 0;    
527      int useElectrostatics = 0;
528      //usePBC and useRF are from simParams
529 <    int usePBC = simParams_->getPBC();
529 >    int usePBC = simParams_->getUsePeriodicBoundaryConditions();
530      int useRF;
531 +    int useDW;
532 +    std::string myMethod;
533  
534      // set the useRF logical
535 <    std::string myMethod = simParams_->getElectrostaticSummationMethod();
536 <    if (myMethod == "REACTION_FIELD")
537 <      useRF = 1;
532 <    else
533 <      useRF = 0;
535 >    useRF = 0;
536 >    useDW = 0;
537 >
538  
539 +    if (simParams_->haveElectrostaticSummationMethod()) {
540 +      std::string myMethod = simParams_->getElectrostaticSummationMethod();
541 +      toUpper(myMethod);
542 +      if (myMethod == "REACTION_FIELD") {
543 +        useRF=1;
544 +      } else {
545 +        if (myMethod == "DAMPED_WOLF") {
546 +          useDW = 1;
547 +        }
548 +      }
549 +    }
550 +
551      //loop over all of the atom types
552      for (i = atomTypes.begin(); i != atomTypes.end(); ++i) {
553        useLennardJones |= (*i)->isLennardJones();
# Line 596 | Line 612 | namespace oopse {
612      temp = useRF;
613      MPI_Allreduce(&temp, &useRF, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
614  
615 +    temp = useDW;
616 +    MPI_Allreduce(&temp, &useDW, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);    
617 +
618   #endif
619  
620      fInfo_.SIM_uses_PBC = usePBC;    
# Line 611 | Line 630 | namespace oopse {
630      fInfo_.SIM_uses_Shapes = useShape;
631      fInfo_.SIM_uses_FLARB = useFLARB;
632      fInfo_.SIM_uses_RF = useRF;
633 +    fInfo_.SIM_uses_DampedWolf = useDW;
634  
635 <    if( fInfo_.SIM_uses_Dipoles && myMethod == "REACTION_FIELD") {
636 <
635 >    if( myMethod == "REACTION_FIELD") {
636 >      
637        if (simParams_->haveDielectric()) {
638          fInfo_.dielect = simParams_->getDielectric();
639        } else {
# Line 623 | Line 643 | namespace oopse {
643                  "\tsetting a dielectric constant!\n");
644          painCave.isFatal = 1;
645          simError();
646 <      }
627 <        
628 <    } else {
629 <      fInfo_.dielect = 0.0;
646 >      }      
647      }
648  
649    }
# Line 662 | Line 679 | namespace oopse {
679  
680          totalMass = cg->getMass();
681          for(atom = cg->beginAtom(ai); atom != NULL; atom = cg->nextAtom(ai)) {
682 <          mfact.push_back(atom->getMass()/totalMass);
682 >          // Check for massless groups - set mfact to 1 if true
683 >          if (totalMass != 0)
684 >            mfact.push_back(atom->getMass()/totalMass);
685 >          else
686 >            mfact.push_back( 1.0 );
687          }
688  
689        }      
# Line 798 | Line 819 | namespace oopse {
819      
820      if (fInfo_.SIM_uses_Charges | fInfo_.SIM_uses_Dipoles | fInfo_.SIM_uses_RF) {
821          
822 <      if (!simParams_->haveRcut()){
822 >      if (!simParams_->haveCutoffRadius()){
823          sprintf(painCave.errMsg,
824                  "SimCreator Warning: No value was set for the cutoffRadius.\n"
825                  "\tOOPSE will use a default value of 15.0 angstroms"
# Line 807 | Line 828 | namespace oopse {
828          simError();
829          rcut = 15.0;
830        } else{
831 <        rcut = simParams_->getRcut();
831 >        rcut = simParams_->getCutoffRadius();
832        }
833  
834 <      if (!simParams_->haveRsw()){
834 >      if (!simParams_->haveSwitchingRadius()){
835          sprintf(painCave.errMsg,
836                  "SimCreator Warning: No value was set for switchingRadius.\n"
837                  "\tOOPSE will use a default value of\n"
838 <                "\t0.95 * cutoffRadius for the switchingRadius\n");
838 >                "\t0.85 * cutoffRadius for the switchingRadius\n");
839          painCave.isFatal = 0;
840          simError();
841 <        rsw = 0.95 * rcut;
841 >        rsw = 0.85 * rcut;
842        } else{
843 <        rsw = simParams_->getRsw();
843 >        rsw = simParams_->getSwitchingRadius();
844        }
845  
846      } else {
847        // if charge, dipole or reaction field is not used and the cutofff radius is not specified in
848        //meta-data file, the maximum cutoff radius calculated from forcefiled will be used
849          
850 <      if (simParams_->haveRcut()) {
851 <        rcut = simParams_->getRcut();
850 >      if (simParams_->haveCutoffRadius()) {
851 >        rcut = simParams_->getCutoffRadius();
852        } else {
853          //set cutoff radius to the maximum cutoff radius based on atom types in the whole system
854          rcut = calcMaxCutoffRadius();
855        }
856  
857 <      if (simParams_->haveRsw()) {
858 <        rsw  = simParams_->getRsw();
857 >      if (simParams_->haveSwitchingRadius()) {
858 >        rsw  = simParams_->getSwitchingRadius();
859        } else {
860          rsw = rcut;
861        }
# Line 851 | Line 872 | namespace oopse {
872      int cp =  TRADITIONAL_CUTOFF_POLICY;
873      if (simParams_->haveCutoffPolicy()) {
874        std::string myPolicy = simParams_->getCutoffPolicy();
875 +      toUpper(myPolicy);
876        if (myPolicy == "MIX") {
877          cp = MIX_CUTOFF_POLICY;
878        } else {
# Line 877 | Line 899 | namespace oopse {
899  
900      notifyFortranCutoffs(&rcut_, &rsw_, &rnblist, &cp);
901      // also send cutoff notification to electrostatics
902 <    setElectrostaticCutoffRadius(&rcut_);
902 >    setElectrostaticCutoffRadius(&rcut_, &rsw_);
903    }
904  
905    void SimInfo::setupElectrostaticSummationMethod( int isError ) {    
# Line 893 | Line 915 | namespace oopse {
915  
916      if (simParams_->haveElectrostaticSummationMethod()) {
917        std::string myMethod = simParams_->getElectrostaticSummationMethod();
918 +      toUpper(myMethod);
919        if (myMethod == "NONE") {
920          esm = NONE;
921        } else {
# Line 909 | Line 932 | namespace oopse {
932                simError();
933              }
934            } else {
935 <            if (myMethod == "REACTION_FIELD") {
935 >            if (myMethod == "REACTION_FIELD") {      
936                esm = REACTION_FIELD;
937              } else {
938                // throw error        

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines