| 1 |
gezelter |
507 |
/* |
| 2 |
gezelter |
246 |
* Copyright (c) 2005 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 |
| 6 |
|
|
* redistribute this software in source and binary code form, provided |
| 7 |
|
|
* that the following conditions are met: |
| 8 |
|
|
* |
| 9 |
|
|
* 1. Acknowledgement of the program authors must be made in any |
| 10 |
|
|
* publication of scientific results based in part on use of the |
| 11 |
|
|
* program. An acceptable form of acknowledgement is citation of |
| 12 |
|
|
* the article in which the program was described (Matthew |
| 13 |
|
|
* A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher |
| 14 |
|
|
* J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented |
| 15 |
|
|
* Parallel Simulation Engine for Molecular Dynamics," |
| 16 |
|
|
* J. Comput. Chem. 26, pp. 252-271 (2005)) |
| 17 |
|
|
* |
| 18 |
|
|
* 2. Redistributions of source code must retain the above copyright |
| 19 |
|
|
* notice, this list of conditions and the following disclaimer. |
| 20 |
|
|
* |
| 21 |
|
|
* 3. Redistributions in binary form must reproduce the above copyright |
| 22 |
|
|
* notice, this list of conditions and the following disclaimer in the |
| 23 |
|
|
* documentation and/or other materials provided with the |
| 24 |
|
|
* distribution. |
| 25 |
|
|
* |
| 26 |
|
|
* This software is provided "AS IS," without a warranty of any |
| 27 |
|
|
* kind. All express or implied conditions, representations and |
| 28 |
|
|
* warranties, including any implied warranty of merchantability, |
| 29 |
|
|
* fitness for a particular purpose or non-infringement, are hereby |
| 30 |
|
|
* excluded. The University of Notre Dame and its licensors shall not |
| 31 |
|
|
* be liable for any damages suffered by licensee as a result of |
| 32 |
|
|
* using, modifying or distributing the software or its |
| 33 |
|
|
* derivatives. In no event will the University of Notre Dame or its |
| 34 |
|
|
* licensors be liable for any lost revenue, profit or data, or for |
| 35 |
|
|
* direct, indirect, special, consequential, incidental or punitive |
| 36 |
|
|
* damages, however caused and regardless of the theory of liability, |
| 37 |
|
|
* arising out of the use of or inability to use software, even if the |
| 38 |
|
|
* University of Notre Dame has been advised of the possibility of |
| 39 |
|
|
* such damages. |
| 40 |
|
|
*/ |
| 41 |
|
|
|
| 42 |
tim |
12 |
#ifdef IS_MPI |
| 43 |
|
|
#include <mpi.h> |
| 44 |
|
|
#endif |
| 45 |
|
|
|
| 46 |
|
|
#include "utils/simError.h" |
| 47 |
gezelter |
246 |
#include "brains/Register.hpp" |
| 48 |
|
|
#include "brains/SimCreator.hpp" |
| 49 |
tim |
12 |
#include "brains/SimInfo.hpp" |
| 50 |
gezelter |
246 |
#include "constraints/ZconstraintForceManager.hpp" |
| 51 |
|
|
#include "integrators/IntegratorFactory.hpp" |
| 52 |
tim |
12 |
#include "integrators/Integrator.hpp" |
| 53 |
gezelter |
246 |
#include "minimizers/MinimizerFactory.hpp" |
| 54 |
|
|
#include "minimizers/Minimizer.hpp" |
| 55 |
|
|
using namespace oopse; |
| 56 |
tim |
12 |
|
| 57 |
|
|
int main(int argc,char* argv[]){ |
| 58 |
|
|
|
| 59 |
|
|
// first things first, all of the initializations |
| 60 |
|
|
|
| 61 |
|
|
#ifdef IS_MPI |
| 62 |
|
|
MPI_Init( &argc, &argv ); // the MPI communicators |
| 63 |
|
|
#endif |
| 64 |
|
|
|
| 65 |
|
|
initSimError(); // the error handler |
| 66 |
|
|
srand48( 1337 ); // the random number generator. |
| 67 |
|
|
|
| 68 |
|
|
#ifdef IS_MPI |
| 69 |
|
|
if( worldRank == 0 ){ |
| 70 |
|
|
#endif |
| 71 |
|
|
std::cerr << |
| 72 |
|
|
" +----------------------------------------------------------------------+\n" << |
| 73 |
|
|
" | ____ ____ ____ _____ ______ The OpenSource, Object-oriented |\n" << |
| 74 |
|
|
" | / __ \\/ __ \\/ __ \\/ ___// ____/ Parallel Simulation Engine. |\n" << |
| 75 |
|
|
" | / / / / / / / /_/ /\\__ \\/ __/ |\n" << |
| 76 |
gezelter |
367 |
" | / /_/ / /_/ / ____/___/ / /___ Copyright 2004-2005 by the |\n" << |
| 77 |
tim |
12 |
" | \\____/\\____/_/ /____/_____/ University of Notre Dame. |\n" << |
| 78 |
gezelter |
510 |
" | |\n" << |
| 79 |
gezelter |
509 |
" | version " << |
| 80 |
|
|
OOPSE_VERSION_MAJOR << "." << OOPSE_VERSION_MINOR << "." << OOPSE_VERSION_TINY << |
| 81 |
|
|
" http://www.oopse.org |\n" << |
| 82 |
tim |
12 |
" | |\n" << |
| 83 |
|
|
" | OOPSE is an OpenScience project. All source code is available for |\n" << |
| 84 |
|
|
" | any use subject to only one condition: |\n" << |
| 85 |
|
|
" | |\n" << |
| 86 |
|
|
" | Any published work resulting from the use of this code must cite the |\n" << |
| 87 |
|
|
" | following paper: M. A. Meineke, C. F. Vardeman II, T. Lin, |\n" << |
| 88 |
|
|
" | C. J. Fennell, and J. D. Gezelter, |\n" << |
| 89 |
gezelter |
266 |
" | J. Comput. Chem. 26, pp. 252-271 (2005). |\n" << |
| 90 |
tim |
12 |
" +----------------------------------------------------------------------+\n" << |
| 91 |
|
|
"\n"; |
| 92 |
|
|
|
| 93 |
|
|
if( argc < 2 ){ |
| 94 |
|
|
strcpy( painCave.errMsg, "Error, a meta-data file is needed to run.\n" ); |
| 95 |
|
|
painCave.isFatal = 1; |
| 96 |
|
|
simError(); |
| 97 |
|
|
} |
| 98 |
|
|
#ifdef IS_MPI |
| 99 |
|
|
} |
| 100 |
|
|
#endif |
| 101 |
|
|
|
| 102 |
|
|
#ifdef IS_MPI |
| 103 |
|
|
strcpy( checkPointMsg, "Successful number of arguments" ); |
| 104 |
|
|
MPIcheckPoint(); |
| 105 |
|
|
#endif |
| 106 |
gezelter |
246 |
|
| 107 |
|
|
|
| 108 |
|
|
|
| 109 |
gezelter |
507 |
//register forcefields, integrators and minimizers |
| 110 |
|
|
registerAll(); |
| 111 |
gezelter |
246 |
|
| 112 |
gezelter |
507 |
//create simulation model |
| 113 |
|
|
SimCreator creator; |
| 114 |
|
|
SimInfo* info = creator.createSim(argv[1]); |
| 115 |
|
|
Globals* simParams = info->getSimParams(); |
| 116 |
gezelter |
246 |
|
| 117 |
gezelter |
507 |
if (simParams->haveMinimizer() && simParams->haveEnsemble()) { |
| 118 |
|
|
sprintf(painCave.errMsg, "Minimizer keyword and Ensemble keyword can not exist together\n"); |
| 119 |
|
|
painCave.isFatal = 1; |
| 120 |
|
|
simError(); |
| 121 |
|
|
} |
| 122 |
tim |
12 |
|
| 123 |
gezelter |
507 |
if (simParams->haveMinimizer()) { |
| 124 |
|
|
//create minimizer |
| 125 |
|
|
Minimizer* myMinimizer = MinimizerFactory::getInstance()->createMinimizer(simParams->getMinimizer(), info); |
| 126 |
tim |
12 |
|
| 127 |
gezelter |
507 |
if (myMinimizer == NULL) { |
| 128 |
|
|
sprintf(painCave.errMsg, "Minimizer Factory can not create %s Minimizer\n", |
| 129 |
tim |
665 |
simParams->getMinimizer().c_str()); |
| 130 |
gezelter |
507 |
painCave.isFatal = 1; |
| 131 |
|
|
simError(); |
| 132 |
|
|
} |
| 133 |
tim |
12 |
|
| 134 |
gezelter |
507 |
myMinimizer->minimize(); |
| 135 |
|
|
delete myMinimizer; |
| 136 |
|
|
} else if (simParams->haveEnsemble()) { |
| 137 |
|
|
//create Integrator |
| 138 |
tim |
12 |
|
| 139 |
gezelter |
507 |
Integrator* myIntegrator = IntegratorFactory::getInstance()->createIntegrator(simParams->getEnsemble(), info); |
| 140 |
tim |
12 |
|
| 141 |
gezelter |
507 |
if (myIntegrator == NULL) { |
| 142 |
|
|
sprintf(painCave.errMsg, "Integrator Factory can not create %s Integrator\n", |
| 143 |
tim |
665 |
simParams->getEnsemble().c_str()); |
| 144 |
gezelter |
507 |
painCave.isFatal = 1; |
| 145 |
|
|
simError(); |
| 146 |
|
|
} |
| 147 |
gezelter |
246 |
|
| 148 |
gezelter |
507 |
//Thermodynamic Integration Method |
| 149 |
|
|
//ForceManager* fman = new ThermodynamicForceManager(info); |
| 150 |
|
|
//myIntegrator->setForceManager(fman); |
| 151 |
tim |
12 |
|
| 152 |
|
|
|
| 153 |
gezelter |
507 |
//Zconstraint-Method |
| 154 |
tim |
665 |
if (simParams->haveNZconstraints()) { |
| 155 |
|
|
info->setNZconstraint(simParams->getNZconstraints()); |
| 156 |
gezelter |
507 |
ForceManager* fman = new ZconstraintForceManager(info); |
| 157 |
|
|
myIntegrator->setForceManager(fman); |
| 158 |
|
|
} |
| 159 |
gezelter |
246 |
|
| 160 |
gezelter |
507 |
myIntegrator->integrate(); |
| 161 |
|
|
delete myIntegrator; |
| 162 |
|
|
}else { |
| 163 |
|
|
sprintf(painCave.errMsg, "Integrator Factory can not create %s Integrator\n", |
| 164 |
tim |
665 |
simParams->getEnsemble().c_str()); |
| 165 |
gezelter |
507 |
painCave.isFatal = 1; |
| 166 |
|
|
simError(); |
| 167 |
|
|
} |
| 168 |
tim |
12 |
|
| 169 |
|
|
|
| 170 |
gezelter |
246 |
|
| 171 |
gezelter |
507 |
delete info; |
| 172 |
tim |
12 |
|
| 173 |
|
|
#ifdef IS_MPI |
| 174 |
|
|
strcpy( checkPointMsg, "Oh what a lovely Tea Party!" ); |
| 175 |
|
|
MPIcheckPoint(); |
| 176 |
|
|
|
| 177 |
gezelter |
246 |
MPI_Finalize(); |
| 178 |
tim |
12 |
#endif |
| 179 |
|
|
|
| 180 |
|
|
return 0 ; |
| 181 |
|
|
} |