ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-3.0/src/brains/SimCreator.cpp
Revision: 1712
Committed: Thu Nov 4 20:55:01 2004 UTC (19 years, 9 months ago) by tim
File size: 2929 byte(s)
Log Message:
time to break SimSetup

File Contents

# Content
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 /**
27 * @file SimCreator.cpp
28 * @author tlin
29 * @date 11/03/2004
30 * @time 13:51am
31 * @version 1.0
32 */
33
34 #include "brains/SimCreator.hpp"
35 namespace oopse {
36
37 void SimSetup::parseFile(char* mdfile, MakeStamps* stamps, Globals* globals){
38 #ifdef IS_MPI
39 if (worldRank == 0){
40 #endif // is_mpi
41
42
43 globals->initalize();
44 set_interface_stamps(stamps, globals);
45
46 #ifdef IS_MPI
47 mpiEventInit();
48 #endif
49
50 yacc_BASS(mdfile);
51
52 #ifdef IS_MPI
53 throwMPIEvent(NULL);
54 }
55 else{
56 set_interface_stamps(stamps, globals);
57 mpiEventInit();
58 MPIcheckPoint();
59 mpiEventLoop();
60 }
61 #endif
62
63 }
64
65
66 SimModel* SimCreator::createSim(const std::string& mdfile) {
67 MakeStamps* stamps;
68
69 Globals* globals = new Globals();
70
71 //parse meta-data file
72 parseFile(mdfile, stamps, globals);
73
74 //create the force field
75 ForceFiled* ff = ForceFiledFactory::getInstance()->createForceField(globals->getForceField());
76
77 //create SimModel
78 model = new SimInfo();
79
80 //gather parameters
81 gatherParameters(model);
82
83
84
85 //divide the molecules and determine the global index of molecules
86
87 //create the molecules
88
89 //create atoms, bonds, bend, torsions, rigidbodies
90
91 //allocate memory for DataStorage(circular reference, need to break it)
92 model->setSnapshotManager(new SimSnapshotManager(model);
93
94 //load initial coordinates
95 DumpReader reader();
96 reader.readFrame(model);
97
98 //initialize fortran
99 return model;
100 }
101
102 void SimCreator::gatherParameters(SimModel* model) {
103 model->addProperty(new StringGenericData("Ensemble", globals->getForceFiled()));
104 model->addProperty(new DoubleGenericData("dt"), globals->getDt());
105 }
106
107 #ifdef IS_MPI
108 void SimCreator::mpiMolDivide() {
109
110
111 }
112
113 #endif
114 } //end namespace oopse