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 206 by chuckv, Thu Dec 12 21:21:59 2002 UTC vs.
Revision 254 by chuckv, Thu Jan 30 20:03:37 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();
241 >  fprintf( stderr, "about to call divideLabour.\n" );
242  
243 +  globalIndex = mpiSim->divideLabor();
244 +
245 +  fprintf(stderr, "we're back from divideLabour\n" );
246 +
247    // set up the local variables
248    
249    int localMol, allMol;
# Line 313 | Line 319 | void SimSetup::createSim( void ){
319    simnfo->excludes = the_excludes;
320  
321  
316  // initialize the arrays
317
318  the_ff->setSimInfo( simnfo );
319
320  makeAtoms();
321
322  if( tot_bonds ){
323    makeBonds();
324  }
325
326  if( tot_bends ){
327    makeBends();
328  }
329
330  if( tot_torsions ){
331    makeTorsions();
332  }
333
334
322    // get some of the tricky things that may still be in the globals
323  
324    if( simnfo->n_dipoles ){
# Line 402 | Line 389 | void SimSetup::createSim( void ){
389    strcpy( checkPointMsg, "Box size set up" );
390    MPIcheckPoint();
391   #endif // is_mpi
392 +
393 +
394 +  // initialize the arrays
395 +
396 +  the_ff->setSimInfo( simnfo );
397 +
398 +  makeAtoms();
399 +
400 +  if( tot_bonds ){
401 +    makeBonds();
402 +  }
403 +
404 +  if( tot_bends ){
405 +    makeBends();
406 +  }
407 +
408 +  if( tot_torsions ){
409 +    makeTorsions();
410 +  }
411  
412  
413  
414 +
415 +
416 +
417   if( the_globals->haveInitialConfig() ){
418  
419       InitializeFromFile* fileInit;
# Line 558 | Line 567 | void SimSetup::createSim( void ){
567    if( the_globals->haveTempSet() ) simnfo->setTemp = the_globals->getTempSet();
568  
569  
570 <  // make the longe range forces and the integrator
570 > //   // make the longe range forces and the integrator
571  
572 <  new AllLong( simnfo );
572 > //   new AllLong( simnfo );
573  
574 <  if( !strcmp( force_field, "TraPPE" ) ) new Verlet( *simnfo );
574 >  if( !strcmp( force_field, "TraPPE" ) ) new Verlet( *simnfo, the_ff );
575    if( !strcmp( force_field, "DipoleTest" ) ) new Symplectic( simnfo );
576    if( !strcmp( force_field, "TraPPE_Ex" ) ) new Symplectic( simnfo );
577 +  if( !strcmp( force_field, "LJ" ) ) new Verlet( *simnfo, the_ff );
578 +
579   }
580  
581   void SimSetup::makeAtoms( void ){
# Line 583 | Line 594 | void SimSetup::makeAtoms( void ){
594      for( j=0; j<components_nmol[i]; j++ ){
595  
596   #ifdef IS_MPI
597 <      if( simnfo->mpiSim->getMyMolStart() <= molIndex &&
598 <          molIndex <= simnfo->mpiSim->getMyMolEnd() ){
597 >      if( mpiSim->getMyMolStart() <= molIndex &&
598 >          molIndex <= mpiSim->getMyMolEnd() ){
599   #endif // is_mpi        
600  
601          molStart = index;
# Line 637 | Line 648 | void SimSetup::makeAtoms( void ){
648        molIndex++;
649      }
650    }
651 +
652 + #ifdef IS_MPI
653 +    for( i=0; i<mpiSim->getMyNlocal(); i++ ) the_atoms[i]->setGlobalIndex( globalIndex[i] );
654 +    
655 +    delete[] globalIndex;
656  
657 +    mpiSim->mpiRefresh();
658 + #endif //IS_MPI
659 +          
660    the_ff->initializeAtoms();
661   }
662  
# Line 651 | Line 670 | void SimSetup::makeBonds( void ){
670    index = 0;
671    offset = 0;
672    molIndex = 0;
673 +
674    for( i=0; i<n_components; i++ ){
675  
676      for( j=0; j<components_nmol[i]; j++ ){
677  
678   #ifdef IS_MPI
679 <      if( simnfo->mpiSim->getMyMolStart() <= molIndex &&
680 <          molIndex <= simnfo->mpiSim->getMyMolEnd() ){
679 >      if( mpiSim->getMyMolStart() <= molIndex &&
680 >          molIndex <= mpiSim->getMyMolEnd() ){
681   #endif // is_mpi        
682          
683          for( k=0; k<comp_stamps[i]->getNBonds(); k++ ){
# Line 676 | Line 696 | void SimSetup::makeBonds( void ){
696          
697   #ifdef IS_MPI
698        }
699 < #endif is_mpi
699 > #endif //is_mpi
700        
701        molIndex++;
702      }      
# Line 700 | Line 720 | void SimSetup::makeBends( void ){
720      for( j=0; j<components_nmol[i]; j++ ){
721  
722   #ifdef IS_MPI
723 <      if( simnfo->mpiSim->getMyMolStart() <= molIndex &&
724 <          molIndex <= simnfo->mpiSim->getMyMolEnd() ){
723 >      if( mpiSim->getMyMolStart() <= molIndex &&
724 >          molIndex <= mpiSim->getMyMolEnd() ){
725   #endif // is_mpi        
726  
727          for( k=0; k<comp_stamps[i]->getNBends(); k++ ){
# Line 745 | Line 765 | void SimSetup::makeTorsions( void ){
765      for( j=0; j<components_nmol[i]; j++ ){
766  
767   #ifdef IS_MPI
768 <      if( simnfo->mpiSim->getMyMolStart() <= molIndex &&
769 <          molIndex <= simnfo->mpiSim->getMyMolEnd() ){
768 >      if( mpiSim->getMyMolStart() <= molIndex &&
769 >          molIndex <= mpiSim->getMyMolEnd() ){
770   #endif // is_mpi        
771  
772        for( k=0; k<comp_stamps[i]->getNTorsions(); k++ ){

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines