ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/applications/oopse/oopse.cpp
Revision: 2206
Committed: Fri Apr 15 22:22:30 2005 UTC (19 years, 3 months ago) by gezelter
File size: 6677 byte(s)
Log Message:
Version string in banner (and version numbers in config.h)

File Contents

# User Rev Content
1 gezelter 2204 /*
2 gezelter 1930 * 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 1501 #ifdef IS_MPI
43     #include <mpi.h>
44     #endif
45    
46     #include "utils/simError.h"
47 gezelter 1930 #include "brains/Register.hpp"
48     #include "brains/SimCreator.hpp"
49 tim 1501 #include "brains/SimInfo.hpp"
50 gezelter 1930 #include "constraints/ZconstraintForceManager.hpp"
51     #include "integrators/IntegratorFactory.hpp"
52 tim 1501 #include "integrators/Integrator.hpp"
53 gezelter 1930 #include "minimizers/MinimizerFactory.hpp"
54     #include "minimizers/Minimizer.hpp"
55     using namespace oopse;
56 tim 1501
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 2051 " | / /_/ / /_/ / ____/___/ / /___ Copyright 2004-2005 by the |\n" <<
77 tim 1501 " | \\____/\\____/_/ /____/_____/ University of Notre Dame. |\n" <<
78 gezelter 2206 " | version " <<
79     OOPSE_VERSION_MAJOR << "." << OOPSE_VERSION_MINOR << "." << OOPSE_VERSION_TINY <<
80     " http://www.oopse.org |\n" <<
81 tim 1501 " | |\n" <<
82     " | OOPSE is an OpenScience project. All source code is available for |\n" <<
83     " | any use subject to only one condition: |\n" <<
84     " | |\n" <<
85     " | Any published work resulting from the use of this code must cite the |\n" <<
86     " | following paper: M. A. Meineke, C. F. Vardeman II, T. Lin, |\n" <<
87     " | C. J. Fennell, and J. D. Gezelter, |\n" <<
88 gezelter 1950 " | J. Comput. Chem. 26, pp. 252-271 (2005). |\n" <<
89 tim 1501 " +----------------------------------------------------------------------+\n" <<
90     "\n";
91    
92     if( argc < 2 ){
93     strcpy( painCave.errMsg, "Error, a meta-data file is needed to run.\n" );
94     painCave.isFatal = 1;
95     simError();
96     }
97     #ifdef IS_MPI
98     }
99     #endif
100    
101     #ifdef IS_MPI
102     strcpy( checkPointMsg, "Successful number of arguments" );
103     MPIcheckPoint();
104     #endif
105 gezelter 1930
106    
107    
108 gezelter 2204 //register forcefields, integrators and minimizers
109     registerAll();
110 gezelter 1930
111 gezelter 2204 //create simulation model
112     SimCreator creator;
113     SimInfo* info = creator.createSim(argv[1]);
114     Globals* simParams = info->getSimParams();
115 gezelter 1930
116 gezelter 2204 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 tim 1501
122 gezelter 2204 if (simParams->haveMinimizer()) {
123     //create minimizer
124     Minimizer* myMinimizer = MinimizerFactory::getInstance()->createMinimizer(simParams->getMinimizer(), info);
125 tim 1501
126 gezelter 2204 if (myMinimizer == NULL) {
127     sprintf(painCave.errMsg, "Minimizer Factory can not create %s Minimizer\n",
128     simParams->getMinimizer());
129     painCave.isFatal = 1;
130     simError();
131     }
132 tim 1501
133 gezelter 2204 myMinimizer->minimize();
134     delete myMinimizer;
135     } else if (simParams->haveEnsemble()) {
136     //create Integrator
137 tim 1501
138 gezelter 2204 Integrator* myIntegrator = IntegratorFactory::getInstance()->createIntegrator(simParams->getEnsemble(), info);
139 tim 1501
140 gezelter 2204 if (myIntegrator == NULL) {
141     sprintf(painCave.errMsg, "Integrator Factory can not create %s Integrator\n",
142     simParams->getEnsemble());
143     painCave.isFatal = 1;
144     simError();
145     }
146 gezelter 1930
147 gezelter 2204 //Thermodynamic Integration Method
148     //ForceManager* fman = new ThermodynamicForceManager(info);
149     //myIntegrator->setForceManager(fman);
150 tim 1501
151    
152 gezelter 2204 //Zconstraint-Method
153     if (simParams->haveZconstraints()) {
154     info->setNZconstraint(simParams->getNzConstraints());
155     ForceManager* fman = new ZconstraintForceManager(info);
156     myIntegrator->setForceManager(fman);
157     }
158 gezelter 1930
159 gezelter 2204 myIntegrator->integrate();
160     delete myIntegrator;
161     }else {
162     sprintf(painCave.errMsg, "Integrator Factory can not create %s Integrator\n",
163 gezelter 1930 simParams->getEnsemble());
164 gezelter 2204 painCave.isFatal = 1;
165     simError();
166     }
167 tim 1501
168    
169 gezelter 1930
170 gezelter 2204 delete info;
171 tim 1501
172     #ifdef IS_MPI
173     strcpy( checkPointMsg, "Oh what a lovely Tea Party!" );
174     MPIcheckPoint();
175    
176 gezelter 1930 MPI_Finalize();
177 tim 1501 #endif
178    
179     return 0 ;
180     }