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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines