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 427 by mmeineke, Thu Mar 27 20:48:37 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 ){
# Line 326 | Line 354 | void SimSetup::createSim( void ){
354    // set the arrays into the SimInfo object
355  
356    simnfo->atoms = the_atoms;
329  simnfo->sr_interactions = the_sris;
357    simnfo->nGlobalExcludes = 0;
358    simnfo->excludes = the_excludes;
359  
# Line 383 | Line 410 | void SimSetup::createSim( void ){
410  
411    the_ff->setSimInfo( simnfo );
412  
413 <  makeAtoms();
413 >  makeMolecules();
414    simnfo->identArray = new int[simnfo->n_atoms];
415    for(i=0; i<simnfo->n_atoms; i++){
416      simnfo->identArray[i] = the_atoms[i]->getIdent();
417    }
418    
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
419    if (the_globals->getUseRF() ) {
420      simnfo->useReactionField = 1;
421    
# Line 638 | Line 652 | void SimSetup::createSim( void ){
652  
653   //   new AllLong( simnfo );
654  
641  if( !strcmp( force_field, "TraPPE" ) ) new Verlet( *simnfo, the_ff );
642  if( !strcmp( force_field, "DipoleTest" ) ) new Symplectic( simnfo, the_ff );
655    if( !strcmp( force_field, "TraPPE_Ex" ) ) new Symplectic( simnfo, the_ff );
656    if( !strcmp( force_field, "LJ" ) ) new Verlet( *simnfo, the_ff );
657  
# Line 683 | Line 695 | void SimSetup::makeMolecules( void ){
695    BondStamp* currentBond;
696    BendStamp* currentBend;
697    TorsionStamp* currentTorsion;
698 +
699 +  bond_pair* theBonds;
700 +  bend_set* theBends;
701 +  torsion_set* theTorsions;
702 +
703    
704    //init the forceField paramters
705  
706    the_ff->readParams();
707  
708    
709 <  // init the molecules
709 >  // init the atoms
710  
711 +  double ux, uy, uz, u, uSqr;
712 +  
713    atomOffset = 0;
714    excludeOffset = 0;
715    for(i=0; i<simnfo->n_mol; i++){
# Line 707 | Line 726 | void SimSetup::makeMolecules( void ){
726      info.myExcludes = &the_excludes[excludeOffset];
727      info.myBonds = new Bond*[info.nBonds];
728      info.myBends = new Bend*[info.nBends];
729 <    info.myTorsions = new Torsions*[info.nTorsions];
729 >    info.myTorsions = new Torsion*[info.nTorsions];
730  
731      theBonds = new bond_pair[info.nBonds];
732      theBends = new bend_set[info.nBends];
# Line 717 | Line 736 | void SimSetup::makeMolecules( void ){
736      
737      for(j=0; j<info.nAtoms; j++){
738        
739 <      currentAtom = theComponents[stampID]->getAtom( j );
739 >      currentAtom = comp_stamps[stampID]->getAtom( j );
740        if( currentAtom->haveOrientation() ){
741          
742          dAtom = new DirectionalAtom(j + atomOffset);
# Line 790 | Line 809 | void SimSetup::makeMolecules( void ){
809            
810        if( currentBend->haveExtras() ){
811              
812 <        extras = current_bend->getExtras();
812 >        extras = currentBend->getExtras();
813          current_extra = extras;
814              
815          while( current_extra != NULL ){
# Line 907 | Line 926 | void SimSetup::makeMolecules( void ){
926  
927      the_molecules[i].initialize( info );
928      atomOffset += info.nAtoms;
929 +    delete[] theBonds;
930 +    delete[] theBends;
931 +    delete[] theTorsions;
932    }
933  
934    // clean up the forcefield

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines