| 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). |
| 39 |
< |
* [4] Vardeman & Gezelter, in progress (2010). |
| 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 |
| 55 |
|
#include "restraints/RestraintForceManager.hpp" |
| 56 |
|
#include "integrators/IntegratorFactory.hpp" |
| 57 |
|
#include "integrators/Integrator.hpp" |
| 58 |
< |
#include "minimizers/MinimizerFactory.hpp" |
| 59 |
< |
#include "minimizers/Minimizer.hpp" |
| 58 |
> |
#include "optimization/OptimizationFactory.hpp" |
| 59 |
> |
#include "optimization/Method.hpp" |
| 60 |
> |
#include "optimization/Constraint.hpp" |
| 61 |
> |
#include "optimization/Problem.hpp" |
| 62 |
> |
#include "optimization/PotentialEnergyObjectiveFunction.hpp" |
| 63 |
|
#include "restraints/ThermoIntegrationForceManager.hpp" |
| 64 |
|
|
| 65 |
|
using namespace OpenMD; |
| 66 |
+ |
using namespace QuantLib; |
| 67 |
|
|
| 62 |
– |
|
| 68 |
|
int main(int argc,char* argv[]){ |
| 69 |
|
|
| 70 |
|
// first things first, all of the initializations |
| 74 |
|
#endif |
| 75 |
|
|
| 76 |
|
initSimError(); // the error handler |
| 77 |
< |
srand48( 1337 ); // the random number generator. |
| 78 |
< |
|
| 77 |
> |
//srand48( 1337 ); // the random number generator. |
| 78 |
> |
|
| 79 |
> |
std::string svnrev; |
| 80 |
> |
//convert a macro from compiler to a string in c++ |
| 81 |
> |
STR_DEFINE(svnrev, SVN_REV ); |
| 82 |
> |
|
| 83 |
> |
std::string revision; |
| 84 |
> |
|
| 85 |
> |
if (!svnrev.empty()) { |
| 86 |
> |
revision.assign(" Revision: " + svnrev); |
| 87 |
> |
} |
| 88 |
> |
|
| 89 |
> |
revision.resize(19,' '); |
| 90 |
> |
|
| 91 |
|
#ifdef IS_MPI |
| 92 |
|
if( worldRank == 0 ){ |
| 93 |
|
#endif |
| 94 |
|
std::cerr << |
| 95 |
< |
" +-----------------------------------------------------------------------+\n"<< |
| 96 |
< |
" | ____ __ ___ ____ |\n"<< |
| 97 |
< |
" | / __ \\____ ___ ____ / |/ // __ \\ The Open Molecular Dynamics |\n"<< |
| 98 |
< |
" | / / / / __ \\/ _ \\/ __ \\ / /|_/ // / / / Engine (formerly OOPSE). |\n"<< |
| 99 |
< |
" | / /_/ / /_/ / __/ / / // / / // /_/ / |\n"<< |
| 100 |
< |
" | \\____/ .___/\\___/_/ /_//_/ /_//_____/ Copyright 2004-2010 by the |\n"<< |
| 101 |
< |
" | /_/ University of Notre Dame. |\n"<< |
| 102 |
< |
" | |\n"<< |
| 103 |
< |
" | version " << |
| 104 |
< |
OPENMD_VERSION_MAJOR << "." << OPENMD_VERSION_MINOR << "." << OPENMD_VERSION_TINY << |
| 105 |
< |
" http://www.openmd.net |\n"<< |
| 106 |
< |
" | |\n"<< |
| 107 |
< |
" | OpenMD is an OpenScience project. All source code is available for |\n"<< |
| 108 |
< |
" | any use whatsoever under a BSD-style license. |\n"<< |
| 109 |
< |
" | |\n"<< |
| 110 |
< |
" | Support OpenScience! If you use OpenMD or its source code in your |\n"<< |
| 111 |
< |
" | research, please cite the appropriate papers when you publish your |\n"<< |
| 112 |
< |
" | work. Good starting points are: |\n"<< |
| 113 |
< |
" | |\n"<< |
| 114 |
< |
" | [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). |\n"<< |
| 115 |
< |
" | [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). |\n"<< |
| 116 |
< |
" | [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). |\n"<< |
| 117 |
< |
" | [4] Vardeman & Gezelter, in progress (2010). |\n"<< |
| 118 |
< |
" +-----------------------------------------------------------------------+\n"<< |
| 95 |
> |
" +--------------------------------------------------------------------------+\n"<< |
| 96 |
> |
" | ____ __ ___ ____ |\n"<< |
| 97 |
> |
" | / __ \\____ ___ ____ / |/ // __ \\ The Open Molecular Dynamics |\n"<< |
| 98 |
> |
" | / / / / __ \\/ _ \\/ __ \\ / /|_/ // / / / Engine (formerly OOPSE). |\n"<< |
| 99 |
> |
" | / /_/ / /_/ / __/ / / // / / // /_/ / |\n"<< |
| 100 |
> |
" | \\____/ .___/\\___/_/ /_//_/ /_//_____/ Copyright 2004-2012 by the |\n"<< |
| 101 |
> |
" | /_/ University of Notre Dame. |\n"<< |
| 102 |
> |
" | |\n"<< |
| 103 |
> |
" | version " << |
| 104 |
> |
OPENMD_VERSION_MAJOR << "." << OPENMD_VERSION_MINOR << revision << |
| 105 |
> |
" http://www.openmd.net |\n"<< |
| 106 |
> |
" | |\n"<< |
| 107 |
> |
" | OpenMD is an OpenScience project. All source code is available for any |\n"<< |
| 108 |
> |
" | use whatsoever under a BSD-style license. |\n"<< |
| 109 |
> |
" | |\n"<< |
| 110 |
> |
" | Support OpenScience! If you use OpenMD or its source code in your |\n"<< |
| 111 |
> |
" | research, please cite the appropriate papers when you publish your work |\n"<< |
| 112 |
> |
" | Good starting points are: |\n"<< |
| 113 |
> |
" | |\n"<< |
| 114 |
> |
" | [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). |\n"<< |
| 115 |
> |
" | [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). |\n"<< |
| 116 |
> |
" | [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). |\n"<< |
| 117 |
> |
" | [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). |\n"<< |
| 118 |
> |
" | [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). |\n"<< |
| 119 |
> |
" | [6] Kuang & Gezelter, Mol. Phys., 110, 691-701 (2012). |\n"<< |
| 120 |
> |
" +--------------------------------------------------------------------------+\n"<< |
| 121 |
|
"\n"; |
| 122 |
|
|
| 123 |
|
if( argc < 2 ){ |
| 138 |
|
//create simulation model |
| 139 |
|
SimCreator creator; |
| 140 |
|
SimInfo* info = creator.createSim(argv[1]); |
| 141 |
+ |
|
| 142 |
|
Globals* simParams = info->getSimParams(); |
| 143 |
+ |
MinimizerParameters* miniPars = simParams->getMinimizerParameters(); |
| 144 |
|
|
| 145 |
< |
if (simParams->haveMinimizer() && simParams->haveEnsemble()) { |
| 146 |
< |
sprintf(painCave.errMsg, "Minimizer keyword and Ensemble keyword can not exist together\n"); |
| 145 |
> |
if (miniPars->getUseMinimizer() && simParams->haveEnsemble()) { |
| 146 |
> |
sprintf(painCave.errMsg, "Ensemble keyword can not co-exist with useMinimizer = \"true\" in the minimizer block\n"); |
| 147 |
|
painCave.isFatal = 1; |
| 148 |
|
simError(); |
| 149 |
|
} |
| 150 |
< |
|
| 151 |
< |
if (simParams->haveMinimizer()) { |
| 150 |
> |
|
| 151 |
> |
if (miniPars->getUseMinimizer()) { |
| 152 |
|
//create minimizer |
| 153 |
< |
Minimizer* myMinimizer = MinimizerFactory::getInstance()->createMinimizer(toUpperCopy(simParams->getMinimizer()), info); |
| 153 |
> |
OptimizationMethod* myMinimizer =OptimizationFactory::getInstance()->createOptimization(toUpperCopy(miniPars->getMethod()), info); |
| 154 |
|
|
| 155 |
|
if (myMinimizer == NULL) { |
| 156 |
< |
sprintf(painCave.errMsg, "Minimizer Factory can not create %s Minimizer\n", |
| 157 |
< |
simParams->getMinimizer().c_str()); |
| 156 |
> |
sprintf(painCave.errMsg, "Optimization Factory can not create %s OptimizationMethod\n", |
| 157 |
> |
miniPars->getMethod().c_str()); |
| 158 |
|
painCave.isFatal = 1; |
| 159 |
|
simError(); |
| 160 |
|
} |
| 161 |
|
|
| 162 |
< |
myMinimizer->minimize(); |
| 162 |
> |
ForceManager* fman = new ForceManager(info); |
| 163 |
> |
fman->initialize(); |
| 164 |
> |
|
| 165 |
> |
PotentialEnergyObjectiveFunction potObjf(info, fman); |
| 166 |
> |
DumpStatusFunction dsf(info); |
| 167 |
> |
DynamicVector<RealType> initCoords = potObjf.setInitialCoords(); |
| 168 |
> |
Problem problem(potObjf, *(new NoConstraint()), dsf, initCoords); |
| 169 |
> |
|
| 170 |
> |
|
| 171 |
> |
int maxIter = miniPars->getMaxIterations(); |
| 172 |
> |
int mssIter = miniPars->getMaxStationaryStateIterations(); |
| 173 |
> |
RealType rEps = miniPars->getRootEpsilon(); |
| 174 |
> |
RealType fEps = miniPars->getFunctionEpsilon(); |
| 175 |
> |
RealType gnEps = miniPars->getGradientNormEpsilon(); |
| 176 |
> |
|
| 177 |
> |
EndCriteria endCriteria(maxIter, mssIter, rEps, fEps, gnEps); |
| 178 |
> |
|
| 179 |
> |
myMinimizer->minimize(problem, endCriteria); |
| 180 |
> |
|
| 181 |
|
delete myMinimizer; |
| 182 |
|
} else if (simParams->haveEnsemble()) { |
| 183 |
|
//create Integrator |