ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/mdtools/interface_implementation/SimSetup.cpp
(Generate patch)

Comparing trunk/mdtools/interface_implementation/SimSetup.cpp (file contents):
Revision 124 by chuckv, Mon Sep 30 20:35:42 2002 UTC vs.
Revision 184 by mmeineke, Thu Nov 21 20:33:06 2002 UTC

# Line 6 | Line 6
6   #include "parse_me.h"
7   #include "LRI.hpp"
8   #include "Integrator.hpp"
9 < #include "mpiInterface.h"
9 > #include "simError.h"
10  
11 + #ifdef IS_MPI
12 + #include "mpiBASS.h"
13 + #include "bassDiag.hpp"
14 + #endif
15 +
16   SimSetup::SimSetup(){
17    stamps = new MakeStamps();
18    globals = new Globals();
19 +  
20 + #ifdef IS_MPI
21 +  strcpy( checkPointMsg, "SimSetup creation successful" );
22 +  MPIcheckPoint();
23 + #endif // IS_MPI
24   }
25  
26   SimSetup::~SimSetup(){
# Line 20 | Line 30 | void SimSetup::parseFile( char* fileName ){
30  
31   void SimSetup::parseFile( char* fileName ){
32  
33 <  inFileName = fileName;
34 <  set_interface_stamps( stamps, globals );
35 < #ifdef MPI
36 <  mpiEventInit();
33 > #ifdef IS_MPI
34 >  if( worldRank == 0 ){
35 > #endif // is_mpi
36 >    
37 >    inFileName = fileName;
38 >    set_interface_stamps( stamps, globals );
39 >    
40 > #ifdef IS_MPI
41 >    mpiEventInit();
42   #endif
43 <  yacc_BASS( fileName );
44 < #ifdef MPI
45 <  throwMPIEvent(NULL);
43 >
44 >    yacc_BASS( fileName );
45 >
46 > #ifdef IS_MPI
47 >    throwMPIEvent(NULL);
48 >  }
49 >  else receiveParse();
50   #endif
51  
52   }
53  
54 < #ifdef MPI
54 > #ifdef IS_MPI
55   void SimSetup::receiveParse(void){
56  
57      set_interface_stamps( stamps, globals );
58      mpiEventInit();
59 +    MPIcheckPoint();
60      mpiEventLoop();
61  
62   }
63 +
64 +
65 + void SimSetup::testMe(void){
66 +  bassDiag* dumpMe = new bassDiag(globals,stamps);
67 +  dumpMe->dumpStamps();
68 +  delete dumpMe;
69 + }
70   #endif
71  
72   void SimSetup::createSim( void ){
# Line 66 | Line 93 | void SimSetup::createSim( void ){
93    else if( !strcmp( force_field, "DipoleTest" ) ) the_ff = new DipoleTestFF();
94    else if( !strcmp( force_field, "TraPPE_Ex" ) ) the_ff = new TraPPE_ExFF();
95    else{
96 <    std::cerr<< "SimSetup Error. Unrecognized force field -> "
97 <             << force_field << "\n";
98 <    exit(8);
96 >    sprintf( painCave.errMsg,
97 >             "SimSetup Error. Unrecognized force field -> %s\n",
98 >             force_field );
99 >    painCave.isFatal = 1;
100 >    simError();
101    }
102  
103 + #ifdef IS_MPI
104 +  strcpy( checkPointMsg, "ForceField creation successful" );
105 +  MPIcheckPoint();
106 + #endif // is_mpi
107 +
108    // get the components and calculate the tot_nMol and indvidual n_mol
109    the_components = the_globals->getComponents();
110    components_nmol = new int[n_components];
# Line 145 | Line 179 | void SimSetup::createSim( void ){
179  
180    // create the atom and short range interaction arrays
181  
182 +  Atom::createArrays(tot_atoms);
183    the_atoms = new Atom*[tot_atoms];
184    the_molecules = new Molecule[tot_nmol];
185  
# Line 246 | Line 281 | void SimSetup::createSim( void ){
281  
282      initFromBass();
283  
249
250 //   }
251
252 //   if( the_globals->haveFinalConfig() ){
253 //     strcpy( simnfo->finalName, the_globals->getFinalConfig() );
254 //   }
255 //   else{
256 //     strcpy( simnfo->finalName, inFileName );
257 //     char* endTest;
258 //     int nameLength = strlen( simnfo->finalName );
259 //     endTest = &(simnfo->finalName[nameLength - 5]);
260 //     if( !strcmp( endTest, ".bass" ) ){
261 //       strcpy( endTest, ".eor" );
262 //     }
263 //     else if( !strcmp( endTest, ".BASS" ) ){
264 //       strcpy( endTest, ".eor" );
265 //     }
266 //     else{
267 //       endTest = &(simnfo->finalName[nameLength - 4]);
268 //       if( !strcmp( endTest, ".bss" ) ){
269 //      strcpy( endTest, ".eor" );
270 //       }
271 //       else if( !strcmp( endTest, ".mdl" ) ){
272 //      strcpy( endTest, ".eor" );
273 //       }
274 //       else{
275 //      strcat( simnfo->finalName, ".eor" );
276 //       }
277 //     }
278 //   }
279
280 //   // make the sample and status out names
281
282 //   strcpy( simnfo->sampleName, inFileName );
283 //   char* endTest;
284 //   int nameLength = strlen( simnfo->sampleName );
285 //   endTest = &(simnfo->sampleName[nameLength - 5]);
286 //   if( !strcmp( endTest, ".bass" ) ){
287 //     strcpy( endTest, ".dump" );
288 //   }
289 //   else if( !strcmp( endTest, ".BASS" ) ){
290 //     strcpy( endTest, ".dump" );
291 //   }
292 //   else{
293 //     endTest = &(simnfo->sampleName[nameLength - 4]);
294 //     if( !strcmp( endTest, ".bss" ) ){
295 //       strcpy( endTest, ".dump" );
296 //     }
297 //     else if( !strcmp( endTest, ".mdl" ) ){
298 //       strcpy( endTest, ".dump" );
299 //     }
300 //     else{
301 //       strcat( simnfo->sampleName, ".dump" );
302 //     }
303 //   }
284  
305 //   strcpy( simnfo->statusName, inFileName );
306 //   nameLength = strlen( simnfo->statusName );
307 //   endTest = &(simnfo->statusName[nameLength - 5]);
308 //   if( !strcmp( endTest, ".bass" ) ){
309 //     strcpy( endTest, ".stat" );
285   //   }
311 //   else if( !strcmp( endTest, ".BASS" ) ){
312 //     strcpy( endTest, ".stat" );
313 //   }
314 //   else{
315 //     endTest = &(simnfo->statusName[nameLength - 4]);
316 //     if( !strcmp( endTest, ".bss" ) ){
317 //       strcpy( endTest, ".stat" );
318 //     }
319 //     else if( !strcmp( endTest, ".mdl" ) ){
320 //       strcpy( endTest, ".stat" );
321 //     }
322 //     else{
323 //       strcat( simnfo->statusName, ".stat" );
324 //     }
325 //   }
286  
287 + #ifdef IS_MPI
288 +    if( worldRank == TESTWRITE ){
289 + #endif // is_mpi
290 +      
291 +      fprintf( stderr,
292 +               "infile name is \"%s\"\n",
293 +               inFileName );
294 +      
295 +      inFileName = "./butane.bass";
296 +        
297 +      if( the_globals->haveFinalConfig() ){
298 +        strcpy( simnfo->finalName, the_globals->getFinalConfig() );
299 +      }
300 +      else{
301 +        strcpy( simnfo->finalName, inFileName );
302 +        char* endTest;
303 +        int nameLength = strlen( simnfo->finalName );
304 +        endTest = &(simnfo->finalName[nameLength - 5]);
305 +        if( !strcmp( endTest, ".bass" ) ){
306 +          strcpy( endTest, ".eor" );
307 +        }
308 +        else if( !strcmp( endTest, ".BASS" ) ){
309 +          strcpy( endTest, ".eor" );
310 +        }
311 +        else{
312 +          endTest = &(simnfo->finalName[nameLength - 4]);
313 +          if( !strcmp( endTest, ".bss" ) ){
314 +            strcpy( endTest, ".eor" );
315 +          }
316 +          else if( !strcmp( endTest, ".mdl" ) ){
317 +            strcpy( endTest, ".eor" );
318 +          }
319 +          else{
320 +            strcat( simnfo->finalName, ".eor" );
321 +          }
322 +        }
323 +      }
324 +      
325 +      // make the sample and status out names
326 +      
327 +      strcpy( simnfo->sampleName, inFileName );
328 +      char* endTest;
329 +      int nameLength = strlen( simnfo->sampleName );
330 +      endTest = &(simnfo->sampleName[nameLength - 5]);
331 +      if( !strcmp( endTest, ".bass" ) ){
332 +        strcpy( endTest, ".dump" );
333 +      }
334 +      else if( !strcmp( endTest, ".BASS" ) ){
335 +        strcpy( endTest, ".dump" );
336 +      }
337 +      else{
338 +        endTest = &(simnfo->sampleName[nameLength - 4]);
339 +        if( !strcmp( endTest, ".bss" ) ){
340 +          strcpy( endTest, ".dump" );
341 +        }
342 +        else if( !strcmp( endTest, ".mdl" ) ){
343 +          strcpy( endTest, ".dump" );
344 +        }
345 +        else{
346 +          strcat( simnfo->sampleName, ".dump" );
347 +        }
348 +      }
349 +      
350 +      strcpy( simnfo->statusName, inFileName );
351 +      nameLength = strlen( simnfo->statusName );
352 +      endTest = &(simnfo->statusName[nameLength - 5]);
353 +      if( !strcmp( endTest, ".bass" ) ){
354 +        strcpy( endTest, ".stat" );
355 +      }
356 +      else if( !strcmp( endTest, ".BASS" ) ){
357 +        strcpy( endTest, ".stat" );
358 +      }
359 +      else{
360 +        endTest = &(simnfo->statusName[nameLength - 4]);
361 +        if( !strcmp( endTest, ".bss" ) ){
362 +          strcpy( endTest, ".stat" );
363 +        }
364 +        else if( !strcmp( endTest, ".mdl" ) ){
365 +          strcpy( endTest, ".stat" );
366 +        }
367 +        else{
368 +          strcat( simnfo->statusName, ".stat" );
369 +        }
370 +      }
371 +      
372 + #ifdef IS_MPI
373 +    }
374 + #endif // is_mpi
375  
376    // set the status, sample, and themal kick times
377  
# Line 382 | Line 430 | void SimSetup::makeAtoms( void ){
430          current_atom = comp_stamps[i]->getAtom( k );
431          if( current_atom->haveOrientation() ){
432  
433 <          dAtom = new DirectionalAtom;
433 >          dAtom = new DirectionalAtom(index);
434            simnfo->n_oriented++;
435            the_atoms[index] = dAtom;
436  
# Line 402 | Line 450 | void SimSetup::makeAtoms( void ){
450            dAtom->setSUz( uz );
451          }
452          else{
453 <          the_atoms[index] = new GeneralAtom;
453 >          the_atoms[index] = new GeneralAtom(index);
454          }
455          the_atoms[index]->setType( current_atom->getType() );
456          the_atoms[index]->setIndex( index );

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines