ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/mdtools/interface_implementation/bassDiag.cpp
Revision: 129
Committed: Thu Oct 3 21:57:57 2002 UTC (21 years, 9 months ago) by chuckv
File size: 6085 byte(s)
Log Message:
quick bug fix to bassDiag

File Contents

# User Rev Content
1 chuckv 128 #include <iostream>
2     #include <cstdio>
3     #include <cstring>
4     #include <cstdlib>
5     #include "bassDiag.hpp"
6    
7     void bassDiag::dumpStamps(void){
8     char msg[1000];
9     Component** components;
10     int n_components;
11     MoleculeStamp* testMolecule;
12    
13     dumpFormater("First comes the globals..... \n");
14     sprintf(msg,"ForceField = %s\n",globals->getForceField());
15     dumpFormater(msg);
16    
17     sprintf(msg,"NComponents = %d\n",globals->getNComponents());
18     dumpFormater(msg);
19    
20     sprintf(msg,"TargatTemp = %lf\n",globals->getTargetTemp());
21     dumpFormater(msg);
22    
23     sprintf(msg,"Ensemble = %s\n",globals->getEnsemble());
24     dumpFormater(msg);
25    
26     sprintf(msg,"Dt = %lf\n",globals->getDt());
27     dumpFormater(msg);
28    
29     sprintf(msg,"RunTime = %lf\n\n",globals->getRunTime());
30     dumpFormater(msg);
31    
32     sprintf(msg,"Dumping Optional Globals....\n");
33     dumpFormater(msg);
34    
35     if (globals->haveInitialConfig()){
36    
37     sprintf(msg,"InitialConfig = %s\n",globals->getInitialConfig());
38     dumpFormater(msg);
39     }
40     if (globals->haveFinalConfig()){
41    
42     sprintf(msg,"FinalConfig = %s\n",globals->getFinalConfig());
43     dumpFormater(msg);
44     }
45    
46     if (globals->haveNMol()){
47    
48     sprintf(msg,"NMol = %d\n",globals->getNMol());
49     dumpFormater(msg);
50     }
51    
52     if (globals->haveDensity()){
53    
54     sprintf(msg,"Density = %lf\n",globals->getDensity());
55     dumpFormater(msg);
56     }
57    
58     if (globals->haveBox()){
59    
60     sprintf(msg,"Box = %lf\n",globals->getBox());
61     dumpFormater(msg);
62     }
63    
64     if (globals->haveBoxX()){
65    
66     sprintf(msg,"BoxX = %lf\n",globals->getBoxX());
67     dumpFormater(msg);
68     }
69     if (globals->haveBoxY()){
70    
71     sprintf(msg,"BoxY = %lf\n",globals->getBoxY());
72     dumpFormater(msg);
73     }
74     if (globals->haveBoxZ()){
75    
76     sprintf(msg,"BoxZ = %lf\n",globals->getBoxZ());
77     dumpFormater(msg);
78     }
79    
80     if (globals->haveSampleTime()){
81    
82     sprintf(msg,"SampleTime = %lf\n",globals->getSampleTime());
83     dumpFormater(msg);
84     }
85    
86     if (globals->haveStatusTime()){
87    
88     sprintf(msg,"StatusTime = %lf\n",globals->getStatusTime());
89     dumpFormater(msg);
90     }
91    
92     if (globals->haveThermalTime()){
93    
94     sprintf(msg,"ThermalTime = %lf\n",globals->getThermalTime());
95     dumpFormater(msg);
96     }
97    
98     if (globals->haveDielectric()){
99    
100     sprintf(msg,"Dielectric = %lf\n",globals->getDielectric());
101     dumpFormater(msg);
102     }
103    
104     if (globals->haveRRF()){
105    
106     sprintf(msg,"RRF = %lf\n",globals->getRRF());
107     dumpFormater(msg);
108     }
109    
110     if (globals->haveTempSet()){
111     sprintf(msg,"TempSet = %lf\n",globals->getTempSet());
112     dumpFormater(msg);
113    
114     }
115    
116     n_components = globals->getNComponents();
117     sprintf(msg,"\nWriting out %d components\n",n_components);
118     dumpFormater(msg);
119     components = globals-getComponents();
120    
121     for(int i=0; i < n_components ; i++){
122    
123     sprintf(msg,"Component[%d]{\n",i);
124     dumpFormater(msg);
125    
126     sprintf(msg," Type = %s\n",components[i]->getType());
127     dumpFormater(msg);
128    
129     if (components[i]->haveNmol){
130    
131     sprintf(msg," Nmol = %d\n",components[i]->getNMol());
132     dumpFormater(msg);
133     }
134    
135     sprintf(msg,"{\n\n");
136     dumpFormater(msg);
137     }
138    
139     testMolecule = stamps->getMolecule("tester");
140    
141 chuckv 129 if(testMolecule != NULL ){
142 chuckv 128
143 chuckv 129 sprintf(msg,"\nWriting out tester..... \n\n");
144     dumpFormater(msg);
145 chuckv 128
146 chuckv 129 sprintf(msg,"Molecule{\n");
147 chuckv 128 dumpFormater(msg);
148 chuckv 129
149     sprintf(msg," ID = %s\n",testMolecule->getID());
150 chuckv 128 dumpFormater(msg);
151    
152 chuckv 129 sprintf(msg," NAtoms = %d\n",testMolecule->getNAtoms());
153     dumpFormater(msg);
154    
155     int nAtoms = testMolecule->getNAtoms();
156     AtomStamp* aStamp;
157     for(int i=0; i<nAtoms;i++){
158    
159     aStamp = testMolecule->getAtom(i);
160    
161     sprintf(msg," Atom[%d]{\n",i);
162 chuckv 128 dumpFormater(msg);
163 chuckv 129
164     sprintf(msg," type = %s\n",aStamp->getType);
165 chuckv 128 dumpFormater(msg);
166 chuckv 129
167     if(aStamp->havePosition()){
168     sprintf(msg," position = < %lf, %lf, %lf>\n",
169     aStamp->getPosX(),
170     aStamp->getPosY(),
171     aStamp->getPosZ());
172     dumpFormater(msg);
173     }
174    
175     if(aStamp->haveOrientation()){
176     sprintf(msg," orientation = < %lf, %lf, %lf>\n",
177     aStamp->getOrntX(),
178     aStamp->getOrntY(),
179     aStamp->getOrntZ());
180     dumpFormater(msg);
181     }
182     sprintf(msg," }\n\n");
183     dumpFormater(msg);
184 chuckv 128 }
185 chuckv 129
186     sprintf(msg," NBonds = %d\n",testMolecule->getNBonds());
187 chuckv 128 dumpFormater(msg);
188    
189 chuckv 129 int nBonds = testMolecule->getNBonds();
190     BondStamp* boStamp;
191     for(int i=0; i<nBonds;i++){
192    
193     boStamp = testMolecule->getBond(i);
194    
195     sprintf(msg," Bond[%d]{\n",i);
196     dumpFormater(msg);
197    
198     sprintf(msg," members = %d, %d\n",
199     boStamp->getA(),
200     boStamp->getB());
201     dumpFormater(msg);
202    
203     sprintf(msg," }\n\n");
204     dumpFormater(msg);
205     }
206 chuckv 128
207 chuckv 129 sprintf(msg," NBends = %d\n",testMolecule->getNBends());
208 chuckv 128 dumpFormater(msg);
209    
210 chuckv 129 int nBends = testMolecule->getNBends();
211     BendStamp* beStamp;
212     for(int i=0; i<nBends;i++){
213    
214     beStamp = testMolecule->getBend(i);
215    
216     sprintf(msg," Bend[%d]{\n",i);
217     dumpFormater(msg);
218    
219     sprintf(msg," members = %d, %d, %d\n",
220     beStamp->getA(),
221     beStamp->getB(),
222     beStamp->getC());
223     dumpFormater(msg);
224    
225     sprintf(msg," }\n\n");
226     dumpFormater(msg);
227     }
228    
229     sprintf(msg," NTorsions = %d\n",testMolecule->getNTorsions());
230 chuckv 128 dumpFormater(msg);
231    
232 chuckv 129 int nTorsions = testMolecule->getNTorsions();
233     TorsionStamp* tStamp;
234     for(int i=0; i<nTorsions;i++){
235    
236     tStamp = testMolecule->getTorsion(i);
237    
238     sprintf(msg," Torsion[%d]{\n",i);
239     dumpFormater(msg);
240    
241     sprintf(msg," members = %d, %d, %d, %d\n",
242     tStamp->getA(),
243     tStamp->getB(),
244     tStamp->getC(),
245     tStamp->getD());
246     dumpFormater(msg);
247    
248     sprintf(msg," }\n\n");
249     dumpFormater(msg);
250     }
251 chuckv 128
252 chuckv 129 sprintf(msg,"}\n\n");
253 chuckv 128 dumpFormater(msg);
254    
255     }
256 chuckv 129 else{
257     sprintf(msg, "\n**************** Tester.mdl not included *************\n");
258     dumpFormatter( msg );
259 chuckv 128
260     }
261 chuckv 129 }
262 chuckv 128
263     void bassDiag::dumpFormater(char * theString){
264    
265     std::cout << theString;
266     std::cout.flush();
267     }
268    
269    
270    
271