1 |
< |
/* |
1 |
> |
/* |
2 |
|
* Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
3 |
|
* |
4 |
|
* The University of Notre Dame grants you ("Licensee") a |
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" |
74 |
|
" | ____ ____ ____ _____ ______ The OpenSource, Object-oriented |\n" << |
75 |
|
" | / __ \\/ __ \\/ __ \\/ ___// ____/ Parallel Simulation Engine. |\n" << |
76 |
|
" | / / / / / / / /_/ /\\__ \\/ __/ |\n" << |
77 |
< |
" | / /_/ / /_/ / ____/___/ / /___ Copyright 2004 by the |\n" << |
77 |
> |
" | / /_/ / /_/ / ____/___/ / /___ Copyright 2004-2005 by the |\n" << |
78 |
|
" | \\____/\\____/_/ /____/_____/ University of Notre Dame. |\n" << |
78 |
– |
" | http://www.oopse.org |\n" << |
79 |
|
" | |\n" << |
80 |
+ |
" | version " << |
81 |
+ |
OOPSE_VERSION_MAJOR << "." << OOPSE_VERSION_MINOR << "." << OOPSE_VERSION_TINY << |
82 |
+ |
" http://www.oopse.org |\n" << |
83 |
+ |
" | |\n" << |
84 |
|
" | OOPSE is an OpenScience project. All source code is available for |\n" << |
85 |
|
" | any use subject to only one condition: |\n" << |
86 |
|
" | |\n" << |
107 |
|
|
108 |
|
|
109 |
|
|
110 |
< |
//register forcefields, integrators and minimizers |
111 |
< |
registerAll(); |
110 |
> |
//register forcefields, integrators and minimizers |
111 |
> |
registerAll(); |
112 |
|
|
113 |
< |
//create simulation model |
114 |
< |
SimCreator creator; |
115 |
< |
SimInfo* info = creator.createSim(argv[1]); |
116 |
< |
Globals* simParams = info->getSimParams(); |
113 |
> |
//create simulation model |
114 |
> |
SimCreator creator; |
115 |
> |
SimInfo* info = creator.createSim(argv[1]); |
116 |
> |
Globals* simParams = info->getSimParams(); |
117 |
|
|
118 |
< |
if (simParams->haveMinimizer() && simParams->haveEnsemble()) { |
119 |
< |
sprintf(painCave.errMsg, "Minimizer keyword and Ensemble keyword can not exist together\n"); |
120 |
< |
painCave.isFatal = 1; |
121 |
< |
simError(); |
122 |
< |
} |
118 |
> |
if (simParams->haveMinimizer() && simParams->haveEnsemble()) { |
119 |
> |
sprintf(painCave.errMsg, "Minimizer keyword and Ensemble keyword can not exist together\n"); |
120 |
> |
painCave.isFatal = 1; |
121 |
> |
simError(); |
122 |
> |
} |
123 |
|
|
124 |
< |
if (simParams->haveMinimizer()) { |
125 |
< |
//create minimizer |
126 |
< |
Minimizer* myMinimizer = MinimizerFactory::getInstance()->createMinimizer(simParams->getMinimizer(), info); |
124 |
> |
if (simParams->haveMinimizer()) { |
125 |
> |
//create minimizer |
126 |
> |
Minimizer* myMinimizer = MinimizerFactory::getInstance()->createMinimizer(toUpperCopy(simParams->getMinimizer()), info); |
127 |
|
|
128 |
< |
if (myMinimizer == NULL) { |
129 |
< |
sprintf(painCave.errMsg, "Minimizer Factory can not create %s Minimizer\n", |
130 |
< |
simParams->getMinimizer()); |
131 |
< |
painCave.isFatal = 1; |
132 |
< |
simError(); |
133 |
< |
} |
128 |
> |
if (myMinimizer == NULL) { |
129 |
> |
sprintf(painCave.errMsg, "Minimizer Factory can not create %s Minimizer\n", |
130 |
> |
simParams->getMinimizer().c_str()); |
131 |
> |
painCave.isFatal = 1; |
132 |
> |
simError(); |
133 |
> |
} |
134 |
|
|
135 |
< |
myMinimizer->minimize(); |
136 |
< |
delete myMinimizer; |
137 |
< |
} else if (simParams->haveEnsemble()) { |
138 |
< |
//create Integrator |
135 |
> |
myMinimizer->minimize(); |
136 |
> |
delete myMinimizer; |
137 |
> |
} else if (simParams->haveEnsemble()) { |
138 |
> |
//create Integrator |
139 |
|
|
140 |
< |
Integrator* myIntegrator = IntegratorFactory::getInstance()->createIntegrator(simParams->getEnsemble(), info); |
141 |
< |
|
142 |
< |
if (myIntegrator == NULL) { |
143 |
< |
sprintf(painCave.errMsg, "Integrator Factory can not create %s Integrator\n", |
144 |
< |
simParams->getEnsemble()); |
145 |
< |
painCave.isFatal = 1; |
146 |
< |
simError(); |
147 |
< |
} |
140 |
> |
Integrator* myIntegrator = IntegratorFactory::getInstance()->createIntegrator(toUpperCopy(simParams->getEnsemble()), info); |
141 |
> |
|
142 |
> |
if (myIntegrator == NULL) { |
143 |
> |
sprintf(painCave.errMsg, "Integrator Factory can not create %s Integrator\n", |
144 |
> |
simParams->getEnsemble().c_str()); |
145 |
> |
painCave.isFatal = 1; |
146 |
> |
simError(); |
147 |
> |
} |
148 |
|
|
149 |
< |
//Thermodynamic Integration Method |
150 |
< |
//ForceManager* fman = new ThermodynamicForceManager(info); |
151 |
< |
//myIntegrator->setForceManager(fman); |
149 |
> |
//Thermodynamic Integration Method |
150 |
> |
//ForceManager* fman = new ThermodynamicForceManager(info); |
151 |
> |
//myIntegrator->setForceManager(fman); |
152 |
|
|
153 |
|
|
154 |
< |
//Zconstraint-Method |
155 |
< |
if (simParams->haveZconstraints()) { |
156 |
< |
info->setNZconstraint(simParams->getNzConstraints()); |
157 |
< |
ForceManager* fman = new ZconstraintForceManager(info); |
158 |
< |
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(); |
154 |
> |
//Zconstraint-Method |
155 |
> |
if (simParams->haveNZconstraints()) { |
156 |
> |
info->setNZconstraint(simParams->getNZconstraints()); |
157 |
> |
ForceManager* fman = new ZconstraintForceManager(info); |
158 |
> |
myIntegrator->setForceManager(fman); |
159 |
|
} |
160 |
+ |
|
161 |
+ |
myIntegrator->integrate(); |
162 |
+ |
delete myIntegrator; |
163 |
+ |
}else { |
164 |
+ |
sprintf(painCave.errMsg, "Integrator Factory can not create %s Integrator\n", |
165 |
+ |
simParams->getEnsemble().c_str()); |
166 |
+ |
painCave.isFatal = 1; |
167 |
+ |
simError(); |
168 |
+ |
} |
169 |
|
|
170 |
|
|
171 |
|
|
172 |
< |
delete info; |
172 |
> |
delete info; |
173 |
|
|
174 |
|
#ifdef IS_MPI |
175 |
< |
strcpy( checkPointMsg, "Oh what a lovely Tea Party!" ); |
175 |
> |
strcpy( checkPointMsg, "Yoikes! It worked!" ); |
176 |
|
MPIcheckPoint(); |
177 |
|
|
178 |
|
MPI_Finalize(); |