Ejemplo n.º 1
0
 /// <summary>
 /// Rebonding using a Binary Space Partition Tree. Note, that any bonds
 /// defined will be deleted first. It assumes the unit of 3D space to
 /// be 1 Å.
 /// </summary>
 public void Rebond(IAtomContainer container)
 {
     container.Bonds.Clear();
     maxCovalentRadius = 0.0;
     // construct a new binary space partition tree
     bspt = new Bspt <ITupleAtom>(3);
     foreach (var atom in container.Atoms)
     {
         double myCovalentRadius = atom.CovalentRadius.Value;
         if (myCovalentRadius == 0.0)
         {
             throw new CDKException("Atom(s) does not have covalentRadius defined.");
         }
         if (myCovalentRadius > maxCovalentRadius)
         {
             maxCovalentRadius = myCovalentRadius;
         }
         TupleAtom tupleAtom = new TupleAtom(atom);
         bspt.AddTuple(tupleAtom);
     }
     // rebond all atoms
     foreach (var atom in container.Atoms)
     {
         BondAtom(container, atom);
     }
 }