9 |
|
#include "parse_me.h" |
10 |
|
#include "Integrator.hpp" |
11 |
|
#include "simError.h" |
12 |
+ |
#include "ConjugateMinimizer.hpp" |
13 |
|
|
14 |
|
#ifdef IS_MPI |
15 |
|
#include "mpiBASS.h" |
25 |
|
#define NPTxyz_ENS 4 |
26 |
|
|
27 |
|
|
28 |
< |
#define FF_DUFF 0 |
29 |
< |
#define FF_LJ 1 |
30 |
< |
#define FF_EAM 2 |
28 |
> |
#define FF_DUFF 0 |
29 |
> |
#define FF_LJ 1 |
30 |
> |
#define FF_EAM 2 |
31 |
> |
#define FF_H2O 3 |
32 |
|
|
33 |
|
using namespace std; |
34 |
|
|
146 |
|
|
147 |
|
makeOutNames(); |
148 |
|
|
149 |
< |
// make the integrator |
150 |
< |
|
151 |
< |
makeIntegrator(); |
152 |
< |
|
149 |
> |
if (globals->haveMinimizer()) |
150 |
> |
// make minimizer |
151 |
> |
makeMinimizer(); |
152 |
> |
else |
153 |
> |
// make the integrator |
154 |
> |
makeIntegrator(); |
155 |
> |
|
156 |
|
#ifdef IS_MPI |
157 |
|
mpiSim->mpiRefresh(); |
158 |
|
#endif |
640 |
|
else if (!strcasecmp(force_field, "EAM")){ |
641 |
|
ffCase = FF_EAM; |
642 |
|
} |
643 |
+ |
else if (!strcasecmp(force_field, "WATER")){ |
644 |
+ |
ffCase = FF_H2O; |
645 |
+ |
} |
646 |
|
else{ |
647 |
|
sprintf(painCave.errMsg, "SimSetup Error. Unrecognized force field -> %s\n", |
648 |
|
force_field); |
845 |
|
for (int i = 0; i < nInfo; i++){ |
846 |
|
info[i].setSeed(seedValue); |
847 |
|
} |
848 |
< |
|
848 |
> |
|
849 |
|
#ifdef IS_MPI |
850 |
< |
strcpy(checkPointMsg, "Succesfully gathered all information from Bass\n"); |
850 |
> |
strcpy(checkPointMsg, "Successfully gathered all information from Bass\n"); |
851 |
|
MPIcheckPoint(); |
852 |
|
#endif // is_mpi |
853 |
|
} |
1142 |
|
|
1143 |
|
case FF_EAM: |
1144 |
|
the_ff = new EAM_FF(); |
1145 |
+ |
break; |
1146 |
+ |
|
1147 |
+ |
case FF_H2O: |
1148 |
+ |
the_ff = new WATER(); |
1149 |
|
break; |
1150 |
|
|
1151 |
|
default: |
1709 |
|
|
1710 |
|
//push data into siminfo, therefore, we can retrieve later |
1711 |
|
theInfo.addProperty(zconsParaData); |
1712 |
+ |
} |
1713 |
+ |
|
1714 |
+ |
void SimSetup::makeMinimizer(){ |
1715 |
+ |
/* |
1716 |
+ |
OOPSEMinimizerBase* myOOPSEMinimizerBase; |
1717 |
+ |
ObjFunctor1 * objFunc; |
1718 |
+ |
OutputFunctor* outputFunc; |
1719 |
+ |
ConcreteNLModel1* nlp; |
1720 |
+ |
MinimizerParameterSet* param; |
1721 |
+ |
ConjugateMinimizerBase* minimizer; |
1722 |
+ |
int dim; |
1723 |
+ |
|
1724 |
+ |
for (int i = 0; i < nInfo; i++){ |
1725 |
+ |
//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 |
+ |
|
1740 |
+ |
//prepare parameter set for minimizer |
1741 |
+ |
param = new MinimizerParameterSet(); |
1742 |
+ |
param->setDefaultParameter(); |
1743 |
+ |
|
1744 |
+ |
if (globals->haveMinimizer()){ |
1745 |
+ |
param->setFTol(globals->getMinFTol()); |
1746 |
+ |
} |
1747 |
+ |
|
1748 |
+ |
if (globals->haveMinGTol()){ |
1749 |
+ |
param->setGTol(globals->getMinGTol()); |
1750 |
+ |
} |
1751 |
+ |
|
1752 |
+ |
if (globals->haveMinMaxIter()){ |
1753 |
+ |
param->setMaxIteration(globals->getMinMaxIter()); |
1754 |
+ |
} |
1755 |
+ |
|
1756 |
+ |
if (globals->haveMinWriteFrq()){ |
1757 |
+ |
param->setMaxIteration(globals->getMinMaxIter()); |
1758 |
+ |
} |
1759 |
+ |
|
1760 |
+ |
if (globals->haveMinWriteFrq()){ |
1761 |
+ |
param->setWriteFrq(globals->getMinWriteFrq()); |
1762 |
+ |
} |
1763 |
+ |
|
1764 |
+ |
if (globals->haveMinResetFrq()){ |
1765 |
+ |
param->setResetFrq(globals->getMinResetFrq()); |
1766 |
+ |
} |
1767 |
+ |
|
1768 |
+ |
if (globals->haveMinLSMaxIter()){ |
1769 |
+ |
param->setLineSearchMaxIteration(globals->getMinLSMaxIter()); |
1770 |
+ |
} |
1771 |
+ |
|
1772 |
+ |
if (globals->haveMinLSTol()){ |
1773 |
+ |
param->setLineSearchTol(globals->getMinLSTol()); |
1774 |
+ |
} |
1775 |
+ |
|
1776 |
+ |
//creat the minimizer |
1777 |
+ |
minimizer = new PRCGMinimizer(nlp, param); |
1778 |
+ |
minimizer->setLineSearchStrategy(nlp, GoldenSection); |
1779 |
+ |
minimizer->setOutputFunctor(outputFunc); |
1780 |
+ |
|
1781 |
+ |
//store the minimizer into simInfo |
1782 |
+ |
info[i].the_minimizer = minimizer; |
1783 |
+ |
info[i].has_minimizer = true; |
1784 |
+ |
} |
1785 |
+ |
*/ |
1786 |
|
} |