final IAtom atom2 = outOfOrder ? bond.getBegin() : bond.getEnd(); if (IBond.Stereo.E_OR_Z.equals(bond.getStereo())) return generateCrossedDoubleBond(atom1, atom2);
/** * Create a stereo encoder for all potential 2D and 3D double bond stereo * configurations. * * @param container an atom container * @param graph adjacency list representation of the container * @return a new encoder for tetrahedral elements */ @Override public StereoEncoder create(IAtomContainer container, int[][] graph) { List<StereoEncoder> encoders = new ArrayList<StereoEncoder>(5); for (IBond bond : container.bonds()) { // if double bond and not E or Z query bond if (DOUBLE.equals(bond.getOrder()) && !E_OR_Z.equals(bond.getStereo())) { IAtom left = bond.getBegin(); IAtom right = bond.getEnd(); // skip -N=N- double bonds which exhibit inversion if (Integer.valueOf(7).equals(left.getAtomicNumber()) && Integer.valueOf(7).equals(right.getAtomicNumber())) continue; StereoEncoder encoder = newEncoder(container, left, right, right, left, graph); if (encoder != null) { encoders.add(encoder); } } } return encoders.isEmpty() ? StereoEncoder.EMPTY : new MultiStereoEncoder(encoders); }
/** * Test whether we accept atom and it's connected bonds for inclusion in a * double bond configuration. This method checks for query bonds (up/down) * as well as double bond counts. If there is more then one double bond in * the connect bonds then it cannot have Z/E configuration. * * @param atom a double bonded atom * @param bonds all bonds connected to the atom * @return whether the atom is accepted for configuration */ static boolean accept(IAtom atom, List<IBond> bonds) { int dbCount = 0; // not SP2 if (!IAtomType.Hybridization.SP2.equals(atom.getHybridization())) return false; // only have one neighbour (which is the other atom) -> this is no configurable if (bonds.size() == 1) return false; for (IBond bond : bonds) { // increment the number of double bonds if (DOUBLE.equals(bond.getOrder())) dbCount++; // up/down bonds sometimes used to indicate E/Z IBond.Stereo stereo = bond.getStereo(); if (IBond.Stereo.UP_OR_DOWN.equals(stereo) || IBond.Stereo.UP_OR_DOWN_INVERTED.equals(stereo)) return false; } // not cumulated return dbCount == 1; }
private boolean hasStereoBonds(IAtomContainer container, IAtom atom) { for (IBond bond : container.getConnectedBondsList(atom)) { IBond.Stereo stereo = bond.getStereo(); if (UP.equals(stereo) || DOWN.equals(stereo) || UP_INVERTED.equals(stereo) || DOWN_INVERTED.equals(stereo)) { return TRUE; } } return FALSE; } }
/** * Helper method determines if a bond is defined (not null) and whether it * is a sigma (single) bond with no stereo attribute (wedge/hatch). * * @param bond the bond to test * @return the bond is a planar sigma bond */ private static boolean isPlanarSigmaBond(IBond bond) { return bond != null && IBond.Order.SINGLE.equals(bond.getOrder()) && IBond.Stereo.NONE.equals(bond.getStereo()); }
/** * Helper method determines if a bond is defined (not null) and whether * it is a sigma (single) bond with no stereo attribute (wedge/hatch). * * @param bond the bond to test * @return the bond is a planar sigma bond */ private static boolean isPlanarSigmaBond(IBond bond) { return bond != null && IBond.Order.SINGLE.equals(bond.getOrder()) && IBond.Stereo.NONE.equals(bond.getStereo()); }