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 144 by mmeineke, Thu Oct 17 21:59:12 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 "simError.h"
10  
11   #ifdef IS_MPI
12   #include "mpiBASS.h"
# Line 15 | Line 16 | SimSetup::SimSetup(){
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 24 | Line 30 | void SimSetup::parseFile( char* fileName ){
30  
31   void SimSetup::parseFile( char* fileName ){
32  
27  inFileName = fileName;
28  set_interface_stamps( stamps, globals );
33   #ifdef IS_MPI
34 <  mpiEventInit();
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 );
43 >
44 >    yacc_BASS( fileName );
45 >
46   #ifdef IS_MPI
47 <  throwMPIEvent(NULL);
47 >    throwMPIEvent(NULL);
48 >  }
49 >  else receiveParse();
50   #endif
51  
52   }
# Line 41 | Line 56 | void SimSetup::receiveParse(void){
56  
57      set_interface_stamps( stamps, globals );
58      mpiEventInit();
59 +    MPIcheckPoint();
60      mpiEventLoop();
61  
62   }
# Line 52 | Line 68 | void SimSetup::testMe(void){
68    delete dumpMe;
69   }
70   #endif
71 +
72   void SimSetup::createSim( void ){
73  
74    MakeStamps *the_stamps;
# Line 76 | 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 155 | 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 255 | Line 280 | void SimSetup::createSim( void ){
280   //   else{
281  
282      initFromBass();
258
259
260 //   }
261
262 //   if( the_globals->haveFinalConfig() ){
263 //     strcpy( simnfo->finalName, the_globals->getFinalConfig() );
264 //   }
265 //   else{
266 //     strcpy( simnfo->finalName, inFileName );
267 //     char* endTest;
268 //     int nameLength = strlen( simnfo->finalName );
269 //     endTest = &(simnfo->finalName[nameLength - 5]);
270 //     if( !strcmp( endTest, ".bass" ) ){
271 //       strcpy( endTest, ".eor" );
272 //     }
273 //     else if( !strcmp( endTest, ".BASS" ) ){
274 //       strcpy( endTest, ".eor" );
275 //     }
276 //     else{
277 //       endTest = &(simnfo->finalName[nameLength - 4]);
278 //       if( !strcmp( endTest, ".bss" ) ){
279 //      strcpy( endTest, ".eor" );
280 //       }
281 //       else if( !strcmp( endTest, ".mdl" ) ){
282 //      strcpy( endTest, ".eor" );
283 //       }
284 //       else{
285 //      strcat( simnfo->finalName, ".eor" );
286 //       }
287 //     }
288 //   }
283  
290 //   // make the sample and status out names
284  
292 //   strcpy( simnfo->sampleName, inFileName );
293 //   char* endTest;
294 //   int nameLength = strlen( simnfo->sampleName );
295 //   endTest = &(simnfo->sampleName[nameLength - 5]);
296 //   if( !strcmp( endTest, ".bass" ) ){
297 //     strcpy( endTest, ".dump" );
298 //   }
299 //   else if( !strcmp( endTest, ".BASS" ) ){
300 //     strcpy( endTest, ".dump" );
301 //   }
302 //   else{
303 //     endTest = &(simnfo->sampleName[nameLength - 4]);
304 //     if( !strcmp( endTest, ".bss" ) ){
305 //       strcpy( endTest, ".dump" );
306 //     }
307 //     else if( !strcmp( endTest, ".mdl" ) ){
308 //       strcpy( endTest, ".dump" );
309 //     }
310 //     else{
311 //       strcat( simnfo->sampleName, ".dump" );
312 //     }
313 //   }
314
315 //   strcpy( simnfo->statusName, inFileName );
316 //   nameLength = strlen( simnfo->statusName );
317 //   endTest = &(simnfo->statusName[nameLength - 5]);
318 //   if( !strcmp( endTest, ".bass" ) ){
319 //     strcpy( endTest, ".stat" );
320 //   }
321 //   else if( !strcmp( endTest, ".BASS" ) ){
322 //     strcpy( endTest, ".stat" );
323 //   }
324 //   else{
325 //     endTest = &(simnfo->statusName[nameLength - 4]);
326 //     if( !strcmp( endTest, ".bss" ) ){
327 //       strcpy( endTest, ".stat" );
328 //     }
329 //     else if( !strcmp( endTest, ".mdl" ) ){
330 //       strcpy( endTest, ".stat" );
331 //     }
332 //     else{
333 //       strcat( simnfo->statusName, ".stat" );
334 //     }
285   //   }
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 392 | 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 412 | 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