1 |
< |
/* |
2 |
< |
* Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
1 |
> |
/* |
2 |
> |
* Copyright (c) 2006 The University of Notre Dame. All Rights Reserved. |
3 |
|
* |
4 |
|
* The University of Notre Dame grants you ("Licensee") a |
5 |
|
* non-exclusive, royalty free, license to use, modify and |
44 |
|
#endif |
45 |
|
|
46 |
|
#include "utils/simError.h" |
47 |
+ |
#include "utils/CaseConversion.hpp" |
48 |
|
#include "brains/Register.hpp" |
49 |
|
#include "brains/SimCreator.hpp" |
50 |
|
#include "brains/SimInfo.hpp" |
53 |
|
#include "integrators/Integrator.hpp" |
54 |
|
#include "minimizers/MinimizerFactory.hpp" |
55 |
|
#include "minimizers/Minimizer.hpp" |
56 |
+ |
#include "restraints/ThermoIntegrationForceManager.hpp" |
57 |
+ |
|
58 |
|
using namespace oopse; |
59 |
|
|
60 |
|
int main(int argc,char* argv[]){ |
76 |
|
" | ____ ____ ____ _____ ______ The OpenSource, Object-oriented |\n" << |
77 |
|
" | / __ \\/ __ \\/ __ \\/ ___// ____/ Parallel Simulation Engine. |\n" << |
78 |
|
" | / / / / / / / /_/ /\\__ \\/ __/ |\n" << |
79 |
< |
" | / /_/ / /_/ / ____/___/ / /___ Copyright 2004 by the |\n" << |
79 |
> |
" | / /_/ / /_/ / ____/___/ / /___ Copyright 2004-2006 by the |\n" << |
80 |
|
" | \\____/\\____/_/ /____/_____/ University of Notre Dame. |\n" << |
78 |
– |
" | http://www.oopse.org |\n" << |
81 |
|
" | |\n" << |
82 |
+ |
" | version " << |
83 |
+ |
OOPSE_VERSION_MAJOR << "." << OOPSE_VERSION_MINOR << "." << OOPSE_VERSION_TINY << |
84 |
+ |
" http://www.oopse.org |\n" << |
85 |
+ |
" | |\n" << |
86 |
|
" | OOPSE is an OpenScience project. All source code is available for |\n" << |
87 |
|
" | any use subject to only one condition: |\n" << |
88 |
|
" | |\n" << |
109 |
|
|
110 |
|
|
111 |
|
|
112 |
< |
//register forcefields, integrators and minimizers |
113 |
< |
registerAll(); |
112 |
> |
//register forcefields, integrators and minimizers |
113 |
> |
registerAll(); |
114 |
|
|
115 |
< |
//create simulation model |
116 |
< |
SimCreator creator; |
117 |
< |
SimInfo* info = creator.createSim(argv[1]); |
118 |
< |
Globals* simParams = info->getSimParams(); |
115 |
> |
//create simulation model |
116 |
> |
SimCreator creator; |
117 |
> |
SimInfo* info = creator.createSim(argv[1]); |
118 |
> |
Globals* simParams = info->getSimParams(); |
119 |
|
|
120 |
< |
if (simParams->haveMinimizer() && simParams->haveEnsemble()) { |
121 |
< |
sprintf(painCave.errMsg, "Minimizer keyword and Ensemble keyword can not exist together\n"); |
122 |
< |
painCave.isFatal = 1; |
123 |
< |
simError(); |
124 |
< |
} |
120 |
> |
if (simParams->haveMinimizer() && simParams->haveEnsemble()) { |
121 |
> |
sprintf(painCave.errMsg, "Minimizer keyword and Ensemble keyword can not exist together\n"); |
122 |
> |
painCave.isFatal = 1; |
123 |
> |
simError(); |
124 |
> |
} |
125 |
|
|
126 |
< |
if (simParams->haveMinimizer()) { |
127 |
< |
//create minimizer |
128 |
< |
Minimizer* myMinimizer = MinimizerFactory::getInstance()->createMinimizer(simParams->getMinimizer(), info); |
126 |
> |
if (simParams->haveMinimizer()) { |
127 |
> |
//create minimizer |
128 |
> |
Minimizer* myMinimizer = MinimizerFactory::getInstance()->createMinimizer(toUpperCopy(simParams->getMinimizer()), info); |
129 |
|
|
130 |
< |
if (myMinimizer == NULL) { |
131 |
< |
sprintf(painCave.errMsg, "Minimizer Factory can not create %s Minimizer\n", |
132 |
< |
simParams->getMinimizer()); |
133 |
< |
painCave.isFatal = 1; |
134 |
< |
simError(); |
135 |
< |
} |
130 |
> |
if (myMinimizer == NULL) { |
131 |
> |
sprintf(painCave.errMsg, "Minimizer Factory can not create %s Minimizer\n", |
132 |
> |
simParams->getMinimizer().c_str()); |
133 |
> |
painCave.isFatal = 1; |
134 |
> |
simError(); |
135 |
> |
} |
136 |
|
|
137 |
< |
myMinimizer->minimize(); |
138 |
< |
delete myMinimizer; |
139 |
< |
} else if (simParams->haveEnsemble()) { |
140 |
< |
//create Integrator |
137 |
> |
myMinimizer->minimize(); |
138 |
> |
delete myMinimizer; |
139 |
> |
} else if (simParams->haveEnsemble()) { |
140 |
> |
//create Integrator |
141 |
|
|
142 |
< |
Integrator* myIntegrator = IntegratorFactory::getInstance()->createIntegrator(simParams->getEnsemble(), info); |
143 |
< |
|
144 |
< |
if (myIntegrator == NULL) { |
145 |
< |
sprintf(painCave.errMsg, "Integrator Factory can not create %s Integrator\n", |
146 |
< |
simParams->getEnsemble()); |
147 |
< |
painCave.isFatal = 1; |
148 |
< |
simError(); |
149 |
< |
} |
142 |
> |
Integrator* myIntegrator = IntegratorFactory::getInstance()->createIntegrator(toUpperCopy(simParams->getEnsemble()), info); |
143 |
> |
|
144 |
> |
if (myIntegrator == NULL) { |
145 |
> |
sprintf(painCave.errMsg, "Integrator Factory can not create %s Integrator\n", |
146 |
> |
simParams->getEnsemble().c_str()); |
147 |
> |
painCave.isFatal = 1; |
148 |
> |
simError(); |
149 |
> |
} |
150 |
|
|
151 |
< |
//Thermodynamic Integration Method |
152 |
< |
//ForceManager* fman = new ThermodynamicForceManager(info); |
153 |
< |
//myIntegrator->setForceManager(fman); |
151 |
> |
//Thermodynamic Integration Method |
152 |
> |
//set the force manager for thermodynamic integration if specified |
153 |
> |
if (simParams->getUseSolidThermInt() || simParams->getUseLiquidThermInt()){ |
154 |
> |
ForceManager* fman = new ThermoIntegrationForceManager(info); |
155 |
> |
myIntegrator->setForceManager(fman); |
156 |
> |
} |
157 |
|
|
158 |
< |
|
159 |
< |
//Zconstraint-Method |
160 |
< |
if (simParams->haveZconstraints()) { |
161 |
< |
info->setNZconstraint(simParams->getNzConstraints()); |
162 |
< |
ForceManager* fman = new ZconstraintForceManager(info); |
154 |
< |
myIntegrator->setForceManager(fman); |
155 |
< |
} |
156 |
< |
|
157 |
< |
myIntegrator->integrate(); |
158 |
< |
delete myIntegrator; |
159 |
< |
}else { |
160 |
< |
sprintf(painCave.errMsg, "Integrator Factory can not create %s Integrator\n", |
161 |
< |
simParams->getEnsemble()); |
162 |
< |
painCave.isFatal = 1; |
163 |
< |
simError(); |
158 |
> |
//Zconstraint-Method |
159 |
> |
if (simParams->getNZconsStamps() > 0) { |
160 |
> |
info->setNZconstraint(simParams->getNZconsStamps()); |
161 |
> |
ForceManager* fman = new ZconstraintForceManager(info); |
162 |
> |
myIntegrator->setForceManager(fman); |
163 |
|
} |
164 |
+ |
|
165 |
+ |
myIntegrator->integrate(); |
166 |
+ |
delete myIntegrator; |
167 |
+ |
}else { |
168 |
+ |
sprintf(painCave.errMsg, "Integrator Factory can not create %s Integrator\n", |
169 |
+ |
simParams->getEnsemble().c_str()); |
170 |
+ |
painCave.isFatal = 1; |
171 |
+ |
simError(); |
172 |
+ |
} |
173 |
|
|
174 |
|
|
175 |
|
|
176 |
< |
delete info; |
176 |
> |
delete info; |
177 |
|
|
178 |
|
#ifdef IS_MPI |
179 |
< |
strcpy( checkPointMsg, "Oh what a lovely Tea Party!" ); |
179 |
> |
strcpy( checkPointMsg, "Yoikes! It worked!" ); |
180 |
|
MPIcheckPoint(); |
181 |
|
|
182 |
|
MPI_Finalize(); |