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-2008 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" << |
102 |
|
} |
103 |
|
#endif |
104 |
|
|
99 |
– |
#ifdef IS_MPI |
105 |
|
strcpy( checkPointMsg, "Successful number of arguments" ); |
106 |
< |
MPIcheckPoint(); |
102 |
< |
#endif |
106 |
> |
errorCheckPoint(); |
107 |
|
|
108 |
+ |
//register forcefields, integrators and minimizers |
109 |
+ |
registerAll(); |
110 |
|
|
111 |
+ |
//create simulation model |
112 |
+ |
SimCreator creator; |
113 |
+ |
SimInfo* info = creator.createSim(argv[1]); |
114 |
+ |
Globals* simParams = info->getSimParams(); |
115 |
|
|
116 |
< |
//register forcefields, integrators and minimizers |
117 |
< |
registerAll(); |
116 |
> |
if (simParams->haveMinimizer() && simParams->haveEnsemble()) { |
117 |
> |
sprintf(painCave.errMsg, "Minimizer keyword and Ensemble keyword can not exist together\n"); |
118 |
> |
painCave.isFatal = 1; |
119 |
> |
simError(); |
120 |
> |
} |
121 |
> |
|
122 |
> |
if (simParams->haveMinimizer()) { |
123 |
> |
//create minimizer |
124 |
> |
Minimizer* myMinimizer = MinimizerFactory::getInstance()->createMinimizer(toUpperCopy(simParams->getMinimizer()), info); |
125 |
|
|
126 |
< |
//create simulation model |
127 |
< |
SimCreator creator; |
128 |
< |
SimInfo* info = creator.createSim(argv[1]); |
129 |
< |
Globals* simParams = info->getSimParams(); |
130 |
< |
|
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(); |
126 |
> |
if (myMinimizer == NULL) { |
127 |
> |
sprintf(painCave.errMsg, "Minimizer Factory can not create %s Minimizer\n", |
128 |
> |
simParams->getMinimizer().c_str()); |
129 |
> |
painCave.isFatal = 1; |
130 |
> |
simError(); |
131 |
|
} |
119 |
– |
|
120 |
– |
if (simParams->haveMinimizer()) { |
121 |
– |
//create minimizer |
122 |
– |
Minimizer* myMinimizer = MinimizerFactory::getInstance()->createMinimizer(simParams->getMinimizer(), info); |
132 |
|
|
133 |
< |
if (myMinimizer == NULL) { |
134 |
< |
sprintf(painCave.errMsg, "Minimizer Factory can not create %s Minimizer\n", |
135 |
< |
simParams->getMinimizer()); |
136 |
< |
painCave.isFatal = 1; |
128 |
< |
simError(); |
129 |
< |
} |
133 |
> |
myMinimizer->minimize(); |
134 |
> |
delete myMinimizer; |
135 |
> |
} else if (simParams->haveEnsemble()) { |
136 |
> |
//create Integrator |
137 |
|
|
138 |
< |
myMinimizer->minimize(); |
139 |
< |
delete myMinimizer; |
140 |
< |
} else if (simParams->haveEnsemble()) { |
141 |
< |
//create Integrator |
142 |
< |
|
143 |
< |
Integrator* myIntegrator = IntegratorFactory::getInstance()->createIntegrator(simParams->getEnsemble(), info); |
144 |
< |
|
145 |
< |
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 |
< |
} |
138 |
> |
Integrator* myIntegrator = IntegratorFactory::getInstance()->createIntegrator(toUpperCopy(simParams->getEnsemble()), info); |
139 |
> |
|
140 |
> |
if (myIntegrator == NULL) { |
141 |
> |
sprintf(painCave.errMsg, "Integrator Factory can not create %s Integrator\n", |
142 |
> |
simParams->getEnsemble().c_str()); |
143 |
> |
painCave.isFatal = 1; |
144 |
> |
simError(); |
145 |
> |
} |
146 |
|
|
147 |
< |
//Thermodynamic Integration Method |
148 |
< |
//ForceManager* fman = new ThermodynamicForceManager(info); |
149 |
< |
//myIntegrator->setForceManager(fman); |
147 |
> |
//Thermodynamic Integration Method |
148 |
> |
//set the force manager for thermodynamic integration if specified |
149 |
> |
if (simParams->getUseSolidThermInt() || simParams->getUseLiquidThermInt()){ |
150 |
> |
ForceManager* fman = new ThermoIntegrationForceManager(info); |
151 |
> |
myIntegrator->setForceManager(fman); |
152 |
> |
} |
153 |
|
|
154 |
< |
|
155 |
< |
//Zconstraint-Method |
156 |
< |
if (simParams->haveZconstraints()) { |
157 |
< |
info->setNZconstraint(simParams->getNzConstraints()); |
158 |
< |
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(); |
154 |
> |
//Zconstraint-Method |
155 |
> |
if (simParams->getNZconsStamps() > 0) { |
156 |
> |
info->setNZconstraint(simParams->getNZconsStamps()); |
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!" ); |
176 |
< |
MPIcheckPoint(); |
177 |
< |
|
174 |
> |
|
175 |
> |
strcpy( checkPointMsg, "Great googly moogly! It worked!" ); |
176 |
> |
errorCheckPoint(); |
177 |
> |
|
178 |
> |
#ifdef IS_MPI |
179 |
|
MPI_Finalize(); |
180 |
|
#endif |
181 |
|
|