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 205 by mmeineke, Wed Dec 11 20:39:41 2002 UTC vs.
Revision 249 by chuckv, Mon Jan 27 21:28:19 2003 UTC

# Line 10 | Line 10
10  
11   #ifdef IS_MPI
12   #include "mpiBASS.h"
13 + #include "mpiSimulation.hpp"
14   #include "bassDiag.hpp"
15   #endif
16  
# Line 92 | Line 93 | void SimSetup::createSim( void ){
93    if( !strcmp( force_field, "TraPPE" ) ) the_ff = new TraPPEFF();
94    else if( !strcmp( force_field, "DipoleTest" ) ) the_ff = new DipoleTestFF();
95    else if( !strcmp( force_field, "TraPPE_Ex" ) ) the_ff = new TraPPE_ExFF();
96 +  else if( !strcmp( force_field, "LJ" ) ) the_ff = new LJ_FF();
97    else{
98      sprintf( painCave.errMsg,
99               "SimSetup Error. Unrecognized force field -> %s\n",
# Line 187 | Line 189 | void SimSetup::createSim( void ){
189        if( currentStamp == NULL ){
190          sprintf( painCave.errMsg,
191                   "SimSetup error: Component \"%s\" was not found in the "
192 <                 "list of declared molecules\n"
192 >                 "list of declared molecules\n",
193                   id );
194          painCave.isFatal = 1;
195          simError();
# Line 234 | Line 236 | void SimSetup::createSim( void ){
236  
237    // divide the molecules among processors here.
238    
239 <  mpiSimulation* mpiSim = new mpiSimulation( simnfo );
239 >  mpiSim = new mpiSimulation( simnfo );
240    
241    mpiSim->divideLabor();
242  
# Line 311 | Line 313 | void SimSetup::createSim( void ){
313    simnfo->sr_interactions = the_sris;
314    simnfo->n_exclude = tot_SRI;
315    simnfo->excludes = the_excludes;
314
315
316  // initialize the arrays
317
318  the_ff->setSimInfo( simnfo );
319
320  makeAtoms();
321
322  if( tot_bonds ){
323    makeBonds();
324  }
316  
326  if( tot_bends ){
327    makeBends();
328  }
317  
330  if( tot_torsions ){
331    makeTorsions();
332  }
333
334
318    // get some of the tricky things that may still be in the globals
319  
320    if( simnfo->n_dipoles ){
# Line 404 | Line 387 | void SimSetup::createSim( void ){
387   #endif // is_mpi
388  
389  
390 <
408 < //   if( the_globals->haveInitialConfig() ){
409 < //        InitializeFromFile* fileInit;
410 < //     fileInit = new InitializeFromFile( the_globals->getInitialConfig() );
390 >  // initialize the arrays
391  
392 < //     fileInit->read_xyz( simnfo ); // default velocities on
392 >  the_ff->setSimInfo( simnfo );
393  
394 < //     delete fileInit;
395 < //   }
396 < //   else{
394 >  makeAtoms();
395 >
396 >  if( tot_bonds ){
397 >    makeBonds();
398 >  }
399 >
400 >  if( tot_bends ){
401 >    makeBends();
402 >  }
403 >
404 >  if( tot_torsions ){
405 >    makeTorsions();
406 >  }
407 >
408 >
409 >
410 >
411 >
412 >
413 > if( the_globals->haveInitialConfig() ){
414 >
415 >     InitializeFromFile* fileInit;
416 > #ifdef IS_MPI // is_mpi
417 >     if( worldRank == 0 ){
418 > #endif //is_mpi
419 >   fileInit = new InitializeFromFile( the_globals->getInitialConfig() );
420 > #ifdef IS_MPI
421 >     }else fileInit = new InitializeFromFile( NULL );
422 > #endif
423 >   fileInit->read_xyz( simnfo ); // default velocities on
424  
425 +   delete fileInit;
426 + }
427 + else{
428 +
429   #ifdef IS_MPI
430  
431    // no init from bass
# Line 428 | Line 439 | void SimSetup::createSim( void ){
439  
440    initFromBass();
441  
442 < #endif // is_mpi
443 <
442 >
443 > #endif
444 > }
445 >
446   #ifdef IS_MPI
447    strcpy( checkPointMsg, "Successfully read in the initial configuration" );
448    MPIcheckPoint();
# Line 439 | Line 452 | void SimSetup::createSim( void ){
452    
453  
454    
455 <  //   }
455 >
456    
457   #ifdef IS_MPI
458    if( worldRank == 0 ){
# Line 550 | Line 563 | void SimSetup::createSim( void ){
563    if( the_globals->haveTempSet() ) simnfo->setTemp = the_globals->getTempSet();
564  
565  
566 <  // make the longe range forces and the integrator
554 <
555 <  new AllLong( simnfo );
566 > //   // make the longe range forces and the integrator
567  
568 <  if( !strcmp( force_field, "TraPPE" ) ) new Verlet( *simnfo );
568 > //   new AllLong( simnfo );
569 >
570 >  if( !strcmp( force_field, "TraPPE" ) ) new Verlet( *simnfo, the_ff );
571    if( !strcmp( force_field, "DipoleTest" ) ) new Symplectic( simnfo );
572    if( !strcmp( force_field, "TraPPE_Ex" ) ) new Symplectic( simnfo );
573 +  if( !strcmp( force_field, "LJ" ) ) new Verlet( *simnfo, the_ff );
574 +
575   }
576  
577   void SimSetup::makeAtoms( void ){
# Line 575 | Line 590 | void SimSetup::makeAtoms( void ){
590      for( j=0; j<components_nmol[i]; j++ ){
591  
592   #ifdef IS_MPI
593 <      if( simnfo->mpiSim->getMyMolStart() <= molIndex &&
594 <          molIndex <= simnfo->mpiSim->getMyMolEnd() ){
593 >      if( mpiSim->getMyMolStart() <= molIndex &&
594 >          molIndex <= mpiSim->getMyMolEnd() ){
595   #endif // is_mpi        
596  
597          molStart = index;
# Line 643 | Line 658 | void SimSetup::makeBonds( void ){
658    index = 0;
659    offset = 0;
660    molIndex = 0;
661 +
662    for( i=0; i<n_components; i++ ){
663  
664      for( j=0; j<components_nmol[i]; j++ ){
665  
666   #ifdef IS_MPI
667 <      if( simnfo->mpiSim->getMyMolStart() <= molIndex &&
668 <          molIndex <= simnfo->mpiSim->getMyMolEnd() ){
667 >      if( mpiSim->getMyMolStart() <= molIndex &&
668 >          molIndex <= mpiSim->getMyMolEnd() ){
669   #endif // is_mpi        
670          
671          for( k=0; k<comp_stamps[i]->getNBonds(); k++ ){
# Line 692 | Line 708 | void SimSetup::makeBends( void ){
708      for( j=0; j<components_nmol[i]; j++ ){
709  
710   #ifdef IS_MPI
711 <      if( simnfo->mpiSim->getMyMolStart() <= molIndex &&
712 <          molIndex <= simnfo->mpiSim->getMyMolEnd() ){
711 >      if( mpiSim->getMyMolStart() <= molIndex &&
712 >          molIndex <= mpiSim->getMyMolEnd() ){
713   #endif // is_mpi        
714  
715          for( k=0; k<comp_stamps[i]->getNBends(); k++ ){
# Line 737 | Line 753 | void SimSetup::makeTorsions( void ){
753      for( j=0; j<components_nmol[i]; j++ ){
754  
755   #ifdef IS_MPI
756 <      if( simnfo->mpiSim->getMyMolStart() <= molIndex &&
757 <          molIndex <= simnfo->mpiSim->getMyMolEnd() ){
756 >      if( mpiSim->getMyMolStart() <= molIndex &&
757 >          molIndex <= mpiSim->getMyMolEnd() ){
758   #endif // is_mpi        
759  
760        for( k=0; k<comp_stamps[i]->getNTorsions(); k++ ){

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines