--- trunk/OOPSE/libmdtools/SimSetup.cpp 2003/03/24 21:55:34 394 +++ trunk/OOPSE/libmdtools/SimSetup.cpp 2003/03/26 20:22:02 407 @@ -670,7 +670,129 @@ void SimSetup::createSim( void ){ MPIcheckPoint(); #endif // is_mpi } + + +void SimSetup::makeMolecules( void ){ + + int i, j, exI, exJ, tempEx, stampID, atomOffset; + molInit info; + DirectionalAtom* dAtom; + AtomStamp* currentAtom; + BondStamp* currentBond; + BendStamp* currentBend; + TorsionStamp* currentTorsion; + + //init the forceField paramters + + the_ff->readParams(); + + + // init the molecules + + atomOffset = 0; + for(i=0; in_mol; i++){ + + stampID = the_molecules[i].getStampID(); + + info.nAtoms = comp_stamps[stampID]->getNAtoms(); + info.nBonds = comp_stamps[stampID]->getNBonds(); + info.nBends = comp_stamps[stampID]->getNBends(); + info.nTorsions = comp_stamps[stampID]->getNTorsions(); + + info.myAtoms = &the_atoms[atomOffset]; + info.myBonds = new Bond*[info.nBonds]; + info.myBends = new Bend*[info.nBends]; + info.myTorsions = new Torsions*[info.nTorsions]; + + theBonds = new bond_pair[info.nBonds]; + theBends = new bend_set[info.nBends]; + theTorsions = new torsion_set[info.nTorsions]; + + // make the Atoms + + for(j=0; jgetAtom( j ); + if( currentAtom->haveOrientation() ){ + + dAtom = new DirectionalAtom(j + atomOffset); + simnfo->n_oriented++; + info.myAtoms[j] = dAtom; + + ux = currentAtom->getOrntX(); + uy = currentAtom->getOrntY(); + uz = currentAtom->getOrntZ(); + + uSqr = (ux * ux) + (uy * uy) + (uz * uz); + + u = sqrt( uSqr ); + ux = ux / u; + uy = uy / u; + uz = uz / u; + + dAtom->setSUx( ux ); + dAtom->setSUy( uy ); + dAtom->setSUz( uz ); + } + else{ + info.myAtoms[j] = new GeneralAtom(j + atomOffset); + } + info.myAtoms[j]->setType( currentAtom->getType() ); + +#ifdef IS_MPI + + info.myAtoms[j]->setGlobalIndex( globalIndex[j+atomOffset] ); + +#endif // is_mpi + } + + // make the bonds + for(j=0; jgetBond( j ); + theBonds[j].a = currentBond->getA() + atomOffset; + theBonds[j].b = currentBond->getB() + atomOffset; + + exI = theBonds[i].a; + exJ = theBonds[i].b; + + // exclude_I must always be the smaller of the pair + if( exI > exJ ){ + tempEx = exI; + exI = exJ; + exJ = tempEx; + } +#ifdef IS_MPI + + the_excludes[index*2] = + the_atoms[exI]->getGlobalIndex() + 1; + the_excludes[index*2 + 1] = + the_atoms[exJ]->getGlobalIndex() + 1; + +#else // isn't MPI + + the_excludes[index*2] = exI + 1; + the_excludes[index*2 + 1] = exJ + 1; + // fortran index from 1 (hence the +1 in the indexing) +#endif //is_mpi + + } + + + + + + + + + + + + + + + void SimSetup::makeAtoms( void ){ int i, j, k, index;