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 |
|
|
1714 |
|
|
1715 |
|
void SimSetup::makeMinimizer(){ |
1716 |
|
|
1717 |
< |
OOPSEMinimizerBase* myOOPSEMinimizerBase; |
1717 |
< |
ObjFunctor1 * objFunc; |
1718 |
< |
OutputFunctor* outputFunc; |
1719 |
< |
ConcreteNLModel1* nlp; |
1717 |
> |
OOPSEMinimizer* myOOPSEMinimizer; |
1718 |
|
MinimizerParameterSet* param; |
1719 |
< |
ConjugateMinimizerBase* minimizer; |
1722 |
< |
int dim; |
1719 |
> |
char minimizerName[100]; |
1720 |
|
|
1721 |
|
for (int i = 0; i < nInfo; i++){ |
1722 |
< |
//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 |
< |
|
1722 |
> |
|
1723 |
|
//prepare parameter set for minimizer |
1724 |
|
param = new MinimizerParameterSet(); |
1725 |
|
param->setDefaultParameter(); |
1744 |
|
param->setWriteFrq(globals->getMinWriteFrq()); |
1745 |
|
} |
1746 |
|
|
1747 |
< |
if (globals->haveMinResetFrq()){ |
1748 |
< |
param->setResetFrq(globals->getMinResetFrq()); |
1747 |
> |
if (globals->haveMinStepSize()){ |
1748 |
> |
param->setStepSize(globals->getMinStepSize()); |
1749 |
|
} |
1750 |
|
|
1751 |
|
if (globals->haveMinLSMaxIter()){ |
1755 |
|
if (globals->haveMinLSTol()){ |
1756 |
|
param->setLineSearchTol(globals->getMinLSTol()); |
1757 |
|
} |
1775 |
– |
|
1776 |
– |
//creat the minimizer |
1777 |
– |
minimizer = new PRCGMinimizer(nlp, param); |
1778 |
– |
minimizer->setLineSearchStrategy(nlp, GoldenSection); |
1779 |
– |
minimizer->setOutputFunctor(outputFunc); |
1758 |
|
|
1759 |
+ |
strcpy(ensemble, globals->getMinimizer()); |
1760 |
+ |
|
1761 |
+ |
if (!strcasecmp(minimizerName, "CG")){ |
1762 |
+ |
myOOPSEMinimizer = new PRCGMinimizer(&(info[i]), the_ff, param); |
1763 |
+ |
} |
1764 |
+ |
else if (!strcasecmp(minimizerName, "SD")){ |
1765 |
+ |
//myOOPSEMinimizer = MinimizerFactory.creatMinimizer("", &(info[i]), the_ff, param); |
1766 |
+ |
myOOPSEMinimizer = new SDMinimizer(&(info[i]), the_ff, param); |
1767 |
+ |
} |
1768 |
+ |
else{ |
1769 |
+ |
info[i].the_integrator = myOOPSEMinimizer; |
1770 |
+ |
} |
1771 |
+ |
|
1772 |
|
//store the minimizer into simInfo |
1773 |
< |
info[i].the_minimizer = minimizer; |
1773 |
> |
info[i].the_minimizer = myOOPSEMinimizer; |
1774 |
|
info[i].has_minimizer = true; |
1775 |
|
} |
1776 |
|
|