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

Comparing trunk/OOPSE/libmdtools/SimSetup.cpp (file contents):
Revision 420 by mmeineke, Thu Mar 27 17:32:03 2003 UTC vs.
Revision 431 by mmeineke, Thu Mar 27 22:16:27 2003 UTC

# Line 88 | Line 88 | void SimSetup::createSim( void ){
88            
89  
90  
91 <  if( !strcmp( force_field, "TraPPE" ) ) the_ff = new TraPPEFF();
92 <  else if( !strcmp( force_field, "DipoleTest" ) ) the_ff = new DipoleTestFF();
93 <  else if( !strcmp( force_field, "TraPPE_Ex" ) ) the_ff = new TraPPE_ExFF();
91 >  if( !strcmp( force_field, "TraPPE_Ex" ) ) the_ff = new TraPPE_ExFF();
92    else if( !strcmp( force_field, "LJ" ) ) the_ff = new LJ_FF();
93    else{
94      sprintf( painCave.errMsg,
# Line 248 | Line 246 | void SimSetup::createSim( void ){
246    
247    int localMol, allMol;
248    int local_atoms, local_bonds, local_bends, local_torsions, local_SRI;
249 +
250 +  int* mol2proc = mpiSim->getMolToProcMap();
251 +  int* molCompType = mpiSim->getMolComponentType();
252    
253    allMol = 0;
254    localMol = 0;
# Line 259 | Line 260 | void SimSetup::createSim( void ){
260  
261      for( j=0; j<components_nmol[i]; j++ ){
262        
263 <      if( mpiSim->getMyMolStart() <= allMol &&
263 <          allMol <= mpiSim->getMyMolEnd() ){
263 >      if( mol2proc[j] == worldRank ){
264          
265          local_atoms +=    comp_stamps[i]->getNAtoms();
266          local_bonds +=    comp_stamps[i]->getNBonds();
# Line 279 | Line 279 | void SimSetup::createSim( void ){
279    if( local_atoms != simnfo->n_atoms ){
280      sprintf( painCave.errMsg,
281               "SimSetup error: mpiSim's localAtom (%d) and SimSetup's"
282 <             " localAtom (%d) are note equal.\n",
282 >             " localAtom (%d) are not equal.\n",
283               simnfo->n_atoms,
284               local_atoms );
285      painCave.isFatal = 1;
# Line 304 | Line 304 | void SimSetup::createSim( void ){
304    Atom::createArrays(simnfo->n_atoms);
305    the_atoms = new Atom*[simnfo->n_atoms];
306    the_molecules = new Molecule[simnfo->n_mol];
307 +  int molIndex;
308  
309 +  // initialize the molecule's stampID's
310  
311 + #ifdef IS_MPI
312 +  
313 +
314 +  molIndex = 0;
315 +  for(i=0; i<mpiSim->getTotNmol(); i++){
316 +    
317 +    if(mol2proc[i] == worldRank ){
318 +      the_molecules[molIndex].setStampID( molCompType[i] );
319 +      molIndex++;
320 +    }
321 +  }
322 +
323 + #else // is_mpi
324 +  
325 +  molIndex = 0;
326 +  for(i=0; i<n_components; i++){
327 +    for(j=0; j<components_nmol[i]; j++ ){
328 +      the_molecules[molIndex].setStampID( i );
329 +      molIndex++;
330 +    }
331 +  }
332 +    
333 +
334 + #endif // is_mpi
335 +
336 +
337    if( simnfo->n_SRI ){
338 +    
339 +    std::cerr << "n_SRI = " << simnfo->n_SRI << "\n";
340 +    
341      Exclude::createArray(simnfo->n_SRI);
342      the_excludes = new Exclude*[simnfo->n_SRI];
343 +    for( int ex=0; ex<simnfo->n_SRI; ex++) the_excludes[ex] = new Exclude(ex);
344      simnfo->globalExcludes = new int;
345      simnfo->n_exclude = tot_SRI;
346    }
# Line 326 | Line 358 | void SimSetup::createSim( void ){
358    // set the arrays into the SimInfo object
359  
360    simnfo->atoms = the_atoms;
361 <  simnfo->sr_interactions = the_sris;
361 >  simnfo->molecules = the_molecules;
362    simnfo->nGlobalExcludes = 0;
363    simnfo->excludes = the_excludes;
364  
# Line 383 | Line 415 | void SimSetup::createSim( void ){
415  
416    the_ff->setSimInfo( simnfo );
417  
418 <  makeAtoms();
418 >  makeMolecules();
419    simnfo->identArray = new int[simnfo->n_atoms];
420    for(i=0; i<simnfo->n_atoms; i++){
421      simnfo->identArray[i] = the_atoms[i]->getIdent();
422    }
423    
392  if( tot_bonds ){
393    makeBonds();
394  }
395
396  if( tot_bends ){
397    makeBends();
398  }
399
400  if( tot_torsions ){
401    makeTorsions();
402  }
403
404
424    if (the_globals->getUseRF() ) {
425      simnfo->useReactionField = 1;
426    
# Line 638 | Line 657 | void SimSetup::createSim( void ){
657  
658   //   new AllLong( simnfo );
659  
641  if( !strcmp( force_field, "TraPPE" ) ) new Verlet( *simnfo, the_ff );
642  if( !strcmp( force_field, "DipoleTest" ) ) new Symplectic( simnfo, the_ff );
660    if( !strcmp( force_field, "TraPPE_Ex" ) ) new Symplectic( simnfo, the_ff );
661    if( !strcmp( force_field, "LJ" ) ) new Verlet( *simnfo, the_ff );
662  
# Line 683 | Line 700 | void SimSetup::makeMolecules( void ){
700    BondStamp* currentBond;
701    BendStamp* currentBend;
702    TorsionStamp* currentTorsion;
703 +
704 +  bond_pair* theBonds;
705 +  bend_set* theBends;
706 +  torsion_set* theTorsions;
707 +
708    
709    //init the forceField paramters
710  
711    the_ff->readParams();
712  
713    
714 <  // init the molecules
714 >  // init the atoms
715  
716 +  double ux, uy, uz, u, uSqr;
717 +  
718    atomOffset = 0;
719    excludeOffset = 0;
720    for(i=0; i<simnfo->n_mol; i++){
# Line 707 | Line 731 | void SimSetup::makeMolecules( void ){
731      info.myExcludes = &the_excludes[excludeOffset];
732      info.myBonds = new Bond*[info.nBonds];
733      info.myBends = new Bend*[info.nBends];
734 <    info.myTorsions = new Torsions*[info.nTorsions];
734 >    info.myTorsions = new Torsion*[info.nTorsions];
735  
736      theBonds = new bond_pair[info.nBonds];
737      theBends = new bend_set[info.nBends];
# Line 717 | Line 741 | void SimSetup::makeMolecules( void ){
741      
742      for(j=0; j<info.nAtoms; j++){
743        
744 <      currentAtom = theComponents[stampID]->getAtom( j );
744 >      currentAtom = comp_stamps[stampID]->getAtom( j );
745        if( currentAtom->haveOrientation() ){
746          
747          dAtom = new DirectionalAtom(j + atomOffset);
# Line 790 | Line 814 | void SimSetup::makeMolecules( void ){
814            
815        if( currentBend->haveExtras() ){
816              
817 <        extras = current_bend->getExtras();
817 >        extras = currentBend->getExtras();
818          current_extra = extras;
819              
820          while( current_extra != NULL ){
# Line 907 | Line 931 | void SimSetup::makeMolecules( void ){
931  
932      the_molecules[i].initialize( info );
933      atomOffset += info.nAtoms;
934 +    delete[] theBonds;
935 +    delete[] theBends;
936 +    delete[] theTorsions;
937    }
938  
939    // clean up the forcefield

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines