ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/SimSetup.cpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/SimSetup.cpp (file contents):
Revision 983 by gezelter, Mon Jan 26 21:45:03 2004 UTC vs.
Revision 1091 by tim, Tue Mar 16 19:22:56 2004 UTC

# Line 9 | Line 9
9   #include "parse_me.h"
10   #include "Integrator.hpp"
11   #include "simError.h"
12 + //#include "ConjugateMinimizer.hpp"
13 + #include "OOPSEMinimizer.hpp"
14  
15   #ifdef IS_MPI
16   #include "mpiBASS.h"
# Line 24 | Line 26
26   #define NPTxyz_ENS     4
27  
28  
29 < #define FF_DUFF 0
30 < #define FF_LJ   1
31 < #define FF_EAM  2
29 > #define FF_DUFF  0
30 > #define FF_LJ    1
31 > #define FF_EAM   2
32 > #define FF_H2O   3
33  
34   using namespace std;
35  
# Line 144 | Line 147 | void SimSetup::createSim(void){
147  
148    makeOutNames();
149  
150 <  // make the integrator
151 <
152 <  makeIntegrator();
153 <
150 >  if (globals->haveMinimizer())
151 >    // make minimizer
152 >    makeMinimizer();
153 >  else
154 >    // make the integrator
155 >    makeIntegrator();
156 >  
157   #ifdef IS_MPI
158    mpiSim->mpiRefresh();
159   #endif
# Line 224 | Line 230 | void SimSetup::makeMolecules(void){
230            // in space using the three Euler angles.  We assume the standard
231            // unit vector was originally along the z axis below.
232  
233 <          phi = currentAtom->getEulerPhi();
234 <          theta = currentAtom->getEulerTheta();
235 <          psi = currentAtom->getEulerPsi();
233 >          phi = currentAtom->getEulerPhi() * M_PI / 180.0;
234 >          theta = currentAtom->getEulerTheta() * M_PI / 180.0;
235 >          psi = currentAtom->getEulerPsi()* M_PI / 180.0;
236              
237            Axx = (cos(phi) * cos(psi)) - (sin(phi) * cos(theta) * sin(psi));
238            Axy = (sin(phi) * cos(psi)) + (cos(phi) * cos(theta) * sin(psi));
# Line 635 | Line 641 | void SimSetup::gatherInfo(void){
641    else if (!strcasecmp(force_field, "EAM")){
642      ffCase = FF_EAM;
643    }
644 +  else if (!strcasecmp(force_field, "WATER")){
645 +    ffCase = FF_H2O;
646 +  }
647    else{
648      sprintf(painCave.errMsg, "SimSetup Error. Unrecognized force field -> %s\n",
649              force_field);
# Line 837 | Line 846 | void SimSetup::gatherInfo(void){
846    for (int i = 0; i < nInfo; i++){
847      info[i].setSeed(seedValue);
848    }
849 <
849 >  
850   #ifdef IS_MPI
851 <  strcpy(checkPointMsg, "Succesfully gathered all information from Bass\n");
851 >  strcpy(checkPointMsg, "Successfully gathered all information from Bass\n");
852    MPIcheckPoint();
853   #endif // is_mpi
854   }
# Line 1136 | Line 1145 | void SimSetup::createFF(void){
1145        the_ff = new EAM_FF();
1146        break;
1147  
1148 +    case FF_H2O:
1149 +      the_ff = new WATER();
1150 +      break;
1151 +
1152      default:
1153        sprintf(painCave.errMsg,
1154                "SimSetup Error. Unrecognized force field in case statement.\n");
# Line 1651 | Line 1664 | void SimSetup::setupZConstraint(SimInfo& theInfo){
1664  
1665    theInfo.addProperty(zconsForcePolicy);
1666  
1667 +  //set zcons gap
1668 +  DoubleData* zconsGap = new DoubleData();
1669 +  zconsGap->setID(ZCONSGAP_ID);
1670 +
1671 +  if (globals->haveZConsGap()){
1672 +    zconsGap->setData(globals->getZconsGap());
1673 +    theInfo.addProperty(zconsGap);  
1674 +  }
1675 +
1676 +  //set zcons fixtime
1677 +  DoubleData* zconsFixtime = new DoubleData();
1678 +  zconsFixtime->setID(ZCONSFIXTIME_ID);
1679 +
1680 +  if (globals->haveZConsFixTime()){
1681 +    zconsFixtime->setData(globals->getZconsFixtime());
1682 +    theInfo.addProperty(zconsFixtime);  
1683 +  }
1684 +
1685 +
1686    //Determine the name of ouput file and add it into SimInfo's property list
1687    //Be careful, do not use inFileName, since it is a pointer which
1688    //point to a string at master node, and slave nodes do not contain that string
# Line 1697 | Line 1729 | void SimSetup::setupZConstraint(SimInfo& theInfo){
1729    
1730    //push data into siminfo, therefore, we can retrieve later
1731    theInfo.addProperty(zconsParaData);
1732 + }
1733 +
1734 + void SimSetup::makeMinimizer(){
1735 +
1736 +  OOPSEMinimizer* myOOPSEMinimizer;
1737 +  MinimizerParameterSet* param;
1738 +  char minimizerName[100];
1739 +  
1740 +  for (int i = 0; i < nInfo; i++){
1741 +    
1742 +    //prepare parameter set for minimizer
1743 +    param = new MinimizerParameterSet();
1744 +    param->setDefaultParameter();
1745 +
1746 +    if (globals->haveMinimizer()){
1747 +      param->setFTol(globals->getMinFTol());
1748 +    }
1749 +
1750 +    if (globals->haveMinGTol()){
1751 +      param->setGTol(globals->getMinGTol());
1752 +    }
1753 +
1754 +    if (globals->haveMinMaxIter()){
1755 +      param->setMaxIteration(globals->getMinMaxIter());
1756 +    }
1757 +
1758 +    if (globals->haveMinWriteFrq()){
1759 +      param->setMaxIteration(globals->getMinMaxIter());
1760 +    }
1761 +
1762 +    if (globals->haveMinWriteFrq()){
1763 +      param->setWriteFrq(globals->getMinWriteFrq());
1764 +    }
1765 +    
1766 +    if (globals->haveMinStepSize()){
1767 +      param->setStepSize(globals->getMinStepSize());
1768 +    }
1769 +
1770 +    if (globals->haveMinLSMaxIter()){
1771 +      param->setLineSearchMaxIteration(globals->getMinLSMaxIter());
1772 +    }    
1773 +
1774 +    if (globals->haveMinLSTol()){
1775 +      param->setLineSearchTol(globals->getMinLSTol());
1776 +    }    
1777 +
1778 +    strcpy(minimizerName, globals->getMinimizer());
1779 +
1780 +    if (!strcasecmp(minimizerName, "CG")){
1781 +      myOOPSEMinimizer = new PRCGMinimizer(&(info[i]), the_ff, param);
1782 +    }
1783 +    else if (!strcasecmp(minimizerName, "SD")){
1784 +    //myOOPSEMinimizer = MinimizerFactory.creatMinimizer("", &(info[i]), the_ff, param);
1785 +      myOOPSEMinimizer = new SDMinimizer(&(info[i]), the_ff, param);
1786 +    }
1787 +    else{
1788 +          sprintf(painCave.errMsg,
1789 +                  "SimSetup error: Unrecognized Minimizer, use Conjugate Gradient \n");
1790 +          painCave.isFatal = 0;
1791 +          simError();
1792 +
1793 +      myOOPSEMinimizer = new PRCGMinimizer(&(info[i]), the_ff, param);          
1794 +    }
1795 +     info[i].the_integrator = myOOPSEMinimizer;
1796 +
1797 +     //store the minimizer into simInfo
1798 +     info[i].the_minimizer = myOOPSEMinimizer;
1799 +     info[i].has_minimizer = true;
1800 +  }
1801 +
1802   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines