ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/oopse-1.0/src/oopse.cpp
Revision: 1447
Committed: Fri Jul 30 21:01:35 2004 UTC (19 years, 11 months ago) by gezelter
File size: 3563 byte(s)
Log Message:
Initial import of OOPSE sources into cvs tree

File Contents

# User Rev Content
1 gezelter 1447 #include <iostream>
2     #include <fstream>
3     #include <cstdlib>
4     #include <cmath>
5     #include <cstring>
6    
7     #ifdef IS_MPI
8     #include <mpi.h>
9     #endif
10    
11     #ifdef PROFILE
12     #include "mdProfile.hpp"
13     #endif // PROFILE
14    
15     #include "simError.h"
16     #include "SimSetup.hpp"
17     #include "SimInfo.hpp"
18     #include "Atom.hpp"
19     #include "Integrator.hpp"
20     #include "Thermo.hpp"
21     #include "ReadWrite.hpp"
22     #include "OOPSEMinimizer.hpp"
23    
24     char* program_name;
25     using namespace std;
26    
27     int main(int argc,char* argv[]){
28    
29     char* in_name;
30     SimSetup* startMe;
31     SimInfo* entry_plug;
32    
33     // first things first, all of the initializations
34    
35     #ifdef IS_MPI
36     MPI_Init( &argc, &argv ); // the MPI communicators
37     #endif
38    
39     initSimError(); // the error handler
40     srand48( 1337 ); // the random number generator.
41    
42     #ifdef PROFILE
43     initProfile();
44     #endif //profile
45    
46     // check command line arguments, and set the input file
47    
48     program_name = argv[0]; // save the program name in case we need it
49    
50     #ifdef IS_MPI
51     if( worldRank == 0 ){
52     #endif
53     std::cerr <<
54     " +----------------------------------------------------------------------+\n" <<
55     " | ____ ____ ____ _____ ______ The OpenSource, Object-oriented |\n" <<
56     " | / __ \\/ __ \\/ __ \\/ ___// ____/ Parallel Simulation Engine. |\n" <<
57     " | / / / / / / / /_/ /\\__ \\/ __/ |\n" <<
58     " | / /_/ / /_/ / ____/___/ / /___ Copyright 2004 by the |\n" <<
59     " | \\____/\\____/_/ /____/_____/ University of Notre Dame. |\n" <<
60     " | http://www.oopse.org |\n" <<
61     " | |\n" <<
62     " | OOPSE is an OpenScience project. All source code is available for |\n" <<
63     " | any use subject to only one condition: |\n" <<
64     " | |\n" <<
65     " | Any published work resulting from the use of this code must cite the |\n" <<
66     " | following paper: M. A. Meineke, C. F. Vardeman II, T. Lin, |\n" <<
67     " | C. J. Fennell, and J. D. Gezelter, |\n" <<
68     " | J. Comp. Chem. XX, XXXX (2004). |\n" <<
69     " +----------------------------------------------------------------------+\n" <<
70     "\n";
71    
72     if( argc < 2 ){
73     strcpy( painCave.errMsg, "Error, a meta-data file is needed to run.\n" );
74     painCave.isFatal = 1;
75     simError();
76     }
77     #ifdef IS_MPI
78     }
79     #endif
80    
81     in_name = argv[1];
82    
83     #ifdef IS_MPI
84     strcpy( checkPointMsg, "Successful number of arguments" );
85     MPIcheckPoint();
86     #endif
87    
88     // create the simulation objects, and get the show on the road
89    
90     entry_plug = new SimInfo();
91     startMe = new SimSetup();
92    
93     startMe->setSimInfo( entry_plug );
94    
95     #ifdef PROFILE
96     startProfile( pro1 );
97     #endif //profile
98    
99     startMe->parseFile( in_name );
100    
101     #ifdef PROFILE
102     endProfile( pro1 );
103    
104     startProfile( pro2 );
105     #endif //profile
106    
107     startMe->createSim();
108     delete startMe;
109    
110     #ifdef PROFILE
111     endProfile( pro2 );
112    
113     startProfile( pro3 );
114     #endif //profile
115    
116     if (!entry_plug->has_minimizer)
117     entry_plug->the_integrator->integrate();
118     else
119     entry_plug->the_minimizer->minimize();
120     #ifdef PROFILE
121     endProfile( pro3 );
122    
123     writeProfiles();
124     #endif //profile
125    
126     #ifdef IS_MPI
127     strcpy( checkPointMsg, "Oh what a lovely Tea Party!" );
128     MPIcheckPoint();
129    
130     MPI_Finalize();
131     #endif
132    
133     return 0 ;
134     }