/// <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); } }
/// <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 Âle;ngstrom. /// </summary> public virtual void rebond(IAtomContainer container) { container.removeAllBonds(); maxCovalentRadius = 0.0; // construct a new binary space partition tree bspt = new Bspt(3); IAtom[] atoms = container.Atoms; for (int i = atoms.Length; --i >= 0;) { IAtom atom = atoms[i]; double myCovalentRadius = atom.CovalentRadius; if (myCovalentRadius == 0.0) { //throw new CDKException("Atom(s) does not have covalentRadius defined."); } else { if (myCovalentRadius > maxCovalentRadius) { maxCovalentRadius = myCovalentRadius; } TupleAtom tupleAtom = new TupleAtom(atom); bspt.addTuple(tupleAtom); } } // rebond all atoms for (int i = atoms.Length; --i >= 0;) { bondAtom(container, atoms[i]); } }
/// <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 Âle;ngstrom. /// </summary> public virtual void rebond(IAtomContainer container) { container.removeAllBonds(); maxCovalentRadius = 0.0; // construct a new binary space partition tree bspt = new Bspt(3); IAtom[] atoms = container.Atoms; for (int i = atoms.Length; --i >= 0; ) { IAtom atom = atoms[i]; double myCovalentRadius = atom.CovalentRadius; if (myCovalentRadius == 0.0) { //throw new CDKException("Atom(s) does not have covalentRadius defined."); } else { if (myCovalentRadius > maxCovalentRadius) maxCovalentRadius = myCovalentRadius; TupleAtom tupleAtom = new TupleAtom(atom); bspt.addTuple(tupleAtom); } } // rebond all atoms for (int i = atoms.Length; --i >= 0; ) { bondAtom(container, atoms[i]); } }