ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-4/src/applications/oopse/oopse.cpp
Revision: 1852
Committed: Sun Dec 5 17:09:27 2004 UTC (21 years, 5 months ago) by tim
File size: 4175 byte(s)
Log Message:
add Integrator.cpp

File Contents

# User Rev Content
1 tim 1501
2     #ifdef IS_MPI
3     #include <mpi.h>
4     #endif
5    
6     #include "utils/simError.h"
7 tim 1775 #include "brains/SimCreator.hpp"
8 tim 1501 #include "brains/SimInfo.hpp"
9 tim 1775 #include "integrators/IntegratorFactory.hpp"
10 tim 1843 #include "integrators/IntegratorCreator.hpp"
11 tim 1822 #include "integrators/Integrator.hpp"
12 tim 1843 #include "integrators/NVE.hpp"
13 tim 1852 #include "integrators/NVT.hpp"
14     #include "integrators/NPTi.hpp"
15     #include "integrators/NPTf.hpp"
16     #include "integrators/NPTxyz.hpp"
17 tim 1837 #include "UseTheForce/DUFF.hpp"
18 tim 1843 #include "UseTheForce/ForceFieldCreator.hpp"
19    
20 tim 1822 using namespace oopse;
21 tim 1501
22     int main(int argc,char* argv[]){
23    
24     // first things first, all of the initializations
25    
26     #ifdef IS_MPI
27     MPI_Init( &argc, &argv ); // the MPI communicators
28     #endif
29    
30     initSimError(); // the error handler
31     srand48( 1337 ); // the random number generator.
32    
33     #ifdef IS_MPI
34     if( worldRank == 0 ){
35     #endif
36     std::cerr <<
37     " +----------------------------------------------------------------------+\n" <<
38     " | ____ ____ ____ _____ ______ The OpenSource, Object-oriented |\n" <<
39     " | / __ \\/ __ \\/ __ \\/ ___// ____/ Parallel Simulation Engine. |\n" <<
40     " | / / / / / / / /_/ /\\__ \\/ __/ |\n" <<
41     " | / /_/ / /_/ / ____/___/ / /___ Copyright 2004 by the |\n" <<
42     " | \\____/\\____/_/ /____/_____/ University of Notre Dame. |\n" <<
43     " | http://www.oopse.org |\n" <<
44     " | |\n" <<
45     " | OOPSE is an OpenScience project. All source code is available for |\n" <<
46     " | any use subject to only one condition: |\n" <<
47     " | |\n" <<
48     " | Any published work resulting from the use of this code must cite the |\n" <<
49     " | following paper: M. A. Meineke, C. F. Vardeman II, T. Lin, |\n" <<
50     " | C. J. Fennell, and J. D. Gezelter, |\n" <<
51     " | J. Comp. Chem. XX, XXXX (2004). |\n" <<
52     " +----------------------------------------------------------------------+\n" <<
53     "\n";
54    
55     if( argc < 2 ){
56     strcpy( painCave.errMsg, "Error, a meta-data file is needed to run.\n" );
57     painCave.isFatal = 1;
58     simError();
59     }
60     #ifdef IS_MPI
61     }
62     #endif
63    
64     #ifdef IS_MPI
65     strcpy( checkPointMsg, "Successful number of arguments" );
66     MPIcheckPoint();
67     #endif
68 tim 1837
69 tim 1852 /** @todo move another module */
70     ForceFieldBuilder<DUFF> DUFFCreator("DUFF");
71     IntegratorBuilder<NVE> NVECreator("NVE");
72     IntegratorBuilder<NVT> NVTCreator("NVT");
73     IntegratorBuilder<NPTi> NPTiCreator("NPTi");
74     IntegratorBuilder<NPTf> NPTfCreator("NPTf");
75     IntegratorBuilder<NPTxyz> NPTxyzCreator("NPTxyz");
76 tim 1843
77 tim 1775 //create simulation model
78     SimCreator creator;
79     SimInfo* info = creator.createSim(argv[1]);
80 tim 1501
81 tim 1775 //create Integrator
82 tim 1841 Globals* simParams = info->getSimParams();
83     if (simParams->haveEnsemble()) {
84     Integrator* myIntegrator = IntegratorFactory::getInstance()->createIntegrator(simParams->getEnsemble(), info);
85 tim 1822
86     //Thermodynamic Integration Method
87     //ForceManager* fman = new ThermodynamicForceManager(info);
88     //myIntegrator->setForceManager(fman);
89 tim 1501
90    
91 tim 1822 //Zconstraint-Method
92     //ForceManager* fman = new ZconstraintForceManager(info);
93     //myIntegrator->setForceManager(fman);
94 tim 1501
95 tim 1843 if (myIntegrator == NULL) {
96     sprintf(painCave.errMsg, "Integrator Factory can not create %s Integrator\n",
97     simParams->getEnsemble());
98     painCave.isFatal = 1;
99     simError();
100     }
101    
102 tim 1822 myIntegrator->integrate();
103     delete myIntegrator;
104     }
105 tim 1775 //minimizer
106     // Minimizer* minimizer = MinimizerFactory::getInstance()->createMininizer();
107     //minimizer->run();
108     //delete minimizer
109    
110     delete info;
111 tim 1501
112     #ifdef IS_MPI
113     strcpy( checkPointMsg, "Oh what a lovely Tea Party!" );
114     MPIcheckPoint();
115    
116 tim 1822 MPI_Finalize();
117 tim 1501 #endif
118    
119     return 0 ;
120     }