--- trunk/OOPSE/libmdtools/SimSetup.cpp 2003/04/10 20:08:56 489 +++ trunk/OOPSE/libmdtools/SimSetup.cpp 2003/06/17 21:56:15 555 @@ -67,7 +67,7 @@ void SimSetup::createSim( void ){ MakeStamps *the_stamps; Globals* the_globals; ExtendedSystem* the_extendedsystem; - int i, j; + int i, j, k, globalAtomIndex; // get the stamps and globals; the_stamps = stamps; @@ -298,16 +298,15 @@ void SimSetup::createSim( void ){ simnfo->n_torsions = tot_torsions; simnfo->n_SRI = tot_SRI; simnfo->n_mol = tot_nmol; - + simnfo->molMembershipArray = new int[tot_atoms]; + #ifdef IS_MPI // divide the molecules among processors here. mpiSim = new mpiSimulation( simnfo ); - - globalIndex = mpiSim->divideLabor(); // set up the local variables @@ -324,6 +323,9 @@ void SimSetup::createSim( void ){ local_bonds = 0; local_bends = 0; local_torsions = 0; + globalAtomIndex = 0; + + for( i=0; igetNTorsions(); localMol++; } - allMol++; + for (k = 0; k < comp_stamps[i]->getNAtoms(); k++) { + simnfo->molMembershipArray[globalAtomIndex] = allMol; + globalAtomIndex++; + } + + allMol++; } } local_SRI = local_bonds + local_bends + local_torsions; - simnfo->n_atoms = mpiSim->getMyNlocal(); if( local_atoms != simnfo->n_atoms ){ @@ -393,11 +399,16 @@ void SimSetup::createSim( void ){ #else // is_mpi molIndex = 0; + globalAtomIndex = 0; for(i=0; igetNAtoms(); k++) { + simnfo->molMembershipArray[globalAtomIndex] = molIndex; + globalAtomIndex++; + } molIndex++; } } @@ -487,13 +498,9 @@ void SimSetup::createSim( void ){ makeMolecules(); simnfo->identArray = new int[simnfo->n_atoms]; - simnfo->molMembershipArray = new int[simnfo->n_atoms]; for(i=0; in_atoms; i++){ simnfo->identArray[i] = the_atoms[i]->getIdent(); } - for(i=0; i< simnfo->n_mol; i++) { - the_molecules[i].atomicRollCall(simnfo->molMembershipArray); - } if (the_globals->getUseRF() ) { simnfo->useReactionField = 1; @@ -727,21 +734,16 @@ void SimSetup::createSim( void ){ if( the_globals->haveTempSet() ) simnfo->setTemp = the_globals->getTempSet(); -// // make the longe range forces and the integrator - -// new AllLong( simnfo ); + // make the integrator - if( !strcmp( force_field, "TraPPE_Ex" ) ){ + if( !strcmp( ensemble, "TraPPE_Ex" ) ){ new Symplectic(simnfo, the_ff, the_extendedsystem); } else if( !strcmp( force_field, "LJ" ) ){ new Verlet( *simnfo, the_ff, the_extendedsystem ); } - else { - std::cerr << "I'm a bug.\n"; - fprintf( stderr, "Ima bug. stderr %s\n", force_field); - } + #ifdef IS_MPI mpiSim->mpiRefresh(); #endif