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 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: } } } }
if (se.getConfigClass() == IStereoElement.CisTrans) { IBond stereoBond = (IBond) se.getFocus(); IBond firstCarrier = (IBond) se.getCarriers().get(0); IBond secondCarrier = (IBond) se.getCarriers().get(1); for (IRingSet ringSet : ringSystems) { for (IAtomContainer ring : ringSet.atomContainers()) {
if (se.getConfigClass() == IStereoElement.CisTrans) { IBond stereoBond = (IBond) se.getFocus(); IBond firstCarrier = (IBond) se.getCarriers().get(0); IBond secondCarrier = (IBond) se.getCarriers().get(1); for (IRingSet ringSet : ringSystems) { for (IAtomContainer ring : ringSet.atomContainers()) {
if (se.getCarriers().contains(bBond) != se.getCarriers().contains(eBond)) { switch (flags) { case BSTEREO_CIS:
IStereoElement s2 = stereoDown.get(0); assertThat(s1.getFocus(), is(s2.getFocus())); assertThat(s1.getCarriers(), is(s2.getCarriers())); assertThat(s1.getConfigOrder(), is(IStereoElement.RIGHT)); assertThat(s2.getConfigOrder(), is(IStereoElement.LEFT)); IStereoElement s3 = stereoUpOther.get(0); assertThat(s3.getFocus(), is(s2.getFocus())); assertThat(s3.getCarriers(), is(s2.getCarriers())); assertThat(s3.getConfigOrder(), is(s2.getConfigOrder())); IStereoElement s4 = stereoDownOther.get(0); assertThat(s4.getFocus(), is(s1.getFocus())); assertThat(s4.getCarriers(), is(s1.getCarriers())); assertThat(s4.getConfigOrder(), is(s1.getConfigOrder()));