1 |
/* |
2 |
* Copyright (C) 2000-2004 Object Oriented Parallel Simulation Engine (OOPSE) project |
3 |
* |
4 |
* Contact: oopse@oopse.org |
5 |
* |
6 |
* This program is free software; you can redistribute it and/or |
7 |
* modify it under the terms of the GNU Lesser General Public License |
8 |
* as published by the Free Software Foundation; either version 2.1 |
9 |
* of the License, or (at your option) any later version. |
10 |
* All we ask is that proper credit is given for our work, which includes |
11 |
* - but is not limited to - adding the above copyright notice to the beginning |
12 |
* of your source code files, and to any copyright notice that you may distribute |
13 |
* with programs based on this work. |
14 |
* |
15 |
* This program is distributed in the hope that it will be useful, |
16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 |
* GNU Lesser General Public License for more details. |
19 |
* |
20 |
* You should have received a copy of the GNU Lesser General Public License |
21 |
* along with this program; if not, write to the Free Software |
22 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
23 |
* |
24 |
*/ |
25 |
|
26 |
#ifdef IS_MPI |
27 |
#include <mpi.h> |
28 |
#endif |
29 |
|
30 |
#include "utils/simError.h" |
31 |
#include "brains/SimCreator.hpp" |
32 |
#include "brains/SimInfo.hpp" |
33 |
#include "integrators/IntegratorFactory.hpp" |
34 |
#include "integrators/IntegratorCreator.hpp" |
35 |
#include "integrators/Integrator.hpp" |
36 |
#include "integrators/NVE.hpp" |
37 |
#include "integrators/NVT.hpp" |
38 |
#include "integrators/NPTi.hpp" |
39 |
#include "integrators/NPTf.hpp" |
40 |
#include "integrators/NPTxyz.hpp" |
41 |
#include "UseTheForce/DUFF.hpp" |
42 |
#include "UseTheForce/EAM.hpp" |
43 |
#include "UseTheForce/ForceFieldCreator.hpp" |
44 |
|
45 |
using namespace oopse; |
46 |
|
47 |
int main(int argc,char* argv[]){ |
48 |
|
49 |
// first things first, all of the initializations |
50 |
|
51 |
#ifdef IS_MPI |
52 |
MPI_Init( &argc, &argv ); // the MPI communicators |
53 |
#endif |
54 |
|
55 |
initSimError(); // the error handler |
56 |
srand48( 1337 ); // the random number generator. |
57 |
|
58 |
#ifdef IS_MPI |
59 |
if( worldRank == 0 ){ |
60 |
#endif |
61 |
std::cerr << |
62 |
" +----------------------------------------------------------------------+\n" << |
63 |
" | ____ ____ ____ _____ ______ The OpenSource, Object-oriented |\n" << |
64 |
" | / __ \\/ __ \\/ __ \\/ ___// ____/ Parallel Simulation Engine. |\n" << |
65 |
" | / / / / / / / /_/ /\\__ \\/ __/ |\n" << |
66 |
" | / /_/ / /_/ / ____/___/ / /___ Copyright 2004 by the |\n" << |
67 |
" | \\____/\\____/_/ /____/_____/ University of Notre Dame. |\n" << |
68 |
" | http://www.oopse.org |\n" << |
69 |
" | |\n" << |
70 |
" | OOPSE is an OpenScience project. All source code is available for |\n" << |
71 |
" | any use subject to only one condition: |\n" << |
72 |
" | |\n" << |
73 |
" | Any published work resulting from the use of this code must cite the |\n" << |
74 |
" | following paper: M. A. Meineke, C. F. Vardeman II, T. Lin, |\n" << |
75 |
" | C. J. Fennell, and J. D. Gezelter, |\n" << |
76 |
" | J. Comp. Chem. XX, XXXX (2004). |\n" << |
77 |
" +----------------------------------------------------------------------+\n" << |
78 |
"\n"; |
79 |
|
80 |
if( argc < 2 ){ |
81 |
strcpy( painCave.errMsg, "Error, a meta-data file is needed to run.\n" ); |
82 |
painCave.isFatal = 1; |
83 |
simError(); |
84 |
} |
85 |
#ifdef IS_MPI |
86 |
} |
87 |
#endif |
88 |
|
89 |
#ifdef IS_MPI |
90 |
strcpy( checkPointMsg, "Successful number of arguments" ); |
91 |
MPIcheckPoint(); |
92 |
#endif |
93 |
|
94 |
/** @todo move to a seperate initialization module */ |
95 |
//DUFF, WATER and LJ are merged into one force field |
96 |
ForceFieldBuilder<DUFF> DUFFCreator("DUFF"); |
97 |
ForceFieldBuilder<DUFF> WATERCreator("WATER"); |
98 |
ForceFieldBuilder<DUFF> LJCreator("LJ"); |
99 |
//in theory, EAM can also be merged |
100 |
ForceFieldBuilder<EAM> EAMCreator("EAM"); |
101 |
|
102 |
IntegratorBuilder<NVE> NVECreator("NVE"); |
103 |
IntegratorBuilder<NVT> NVTCreator("NVT"); |
104 |
IntegratorBuilder<NPTi> NPTiCreator("NPTi"); |
105 |
IntegratorBuilder<NPTf> NPTfCreator("NPTf"); |
106 |
IntegratorBuilder<NPTxyz> NPTxyzCreator("NPTxyz"); |
107 |
|
108 |
//create simulation model |
109 |
SimCreator creator; |
110 |
SimInfo* info = creator.createSim(argv[1]); |
111 |
|
112 |
//create Integrator |
113 |
Globals* simParams = info->getSimParams(); |
114 |
if (simParams->haveEnsemble()) { |
115 |
Integrator* myIntegrator = IntegratorFactory::getInstance()->createIntegrator(simParams->getEnsemble(), info); |
116 |
|
117 |
//Thermodynamic Integration Method |
118 |
//ForceManager* fman = new ThermodynamicForceManager(info); |
119 |
//myIntegrator->setForceManager(fman); |
120 |
|
121 |
|
122 |
//Zconstraint-Method |
123 |
//ForceManager* fman = new ZconstraintForceManager(info); |
124 |
//myIntegrator->setForceManager(fman); |
125 |
|
126 |
if (myIntegrator == NULL) { |
127 |
sprintf(painCave.errMsg, "Integrator Factory can not create %s Integrator\n", |
128 |
simParams->getEnsemble()); |
129 |
painCave.isFatal = 1; |
130 |
simError(); |
131 |
} |
132 |
|
133 |
myIntegrator->integrate(); |
134 |
delete myIntegrator; |
135 |
} |
136 |
//minimizer |
137 |
// Minimizer* minimizer = MinimizerFactory::getInstance()->createMininizer(); |
138 |
//minimizer->run(); |
139 |
//delete minimizer |
140 |
|
141 |
delete info; |
142 |
|
143 |
#ifdef IS_MPI |
144 |
strcpy( checkPointMsg, "Oh what a lovely Tea Party!" ); |
145 |
MPIcheckPoint(); |
146 |
|
147 |
MPI_Finalize(); |
148 |
#endif |
149 |
|
150 |
return 0 ; |
151 |
} |