Returns a vector of all rings that this bond is part of.

@param   bond  The bond to be checked
@return   A vector of all rings that this bond is part of
544625
@Override
    public IRingSet getRings(IBond bond) {
        IRingSet rings = bond.getBuilder().newInstance(IRingSet.class);
        Ring ring;
        for (int i = 0; i < getAtomContainerCount(); i++) {
            ring = (Ring) getAtomContainer(i);
            if (ring.contains(bond)) {
                rings.addAtomContainer(ring);
            }
        }
        return rings;
    }
270212
public static final Atom getCenterVector(Atom[] atomSet){
		Atom centroid = getCentroid(atomSet);

		return getCenterVector(atomSet,centroid);

	}
1145732
public IAtomContainer getCyclicFragmentsContainer() {
        IAtomContainer fragContainer = this.molecule.getBuilder().newInstance(IAtomContainer.class);
        IAtomContainer spt = getSpanningTree();

        for (int i = 0; i < totalEdgeCount; i++)
            if (!bondsInTree[i]) {
                IRing ring = getRing(spt, molecule.getBond(i));
                for (int b = 0; b < ring.getBondCount(); b++) {
                    IBond ringBond = ring.getBond(b);
                    if (!fragContainer.contains(ringBond)) {
                        for (int atomCount = 0; atomCount < ringBond.getAtomCount(); atomCount++) {
                            IAtom atom = ringBond.getAtom(atomCount);
                            if (!fragContainer.contains(atom)) {
                                atom.setFlag(CDKConstants.ISINRING, true);
                                fragContainer.addAtom(atom);
                            }
                        }
                        fragContainer.addBond(ringBond);
                    }
                }
            }
        return fragContainer;
    }
675992
public static int[][] getMatrix(IAtomContainer container) {
        IBond bond;
        int indexAtom1;
        int indexAtom2;
        int[][] conMat = new int[container.getAtomCount()][container.getAtomCount()];
        for (int f = 0; f < container.getBondCount(); f++) {
            bond = container.getBond(f);
            indexAtom1 = container.indexOf(bond.getBegin());
            indexAtom2 = container.indexOf(bond.getEnd());
            conMat[indexAtom1][indexAtom2] = 1;
            conMat[indexAtom2][indexAtom1] = 1;
        }
        return conMat;
    }
1371333
private static BitSet available(int[][] graph, IAtom[] atoms, EdgeToBondMap bonds) {

        final BitSet available = new BitSet();

        // for all atoms, select those that require a double-bond
        ATOMS: for (int i = 0; i < atoms.length; i++) {

            final IAtom atom = atoms[i];

            // preconditions
            if (atom.getAtomicNumber() == null)
                throw new IllegalArgumentException("atom " + (i + 1) + " had unset atomic number");
            if (atom.getFormalCharge() == null)
                throw new IllegalArgumentException("atom " + (i + 1) + " had unset formal charge");
            if (atom.getImplicitHydrogenCount() == null)
                throw new IllegalArgumentException("atom " + (i + 1) + " had unset implicit hydrogen count");

            if (!atom.getFlag(ISAROMATIC)) continue;

            // count preexisting pi-bonds, a higher bond order causes a skip
            int nPiBonds = 0;
            for (final int w : graph[i]) {
                IBond.Order order = bonds.get(i, w).getOrder();
                if (order == DOUBLE) {
                    nPiBonds++;
                } else if (order.numeric() > 2) {
                    continue ATOMS;
                }
            }

            // check if a pi bond can be assigned
            final int element = atom.getAtomicNumber();
            final int charge = atom.getFormalCharge();
            final int valence = graph[i].length + atom.getImplicitHydrogenCount() + nPiBonds;

            if (available(element, charge, valence)) {
                available.set(i);
            }
        }

        return available;
    }
141318
def get_bonds(input_group):
    """"""
    out_list = []
    for i in range(len(input_group.bond_order_list)):
        out_list.append((input_group.bond_atom_list[i * 2], input_group.bond_atom_list[i * 2 + 1],))
    return out_list
866619
public boolean areIntersected(IBond bond1, IBond bond2) {
        double x1 = 0, x2 = 0, x3 = 0, x4 = 0;
        double y1 = 0, y2 = 0, y3 = 0, y4 = 0;
        //Point2D.Double p1 = null, p2 = null, p3 = null, p4 = null;

        x1 = bond1.getBegin().getPoint2d().x;
        x2 = bond1.getEnd().getPoint2d().x;
        x3 = bond2.getBegin().getPoint2d().x;
        x4 = bond2.getEnd().getPoint2d().x;

        y1 = bond1.getBegin().getPoint2d().y;
        y2 = bond1.getEnd().getPoint2d().y;
        y3 = bond2.getBegin().getPoint2d().y;
        y4 = bond2.getEnd().getPoint2d().y;

        Line2D.Double line1 = new Line2D.Double(new Point2D.Double(x1, y1), new Point2D.Double(x2, y2));
        Line2D.Double line2 = new Line2D.Double(new Point2D.Double(x3, y3), new Point2D.Double(x4, y4));

        if (line1.intersectsLine(line2)) {
            logger.debug("Two intersecting bonds detected.");
            return true;
        }
        return false;
    }
1157570
private IRingSet getRingSetOfAtom(List ringSystems, IAtom atom) {
        IRingSet ringSetOfAtom = null;
        for (int i = 0; i < ringSystems.size(); i++) {
            if (((IRingSet) ringSystems.get(i)).contains(atom)) {
                return (IRingSet) ringSystems.get(i);
            }
        }
        return ringSetOfAtom;
    }
526239
private IRing prepareRing(List vec, IAtomContainer mol) {
        // add the atoms in vec to the new ring
        int atomCount = vec.size();
        IRing ring = mol.getBuilder().newInstance(IRing.class, atomCount);
        IAtom[] atoms = new IAtom[atomCount];
        vec.toArray(atoms);
        ring.setAtoms(atoms);
        // add the bonds in mol to the new ring
        try {
            IBond b;
            for (int i = 0; i < atomCount - 1; i++) {
                b = mol.getBond(atoms[i], atoms[i + 1]);
                if (b != null) {
                    ring.addBond(b);
                } else {
                    logger.error("This should not happen.");
                }
            }
            b = mol.getBond(atoms[0], atoms[atomCount - 1]);
            if (b != null) {
                ring.addBond(b);
            } else {
                logger.error("This should not happen either.");
            }
        } catch (Exception exc) {
            logger.debug(exc);
        }
        logger.debug("found Ring  ", ring);
        return ring;
    }
564510
static Vector2d newUnitVector(final IAtom atom, final IBond bond) {
        return newUnitVector(atom.getPoint2d(), bond.getOther(atom).getPoint2d());
    }
999
private IRingSet recoverRingSystem(IAtomContainer mol) {
        IRingSet ringSet = mol.getBuilder().newInstance(IRingSet.class);
        for (Integer[] bondNumbers : listOfRings) {
            IRing ring = mol.getBuilder().newInstance(IRing.class, bondNumbers.length);
            for (int bondNumber : bondNumbers) {
                IBond bond = mol.getBond(bondNumber);
                ring.addBond(bond);
                if (!ring.contains(bond.getBegin())) ring.addAtom(bond.getBegin());
                if (!ring.contains(bond.getEnd())) ring.addAtom(bond.getEnd());
            }
            ringSet.addAtomContainer(ring);
        }
        return ringSet;
    }
248370
public int getEnergies(IBond bond) {
        int dKJPerMol = -1;
        for (Map.Entry<Integer, BondEnergy> entry : bondEngergies.entrySet()) {
            BondEnergy bondEnergy = entry.getValue();
            if (bondEnergy.matches(bond)) {
                dKJPerMol = bondEnergy.getEnergy();
            }
        }
        return dKJPerMol;
    }
944532
public double[][] buildBondMatrix() {
        int i, j, k, m;
        for (i = 0; i < nodeNumber; i++) {
            for (j = 1; j <= layerNumber; j++) {
                bondMatrix[i][j - 1] = 0.0;
                for (k = 0; k < nodeNumber; k++) {
                    if (j == 1) {
                        if (apspMatrix[i][k] == j) {
                            bondMatrix[i][j - 1] += adjaMatrix[i][k];
                        }
                    } else {
                        if (apspMatrix[i][k] == j) {
                            for (m = 0; m < nodeNumber; m++) {
                                if (apspMatrix[i][m] == (j - 1)) {
                                    bondMatrix[i][j - 1] += adjaMatrix[k][m];
                                }
                            }
                        }
                    }
                }
            }
        }
        return bondMatrix;
    }
479525
private IBond checkEdges(IRing ring, IAtomContainer molecule) {
        IRing r1, r2;
        IRingSet ringSet = ring.getBuilder().newInstance(IRingSet.class);
        IBond bond;
        int minMaxSize = Integer.MAX_VALUE;
        int minMax = 0;
        logger.debug("Molecule: " + molecule);
        Iterator<IBond> bonds = ring.bonds().iterator();
        while (bonds.hasNext()) {
            bond = (IBond) bonds.next();
            molecule.removeElectronContainer(bond);
            r1 = getRing(bond.getBegin(), molecule);
            r2 = getRing(bond.getEnd(), molecule);
            logger.debug("checkEdges: " + bond);
            if (r1.getAtomCount() > r2.getAtomCount()) {
                ringSet.addAtomContainer(r1);
            } else {
                ringSet.addAtomContainer(r2);
            }
            molecule.addBond(bond);
        }
        for (int i = 0; i < ringSet.getAtomContainerCount(); i++) {
            if (((IRing) ringSet.getAtomContainer(i)).getBondCount() < minMaxSize) {
                minMaxSize = ((IRing) ringSet.getAtomContainer(i)).getBondCount();
                minMax = i;
            }
        }
        return (IBond) ring.getElectronContainer(minMax);
    }
186872
private List<List<Integer>> assignRingGroups(List<Integer[]> rBondsArray) {
        List<List<Integer>> ringGroups;
        ringGroups = new ArrayList<List<Integer>>();
        for (int i = 0; i < rBondsArray.size() - 1; i++) { //for each ring except the last in rBondsArray
            for (int j = 0; j < rBondsArray.get(i).length; j++) { //for each bond in each ring

                //check there's no shared bond with any other ring already in ringGroups
                for (int k = i + 1; k < rBondsArray.size(); k++) {
                    for (int l = 0; l < rBondsArray.get(k).length; l++) { //for each ring in each ring

                        //Is there a bond in common? Then add both rings
                        if (Objects.equals(rBondsArray.get(i)[j], rBondsArray.get(k)[l])) {
                            if (i != k) {
                                ringGroups.add(new ArrayList<Integer>());
                                ringGroups.get(ringGroups.size() - 1).add(i);
                                ringGroups.get(ringGroups.size() - 1).add(k);
                            }
                        }
                    }
                }
            }
        }
        while (combineGroups(ringGroups));

        //Anything not added yet is a singleton
        for (int i = 0; i < rBondsArray.size(); i++) {
            boolean found = false;
            for (int j = 0; j < ringGroups.size(); j++) {
                if (ringGroups.get(j).contains(i)) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                ringGroups.add(new ArrayList<Integer>());
                ringGroups.get(ringGroups.size() - 1).add(i);
            }
        }
        return ringGroups;
    }
1024311
Vector2d getRingCenterOfFirstRing(IRing ring, Vector2d bondVector, double bondLength) {
        int size = ring.getAtomCount();
        double radius = bondLength / (2 * Math.sin((Math.PI) / size));
        double newRingPerpendicular = Math.sqrt(Math.pow(radius, 2) - Math.pow(bondLength / 2, 2));
        /* get the angle between the x axis and the bond vector */
        double rotangle = GeometryUtil.getAngle(bondVector.x, bondVector.y);
        /*
         * Add 90 Degrees to this angle, this is supposed to be the new
         * ringcenter vector
         */
        rotangle += Math.PI / 2;
        return new Vector2d(Math.cos(rotangle) * newRingPerpendicular, Math.sin(rotangle) * newRingPerpendicular);
    }
523125
public static int getSingleBondEquivalentSum(Iterator<IBond> bonds) {
        int sum = 0;
        while (bonds.hasNext()) {
            IBond.Order order = bonds.next().getOrder();
            if (order != null) {
                sum += order.numeric();
            }
        }
        return sum;
    }