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 |
43 |
|
#include <mpi.h> |
44 |
|
#endif |
45 |
|
|
46 |
+ |
#include <fstream> |
47 |
|
#include "utils/simError.h" |
48 |
+ |
#include "utils/CaseConversion.hpp" |
49 |
|
#include "brains/Register.hpp" |
50 |
|
#include "brains/SimCreator.hpp" |
51 |
|
#include "brains/SimInfo.hpp" |
54 |
|
#include "integrators/Integrator.hpp" |
55 |
|
#include "minimizers/MinimizerFactory.hpp" |
56 |
|
#include "minimizers/Minimizer.hpp" |
57 |
+ |
#include "restraints/ThermoIntegrationForceManager.hpp" |
58 |
+ |
|
59 |
|
using namespace oopse; |
60 |
|
|
61 |
+ |
|
62 |
|
int main(int argc,char* argv[]){ |
63 |
< |
|
63 |
> |
|
64 |
|
// first things first, all of the initializations |
65 |
|
|
66 |
|
#ifdef IS_MPI |
78 |
|
" | ____ ____ ____ _____ ______ The OpenSource, Object-oriented |\n" << |
79 |
|
" | / __ \\/ __ \\/ __ \\/ ___// ____/ Parallel Simulation Engine. |\n" << |
80 |
|
" | / / / / / / / /_/ /\\__ \\/ __/ |\n" << |
81 |
< |
" | / /_/ / /_/ / ____/___/ / /___ Copyright 2004 by the |\n" << |
81 |
> |
" | / /_/ / /_/ / ____/___/ / /___ Copyright 2004-2008 by the |\n" << |
82 |
|
" | \\____/\\____/_/ /____/_____/ University of Notre Dame. |\n" << |
78 |
– |
" | http://www.oopse.org |\n" << |
83 |
|
" | |\n" << |
84 |
+ |
" | version " << |
85 |
+ |
OOPSE_VERSION_MAJOR << "." << OOPSE_VERSION_MINOR << "." << OOPSE_VERSION_TINY << |
86 |
+ |
" http://www.oopse.org |\n" << |
87 |
+ |
" | |\n" << |
88 |
|
" | OOPSE is an OpenScience project. All source code is available for |\n" << |
89 |
|
" | any use subject to only one condition: |\n" << |
90 |
|
" | |\n" << |
104 |
|
} |
105 |
|
#endif |
106 |
|
|
99 |
– |
#ifdef IS_MPI |
107 |
|
strcpy( checkPointMsg, "Successful number of arguments" ); |
108 |
< |
MPIcheckPoint(); |
102 |
< |
#endif |
108 |
> |
errorCheckPoint(); |
109 |
|
|
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(); |
117 |
|
|
118 |
< |
//register forcefields, integrators and minimizers |
119 |
< |
registerAll(); |
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(toUpperCopy(simParams->getMinimizer()), info); |
127 |
|
|
128 |
< |
//create simulation model |
129 |
< |
SimCreator creator; |
130 |
< |
SimInfo* info = creator.createSim(argv[1]); |
131 |
< |
Globals* simParams = info->getSimParams(); |
132 |
< |
|
114 |
< |
if (simParams->haveMinimizer() && simParams->haveEnsemble()) { |
115 |
< |
sprintf(painCave.errMsg, "Minimizer keyword and Ensemble keyword can not exist together\n"); |
116 |
< |
painCave.isFatal = 1; |
117 |
< |
simError(); |
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 |
|
} |
119 |
– |
|
120 |
– |
if (simParams->haveMinimizer()) { |
121 |
– |
//create minimizer |
122 |
– |
Minimizer* myMinimizer = MinimizerFactory::getInstance()->createMinimizer(simParams->getMinimizer(), info); |
134 |
|
|
135 |
< |
if (myMinimizer == NULL) { |
136 |
< |
sprintf(painCave.errMsg, "Minimizer Factory can not create %s Minimizer\n", |
137 |
< |
simParams->getMinimizer()); |
138 |
< |
painCave.isFatal = 1; |
128 |
< |
simError(); |
129 |
< |
} |
135 |
> |
myMinimizer->minimize(); |
136 |
> |
delete myMinimizer; |
137 |
> |
} else if (simParams->haveEnsemble()) { |
138 |
> |
//create Integrator |
139 |
|
|
140 |
< |
myMinimizer->minimize(); |
141 |
< |
delete myMinimizer; |
142 |
< |
} else if (simParams->haveEnsemble()) { |
143 |
< |
//create Integrator |
144 |
< |
|
145 |
< |
Integrator* myIntegrator = IntegratorFactory::getInstance()->createIntegrator(simParams->getEnsemble(), info); |
146 |
< |
|
147 |
< |
if (myIntegrator == NULL) { |
139 |
< |
sprintf(painCave.errMsg, "Integrator Factory can not create %s Integrator\n", |
140 |
< |
simParams->getEnsemble()); |
141 |
< |
painCave.isFatal = 1; |
142 |
< |
simError(); |
143 |
< |
} |
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 |
> |
//set the force manager for thermodynamic integration if specified |
151 |
> |
if (simParams->getUseSolidThermInt() || simParams->getUseLiquidThermInt()){ |
152 |
> |
ForceManager* fman = new ThermoIntegrationForceManager(info); |
153 |
> |
myIntegrator->setForceManager(fman); |
154 |
> |
} |
155 |
|
|
156 |
< |
|
157 |
< |
//Zconstraint-Method |
158 |
< |
if (simParams->haveZconstraints()) { |
159 |
< |
info->setNZconstraint(simParams->getNzConstraints()); |
160 |
< |
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(); |
156 |
> |
//Zconstraint-Method |
157 |
> |
if (simParams->getNZconsStamps() > 0) { |
158 |
> |
info->setNZconstraint(simParams->getNZconsStamps()); |
159 |
> |
ForceManager* fman = new ZconstraintForceManager(info); |
160 |
> |
myIntegrator->setForceManager(fman); |
161 |
|
} |
162 |
+ |
|
163 |
+ |
myIntegrator->integrate(); |
164 |
+ |
delete myIntegrator; |
165 |
+ |
}else { |
166 |
+ |
sprintf(painCave.errMsg, "Integrator Factory can not create %s Integrator\n", |
167 |
+ |
simParams->getEnsemble().c_str()); |
168 |
+ |
painCave.isFatal = 1; |
169 |
+ |
simError(); |
170 |
+ |
} |
171 |
|
|
172 |
|
|
173 |
|
|
174 |
< |
delete info; |
174 |
> |
delete info; |
175 |
|
|
176 |
< |
#ifdef IS_MPI |
177 |
< |
strcpy( checkPointMsg, "Oh what a lovely Tea Party!" ); |
178 |
< |
MPIcheckPoint(); |
179 |
< |
|
176 |
> |
|
177 |
> |
strcpy( checkPointMsg, "Great googly moogly! It worked!" ); |
178 |
> |
errorCheckPoint(); |
179 |
> |
|
180 |
> |
#ifdef IS_MPI |
181 |
|
MPI_Finalize(); |
182 |
|
#endif |
183 |
|
|