private boolean flipStereo(IAtom atom) { List<IBond> bonds = nbrs.get(atom); for (IStereoElement se : mol.stereoElements()) { if (se.getConfigClass() == IStereoElement.TH && se.getFocus().equals(atom)) { @SuppressWarnings("unchecked") List<IAtom> src = (List<IAtom>) se.getCarriers(); List<IAtom> dst = new ArrayList<>(); for (IBond bond : bonds) dst.add(bond.getOther(atom)); if (dst.size() == 3) { if (avisit.contains(dst.get(0))) dst.add(1, atom); else dst.add(0, atom); } return parity4(src.toArray(new IAtom[4]), dst.toArray(new IAtom[4])) == 1; } } // no enough info return false; }
private void setBondDirs(IAtomContainer mol) { adjToDb = new HashSet<>(); ses = new HashMap<>(); bvisit = new HashSet<>(); for (IStereoElement se : mol.stereoElements()) { if (se.getConfigClass() == IStereoElement.CisTrans) { ses.put(se.getFocus(), se); } } for (IBond bond : mol.bonds()) { Expr expr = ((QueryBond) BondRef.deref(bond)).getExpression(); int flags = getBondStereoFlag(expr); if (flags != BSTEREO_ANY) { adjToDb.add(bond.getBegin()); adjToDb.add(bond.getEnd()); } } // first we set and propagate for (IBond bond : mol.bonds()) { if (!bvisit.contains(bond)) propagateBondStereo(bond, false); } // now set the complex ones for (IBond bond : mol.bonds()) { if (!bvisit.contains(bond)) propagateBondStereo(bond, true); } }
private void rubricTetrahedralsCdk() { for (IStereoElement se : mol.stereoElements()) { if (se.getConfigClass() == IStereoElement.Tetrahedral) { @SuppressWarnings("unchecked") final IStereoElement<IAtom, IAtom> th = (IStereoElement<IAtom, IAtom>) se; final IAtom focus = th.getFocus(); final List<IAtom> carriers = th.getCarriers(); int[] adj = new int[4]; for (int i = 0; i < 4; i++) { if (focus.equals(carriers.get(i))) adj[i] = -1; // impl H else adj[i] = mol.indexOf(carriers.get(i)); } switch (th.getConfigOrder()) { case IStereoElement.LEFT: int i = adj[2]; adj[2] = adj[3]; adj[3] = i; tetra[mol.indexOf(focus)] = adj; break; case IStereoElement.RIGHT: tetra[mol.indexOf(focus)] = adj; break; default: } } } }
int nIncorrectStereo = 0; for (IStereoElement se : macrocycle.stereoElements()) { if (se.getConfigClass() == IStereoElement.CisTrans) { IBond bond = (IBond) se.getFocus(); IAtom beg = bond.getBegin();
int nIncorrectStereo = 0; for (IStereoElement se : macrocycle.stereoElements()) { if (se.getConfigClass() == IStereoElement.CisTrans) { IBond bond = (IBond) se.getFocus(); IAtom beg = bond.getBegin();
if (se.getConfigClass() == IStereoElement.CisTrans) { IBond stereoBond = (IBond) se.getFocus(); IBond firstCarrier = (IBond) se.getCarriers().get(0);
if (se.getConfigClass() == IStereoElement.CisTrans) { IBond stereoBond = (IBond) se.getFocus(); IBond firstCarrier = (IBond) se.getCarriers().get(0);
se.getConfigClass() == IStereoElement.TH && optset.contains(STEREOCHEMISTRY)) { expr.and(new Expr(STEREOCHEMISTRY, se.getConfigOrder()));