| 9 | 
  | 
#include "parse_me.h" | 
| 10 | 
  | 
#include "Integrator.hpp" | 
| 11 | 
  | 
#include "simError.h" | 
| 12 | 
< | 
#include "ConjugateMinimizer.hpp" | 
| 12 | 
> | 
//#include "ConjugateMinimizer.hpp" | 
| 13 | 
> | 
#include "OOPSEMinimizer.hpp" | 
| 14 | 
  | 
 | 
| 15 | 
  | 
#ifdef IS_MPI | 
| 16 | 
  | 
#include "mpiBASS.h" | 
| 29 | 
  | 
#define FF_DUFF  0 | 
| 30 | 
  | 
#define FF_LJ    1 | 
| 31 | 
  | 
#define FF_EAM   2 | 
| 32 | 
< | 
#define FF_H2O 3 | 
| 32 | 
> | 
#define FF_H2O   3 | 
| 33 | 
  | 
 | 
| 34 | 
  | 
using namespace std; | 
| 35 | 
  | 
 | 
| 1663 | 
  | 
  } | 
| 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 | 
| 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 | 
  | 
 | 
| 1741 | 
  | 
} | 
| 1742 | 
  | 
 | 
| 1743 | 
  | 
void SimSetup::makeMinimizer(){ | 
| 1744 | 
< | 
/*   | 
| 1745 | 
< | 
  OOPSEMinimizerBase* myOOPSEMinimizerBase; | 
| 1717 | 
< | 
  ObjFunctor1 * objFunc; | 
| 1718 | 
< | 
  OutputFunctor* outputFunc; | 
| 1719 | 
< | 
  ConcreteNLModel1* nlp; | 
| 1744 | 
> | 
 | 
| 1745 | 
> | 
  OOPSEMinimizer* myOOPSEMinimizer; | 
| 1746 | 
  | 
  MinimizerParameterSet* param; | 
| 1747 | 
< | 
  ConjugateMinimizerBase* minimizer; | 
| 1722 | 
< | 
  int dim; | 
| 1747 | 
> | 
  char minimizerName[100]; | 
| 1748 | 
  | 
   | 
| 1749 | 
  | 
  for (int i = 0; i < nInfo; i++){ | 
| 1750 | 
< | 
    //creat | 
| 1726 | 
< | 
    myOOPSEMinimizerBase = new OOPSEMinimizerBase(&(info[i]), the_ff); | 
| 1727 | 
< | 
 | 
| 1728 | 
< | 
    //creat the object functor; | 
| 1729 | 
< | 
    objFunc = (ObjFunctor1*) new ClassMemObjFunctor1<OOPSEMinimizerBase> | 
| 1730 | 
< | 
                                              (myOOPSEMinimizerBase, &OOPSEMinimizerBase::calcGradient); | 
| 1731 | 
< | 
 | 
| 1732 | 
< | 
    //creat output functor; | 
| 1733 | 
< | 
    outputFunc =  new ClassMemOutputFunctor<OOPSEMinimizerBase> | 
| 1734 | 
< | 
                               (myOOPSEMinimizerBase, &OOPSEMinimizerBase::output); | 
| 1735 | 
< | 
 | 
| 1736 | 
< | 
    //creat nonlinear model | 
| 1737 | 
< | 
    dim = myOOPSEMinimizerBase->getDim();     | 
| 1738 | 
< | 
    nlp = new ConcreteNLModel1(dim, objFunc); | 
| 1739 | 
< | 
 | 
| 1750 | 
> | 
     | 
| 1751 | 
  | 
    //prepare parameter set for minimizer | 
| 1752 | 
  | 
    param = new MinimizerParameterSet(); | 
| 1753 | 
  | 
    param->setDefaultParameter(); | 
| 1772 | 
  | 
      param->setWriteFrq(globals->getMinWriteFrq()); | 
| 1773 | 
  | 
    } | 
| 1774 | 
  | 
     | 
| 1775 | 
< | 
    if (globals->haveMinResetFrq()){ | 
| 1776 | 
< | 
      param->setResetFrq(globals->getMinResetFrq()); | 
| 1775 | 
> | 
    if (globals->haveMinStepSize()){ | 
| 1776 | 
> | 
      param->setStepSize(globals->getMinStepSize()); | 
| 1777 | 
  | 
    } | 
| 1778 | 
  | 
 | 
| 1779 | 
  | 
    if (globals->haveMinLSMaxIter()){ | 
| 1783 | 
  | 
    if (globals->haveMinLSTol()){ | 
| 1784 | 
  | 
      param->setLineSearchTol(globals->getMinLSTol()); | 
| 1785 | 
  | 
    }      | 
| 1775 | 
– | 
     | 
| 1776 | 
– | 
     //creat the minimizer | 
| 1777 | 
– | 
     minimizer = new PRCGMinimizer(nlp, param); | 
| 1778 | 
– | 
     minimizer->setLineSearchStrategy(nlp, GoldenSection); | 
| 1779 | 
– | 
     minimizer->setOutputFunctor(outputFunc); | 
| 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 = minimizer; | 
| 1807 | 
> | 
     info[i].the_minimizer = myOOPSEMinimizer; | 
| 1808 | 
  | 
     info[i].has_minimizer = true; | 
| 1809 | 
  | 
  } | 
| 1810 | 
< | 
*/ | 
| 1810 | 
> | 
 | 
| 1811 | 
  | 
} |