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 984 by gezelter, Mon Jan 26 21:52:56 2004 UTC vs.
Revision 1093 by tim, Wed Mar 17 14:22:59 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 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 +  //set zconsUsingSMD
1686 +  IntData* zconsUsingSMD = new IntData();
1687 +  zconsUsingSMD->setID(ZCONSUSINGSMD_ID);
1688 +
1689 +  if (globals->haveZConsUsingSMD()){
1690 +    zconsUsingSMD->setData(globals->getZconsUsingSMD());
1691 +    theInfo.addProperty(zconsUsingSMD);  
1692 +  }
1693 +
1694    //Determine the name of ouput file and add it into SimInfo's property list
1695    //Be careful, do not use inFileName, since it is a pointer which
1696    //point to a string at master node, and slave nodes do not contain that string
# Line 1680 | Line 1720 | void SimSetup::setupZConstraint(SimInfo& theInfo){
1720      tempParaItem.zPos = zconStamp[i]->getZpos();
1721      tempParaItem.zconsIndex = zconStamp[i]->getMolIndex();
1722      tempParaItem.kRatio = zconStamp[i]->getKratio();
1723 <
1723 >    tempParaItem.havingCantVel = zconStamp[i]->haveCantVel();
1724 >    tempParaItem.cantVel = zconStamp[i]->getCantVel();    
1725      zconsParaData->addItem(tempParaItem);
1726    }
1727  
# Line 1698 | Line 1739 | void SimSetup::setupZConstraint(SimInfo& theInfo){
1739    //push data into siminfo, therefore, we can retrieve later
1740    theInfo.addProperty(zconsParaData);
1741   }
1742 +
1743 + void SimSetup::makeMinimizer(){
1744 +
1745 +  OOPSEMinimizer* myOOPSEMinimizer;
1746 +  MinimizerParameterSet* param;
1747 +  char minimizerName[100];
1748 +  
1749 +  for (int i = 0; i < nInfo; i++){
1750 +    
1751 +    //prepare parameter set for minimizer
1752 +    param = new MinimizerParameterSet();
1753 +    param->setDefaultParameter();
1754 +
1755 +    if (globals->haveMinimizer()){
1756 +      param->setFTol(globals->getMinFTol());
1757 +    }
1758 +
1759 +    if (globals->haveMinGTol()){
1760 +      param->setGTol(globals->getMinGTol());
1761 +    }
1762 +
1763 +    if (globals->haveMinMaxIter()){
1764 +      param->setMaxIteration(globals->getMinMaxIter());
1765 +    }
1766 +
1767 +    if (globals->haveMinWriteFrq()){
1768 +      param->setMaxIteration(globals->getMinMaxIter());
1769 +    }
1770 +
1771 +    if (globals->haveMinWriteFrq()){
1772 +      param->setWriteFrq(globals->getMinWriteFrq());
1773 +    }
1774 +    
1775 +    if (globals->haveMinStepSize()){
1776 +      param->setStepSize(globals->getMinStepSize());
1777 +    }
1778 +
1779 +    if (globals->haveMinLSMaxIter()){
1780 +      param->setLineSearchMaxIteration(globals->getMinLSMaxIter());
1781 +    }    
1782 +
1783 +    if (globals->haveMinLSTol()){
1784 +      param->setLineSearchTol(globals->getMinLSTol());
1785 +    }    
1786 +
1787 +    strcpy(minimizerName, globals->getMinimizer());
1788 +
1789 +    if (!strcasecmp(minimizerName, "CG")){
1790 +      myOOPSEMinimizer = new PRCGMinimizer(&(info[i]), the_ff, param);
1791 +    }
1792 +    else if (!strcasecmp(minimizerName, "SD")){
1793 +    //myOOPSEMinimizer = MinimizerFactory.creatMinimizer("", &(info[i]), the_ff, param);
1794 +      myOOPSEMinimizer = new SDMinimizer(&(info[i]), the_ff, param);
1795 +    }
1796 +    else{
1797 +          sprintf(painCave.errMsg,
1798 +                  "SimSetup error: Unrecognized Minimizer, use Conjugate Gradient \n");
1799 +          painCave.isFatal = 0;
1800 +          simError();
1801 +
1802 +      myOOPSEMinimizer = new PRCGMinimizer(&(info[i]), the_ff, param);          
1803 +    }
1804 +     info[i].the_integrator = myOOPSEMinimizer;
1805 +
1806 +     //store the minimizer into simInfo
1807 +     info[i].the_minimizer = myOOPSEMinimizer;
1808 +     info[i].has_minimizer = true;
1809 +  }
1810 +
1811 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines