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