| 35 |
|
* |
| 36 |
|
* [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). |
| 37 |
|
* [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). |
| 38 |
< |
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). |
| 38 |
> |
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). |
| 39 |
|
* [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). |
| 40 |
|
* [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). |
| 41 |
+ |
* [6] Kuang & Gezelter, Mol. Phys., 110, 691-701 (2012). |
| 42 |
|
*/ |
| 43 |
|
|
| 44 |
|
#ifdef IS_MPI |
| 46 |
|
#endif |
| 47 |
|
|
| 48 |
|
#include <fstream> |
| 49 |
+ |
#include <iostream> |
| 50 |
+ |
#include <locale> |
| 51 |
|
#include "utils/simError.h" |
| 52 |
|
#include "utils/CaseConversion.hpp" |
| 53 |
|
#include "brains/Register.hpp" |
| 67 |
|
using namespace OpenMD; |
| 68 |
|
using namespace QuantLib; |
| 69 |
|
|
| 70 |
< |
int main(int argc,char* argv[]){ |
| 70 |
> |
int main(int argc, char* argv[]){ |
| 71 |
|
|
| 72 |
|
// first things first, all of the initializations |
| 73 |
|
|
| 74 |
|
#ifdef IS_MPI |
| 75 |
< |
MPI_Init( &argc, &argv ); // the MPI communicators |
| 75 |
> |
MPI::Init( argc, argv ); // the MPI communicators |
| 76 |
|
#endif |
| 77 |
|
|
| 78 |
|
initSimError(); // the error handler |
| 79 |
< |
srand48( 1337 ); // the random number generator. |
| 79 |
> |
//srand48( 1337 ); // the random number generator. |
| 80 |
|
|
| 81 |
|
std::string svnrev; |
| 82 |
|
//convert a macro from compiler to a string in c++ |
| 99 |
|
" | / __ \\____ ___ ____ / |/ // __ \\ The Open Molecular Dynamics |\n"<< |
| 100 |
|
" | / / / / __ \\/ _ \\/ __ \\ / /|_/ // / / / Engine (formerly OOPSE). |\n"<< |
| 101 |
|
" | / /_/ / /_/ / __/ / / // / / // /_/ / |\n"<< |
| 102 |
< |
" | \\____/ .___/\\___/_/ /_//_/ /_//_____/ Copyright 2004-2012 by the |\n"<< |
| 102 |
> |
" | \\____/ .___/\\___/_/ /_//_/ /_//_____/ Copyright 2004-2013 by the |\n"<< |
| 103 |
|
" | /_/ University of Notre Dame. |\n"<< |
| 104 |
|
" | |\n"<< |
| 105 |
|
" | version " << |
| 115 |
|
" | |\n"<< |
| 116 |
|
" | [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). |\n"<< |
| 117 |
|
" | [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). |\n"<< |
| 118 |
< |
" | [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). |\n"<< |
| 118 |
> |
" | [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). |\n"<< |
| 119 |
|
" | [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). |\n"<< |
| 120 |
|
" | [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). |\n"<< |
| 121 |
< |
" | [6] Kuang & Gezelter, Mol. Phys., in press (2012). |\n"<< |
| 121 |
> |
" | [6] Kuang & Gezelter, Mol. Phys., 110, 691-701 (2012). |\n"<< |
| 122 |
|
" +--------------------------------------------------------------------------+\n"<< |
| 123 |
|
"\n"; |
| 124 |
|
|
| 142 |
|
SimInfo* info = creator.createSim(argv[1]); |
| 143 |
|
|
| 144 |
|
Globals* simParams = info->getSimParams(); |
| 145 |
+ |
MinimizerParameters* miniPars = simParams->getMinimizerParameters(); |
| 146 |
|
|
| 147 |
< |
if (simParams->haveMinimizer() && simParams->haveEnsemble()) { |
| 148 |
< |
sprintf(painCave.errMsg, "Minimizer keyword and Ensemble keyword can not exist together\n"); |
| 147 |
> |
if (miniPars->getUseMinimizer() && simParams->haveEnsemble()) { |
| 148 |
> |
sprintf(painCave.errMsg, "Ensemble keyword can not co-exist with useMinimizer = \"true\" in the minimizer block\n"); |
| 149 |
|
painCave.isFatal = 1; |
| 150 |
|
simError(); |
| 151 |
|
} |
| 148 |
– |
|
| 152 |
|
|
| 153 |
< |
if (simParams->haveMinimizer()) { |
| 153 |
> |
if (miniPars->getUseMinimizer()) { |
| 154 |
|
//create minimizer |
| 155 |
< |
OptimizationMethod* myMinimizer =OptimizationFactory::getInstance()->createOptimization(toUpperCopy(simParams->getMinimizer()), info); |
| 155 |
> |
OptimizationMethod* myMinimizer =OptimizationFactory::getInstance()->createOptimization(toUpperCopy(miniPars->getMethod()), info); |
| 156 |
|
|
| 157 |
|
if (myMinimizer == NULL) { |
| 158 |
|
sprintf(painCave.errMsg, "Optimization Factory can not create %s OptimizationMethod\n", |
| 159 |
< |
simParams->getMinimizer().c_str()); |
| 159 |
> |
miniPars->getMethod().c_str()); |
| 160 |
|
painCave.isFatal = 1; |
| 161 |
|
simError(); |
| 162 |
|
} |
| 168 |
|
DumpStatusFunction dsf(info); |
| 169 |
|
DynamicVector<RealType> initCoords = potObjf.setInitialCoords(); |
| 170 |
|
Problem problem(potObjf, *(new NoConstraint()), dsf, initCoords); |
| 168 |
– |
EndCriteria endCriteria(1000, 100, 1e-5, 1e-5, 1e-5); |
| 171 |
|
|
| 172 |
+ |
|
| 173 |
+ |
int maxIter = miniPars->getMaxIterations(); |
| 174 |
+ |
int mssIter = miniPars->getMaxStationaryStateIterations(); |
| 175 |
+ |
RealType rEps = miniPars->getRootEpsilon(); |
| 176 |
+ |
RealType fEps = miniPars->getFunctionEpsilon(); |
| 177 |
+ |
RealType gnEps = miniPars->getGradientNormEpsilon(); |
| 178 |
+ |
|
| 179 |
+ |
EndCriteria endCriteria(maxIter, mssIter, rEps, fEps, gnEps); |
| 180 |
+ |
|
| 181 |
|
myMinimizer->minimize(problem, endCriteria); |
| 182 |
|
|
| 183 |
|
delete myMinimizer; |
| 229 |
|
errorCheckPoint(); |
| 230 |
|
|
| 231 |
|
#ifdef IS_MPI |
| 232 |
< |
MPI_Finalize(); |
| 232 |
> |
MPI::Finalize(); |
| 233 |
|
#endif |
| 234 |
|
|
| 235 |
|
return 0 ; |