@Test public void createExtendedTetrahedralFrom3DCoordinates_cw() throws Exception { IAtomContainer m = new AtomContainer(7, 6, 0, 0); m.addAtom(atom("C", 3, 0.1925, -2.7911, 1.8739)); m.addAtom(atom("C", 0, -0.4383, -2.0366, 0.8166)); m.addAtom(atom("C", 0, 0.2349, -1.2464, 0.0943)); m.addAtom(atom("C", 0, 0.9377, -0.4327, -0.5715)); m.addAtom(atom("C", 3, 1.0851, 0.9388, -0.1444)); m.addAtom(atom("H", 0, 1.3810, -0.7495, -1.4012)); m.addAtom(atom("H", 0, -1.4096, -2.1383, 0.6392)); m.addBond(1, 0, IBond.Order.SINGLE); m.addBond(1, 2, IBond.Order.DOUBLE); m.addBond(2, 3, IBond.Order.DOUBLE); m.addBond(3, 4, IBond.Order.SINGLE); m.addBond(1, 6, IBond.Order.SINGLE); m.addBond(3, 5, IBond.Order.SINGLE); List<IStereoElement> stereos = StereoElementFactory.using3DCoordinates(m).createAll(); assertThat(stereos.size(), is(1)); assertThat(stereos.get(0), instanceOf(ExtendedTetrahedral.class)); ExtendedTetrahedral et = (ExtendedTetrahedral) stereos.get(0); assertThat(et.winding(), is(ITetrahedralChirality.Stereo.CLOCKWISE)); assertThat(et.peripherals(), is(new IAtom[]{m.getAtom(0), m.getAtom(6), m.getAtom(4), m.getAtom(5)})); assertThat(et.focus(), is(m.getAtom(2))); }
@Test public void createExtendedTetrahedralFrom3DCoordinates_ccw() throws Exception { IAtomContainer m = new AtomContainer(7, 6, 0, 0); m.addAtom(atom("C", 3, -1.4096, -2.1383, 0.6392)); m.addAtom(atom("C", 0, -0.4383, -2.0366, 0.8166)); m.addAtom(atom("C", 0, 0.2349, -1.2464, 0.0943)); m.addAtom(atom("C", 0, 0.9377, -0.4327, -0.5715)); m.addAtom(atom("C", 3, 1.0851, 0.9388, -0.1444)); m.addAtom(atom("H", 0, 1.3810, -0.7495, -1.4012)); m.addAtom(atom("H", 0, 0.1925, -2.7911, 1.8739)); m.addBond(1, 0, IBond.Order.SINGLE); m.addBond(1, 2, IBond.Order.DOUBLE); m.addBond(2, 3, IBond.Order.DOUBLE); m.addBond(3, 4, IBond.Order.SINGLE); m.addBond(1, 6, IBond.Order.SINGLE); m.addBond(3, 5, IBond.Order.SINGLE); List<IStereoElement> stereos = StereoElementFactory.using3DCoordinates(m).createAll(); assertThat(stereos.size(), is(1)); assertThat(stereos.get(0), instanceOf(ExtendedTetrahedral.class)); ExtendedTetrahedral et = (ExtendedTetrahedral) stereos.get(0); assertThat(et.winding(), is(ITetrahedralChirality.Stereo.ANTI_CLOCKWISE)); assertThat(et.peripherals(), is(new IAtom[]{m.getAtom(0), m.getAtom(6), m.getAtom(4), m.getAtom(5)})); assertThat(et.focus(), is(m.getAtom(2))); }
outputContainer.setStereoElements(StereoElementFactory.using3DCoordinates(outputContainer) .createAll()); } else if (!forceReadAs3DCoords.isSet()) { // has 2D coordinates (set as 2D coordinates)
outputContainer.setStereoElements(StereoElementFactory.using3DCoordinates(outputContainer) .createAll()); } else if (!forceReadAs3DCoords.isSet()) { // has 2D coordinates (set as 2D coordinates)
@Test public void dontCreateStereoForNonStereogenicIn3D() { IAtomContainer m = new AtomContainer(5, 4, 0, 0); m.addAtom(atom("C", 0, 0.00d, 0.00d, 0.00d)); m.addAtom(atom("H", 0, -0.36d, -0.51d, 0.89d)); m.addAtom(atom("H", 0, 1.09d, 0.00d, 0.00d)); m.addAtom(atom("H", 0, -0.36d, 1.03d, 0.00d)); m.addAtom(atom("H", 0, -0.36d, -0.51d, -0.89d)); m.addBond(0, 1, IBond.Order.SINGLE); m.addBond(0, 2, IBond.Order.SINGLE); m.addBond(0, 3, IBond.Order.SINGLE); m.addBond(0, 4, IBond.Order.SINGLE); List<IStereoElement> elements = StereoElementFactory.using3DCoordinates(m).createAll(); // methane carbon is of course non-stereogenic assertThat(elements.size(), is(0)); }
@Test public void e_but2ene_3d() { IAtomContainer m = new AtomContainer(4, 3, 0, 0); m.addAtom(atom("C", 1, -0.19d, 0.09d, -0.27d)); m.addAtom(atom("C", 1, 0.22d, -1.15d, 0.05d)); m.addAtom(atom("C", 3, 0.21d, 0.75d, -1.49d)); m.addAtom(atom("C", 3, -0.17d, -1.82d, 1.27d)); m.addBond(0, 1, IBond.Order.DOUBLE); m.addBond(0, 2, IBond.Order.SINGLE); m.addBond(1, 3, IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using3DCoordinates(m); IDoubleBondStereochemistry element = factory.createGeometric(m.getBond(0), null); assertNotNull(element); assertThat(element.getStereo(), is(OPPOSITE)); }
/** * Watch out for cumulated bonds with a kink in 3d. The generation program * has not understood the chemistry completely. * * @cdk.smiles CC=[C@]=CC */ @Test public void badlyOptimizedAllene() { IAtomContainer m = new AtomContainer(); m.addAtom(atom("C", 1, -4.02, 3.96, -1.09)); m.addAtom(atom("C", 0, -4.96, 3.82, 0.13)); m.addAtom(atom("C", 3, -3.70, 5.35, -1.67)); m.addAtom(atom("C", 1, -5.27, 2.44, 0.71)); m.addAtom(atom("C", 3, -6.21, 2.30, 1.92)); m.addBond(0, 1, IBond.Order.DOUBLE); m.addBond(0, 2, IBond.Order.SINGLE); m.addBond(1, 3, IBond.Order.DOUBLE); m.addBond(3, 4, IBond.Order.SINGLE); List<IStereoElement> elements = StereoElementFactory.using3DCoordinates(m).createAll(); assertThat(elements.size(), is(0)); }
@Test public void z_but2ene_3d() { IAtomContainer m = new AtomContainer(4, 3, 0, 0); m.addAtom(atom("C", 1, 0.05d, -1.28d, 0.13d)); m.addAtom(atom("C", 1, -0.72d, -0.58d, -0.72d)); m.addAtom(atom("C", 3, 1.11d, -0.74d, 0.95d)); m.addAtom(atom("C", 3, -0.65d, 0.85d, -0.94d)); m.addBond(0, 1, IBond.Order.DOUBLE); m.addBond(0, 2, IBond.Order.SINGLE); m.addBond(1, 3, IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using3DCoordinates(m); IDoubleBondStereochemistry element = factory.createGeometric(m.getBond(0), null); assertNotNull(element); assertThat(element.getStereo(), is(TOGETHER)); }
/** * (E)-hexa-2,3,4-triene * @cdk.smiles C/C=C=C=C/C */ @Test public void e_hexa234triene_3D() { IAtomContainer mol = new AtomContainer(); mol.addAtom(atom("C", 1, 0.29d, 0.01d, 0.02d)); mol.addAtom(atom("C", 0, -0.56d, -0.90d, 0.25d)); mol.addAtom(atom("C", 0, -1.37d, -1.75d, 0.46d)); mol.addAtom(atom("C", 1, -2.24d, -2.65d, 0.67d)); mol.addAtom(atom("C", 3, -3.66d, -2.36d, 0.68d)); mol.addAtom(atom("C", 3, 1.69d, -0.32d, -0.11d)); mol.addBond(0,1,IBond.Order.DOUBLE); mol.addBond(1,2,IBond.Order.DOUBLE); mol.addBond(2,3,IBond.Order.DOUBLE); mol.addBond(3,4,IBond.Order.SINGLE); mol.addBond(0,5,IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using3DCoordinates(mol); List<IBond> dbs = new ArrayList<>(); dbs.add(mol.getBond(0)); dbs.add(mol.getBond(1)); dbs.add(mol.getBond(2)); ExtendedCisTrans element = factory.createExtendedCisTrans(dbs, Stereocenters.of(mol)); assertNotNull(element); assertThat(element.getConfigOrder(), is(IStereoElement.OPPOSITE)); }
/** * (Z)-hexa-2,3,4-triene * @cdk.smiles C/C=C=C=C\C */ @Test public void z_hexa234triene_3D() { IAtomContainer mol = new AtomContainer(); mol.addAtom(atom("C", 1, -0.09d, -0.45d, -1.07d)); mol.addAtom(atom("C", 0, -0.67d, -1.04d, -0.11d)); mol.addAtom(atom("C", 0, -1.23d, -1.59d, 0.79d)); mol.addAtom(atom("C", 1, -1.84d, -2.17d, 1.74d)); mol.addAtom(atom("C", 3, -3.13d, -1.73d, 2.21d)); mol.addAtom(atom("C", 3, -0.70d, 0.69d, -1.73d)); mol.addBond(0,1,IBond.Order.DOUBLE); mol.addBond(1,2,IBond.Order.DOUBLE); mol.addBond(2,3,IBond.Order.DOUBLE); mol.addBond(3,4,IBond.Order.SINGLE); mol.addBond(0,5,IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using3DCoordinates(mol); List<IBond> dbs = new ArrayList<>(); dbs.add(mol.getBond(0)); dbs.add(mol.getBond(1)); dbs.add(mol.getBond(2)); ExtendedCisTrans element = factory.createExtendedCisTrans(dbs, Stereocenters.of(mol)); assertNotNull(element); assertThat(element.getConfigOrder(), is(IStereoElement.TOGETHER)); }
@Test public void r_butan2ol_3d() { IAtomContainer m = new AtomContainer(5, 4, 0, 0); m.addAtom(atom("C", 1, 0.56d, 0.05d, 0.71d)); m.addAtom(atom("C", 2, -0.53d, 0.51d, -0.30d)); m.addAtom(atom("C", 3, 1.81d, -0.53d, 0.02d)); m.addAtom(atom("C", 3, -1.80d, 1.06d, 0.37d)); m.addAtom(atom("O", 1, 0.95d, 1.15d, 1.54d)); m.addBond(0, 1, IBond.Order.SINGLE); m.addBond(0, 2, IBond.Order.SINGLE); m.addBond(1, 3, IBond.Order.SINGLE); m.addBond(0, 4, IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using3DCoordinates(m); ITetrahedralChirality element = factory.createTetrahedral(m.getAtom(0), Stereocenters.of(m)); assertNotNull(element); assertThat(element.getStereo(), is(ITetrahedralChirality.Stereo.CLOCKWISE)); }
@Test public void s_butan2ol_3d() { IAtomContainer m = new AtomContainer(5, 4, 0, 0); m.addAtom(atom("C", 1, -0.17d, -0.12d, -0.89d)); m.addAtom(atom("C", 2, 1.12d, -0.91d, -0.51d)); m.addAtom(atom("C", 3, -0.10d, 0.46d, -2.32d)); m.addAtom(atom("C", 3, 1.07d, -1.54d, 0.91d)); m.addAtom(atom("O", 1, -0.38d, 0.96d, 0.02d)); m.addBond(0, 1, IBond.Order.SINGLE); m.addBond(0, 2, IBond.Order.SINGLE); m.addBond(1, 3, IBond.Order.SINGLE); m.addBond(0, 4, IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using3DCoordinates(m); ITetrahedralChirality element = factory.createTetrahedral(m.getAtom(0), Stereocenters.of(m)); assertNotNull(element); assertThat(element.getStereo(), is(ITetrahedralChirality.Stereo.ANTI_CLOCKWISE)); }
@Test public void onlyCreateStereoForConsitionalDifferencesIn3D() { IAtomContainer m = new AtomContainer(8, 7, 0, 0); m.addAtom(atom("C", 1, -1.00d, -0.25d, 1.22d)); m.addAtom(atom("O", 1, -1.82d, 0.20d, 2.30d)); m.addAtom(atom("C", 1, -0.04d, -1.38d, 1.71d)); m.addAtom(atom("C", 1, -0.24d, 0.95d, 0.57d)); m.addAtom(atom("O", 1, 0.82d, -0.90d, 2.75d)); m.addAtom(atom("O", 1, 0.63d, 1.58d, 1.51d)); m.addAtom(atom("C", 3, -0.81d, -2.61d, 2.25d)); m.addAtom(atom("C", 3, -1.19d, 2.03d, -0.01d)); m.addBond(0, 1, IBond.Order.SINGLE); m.addBond(0, 2, IBond.Order.SINGLE); m.addBond(0, 3, IBond.Order.SINGLE); m.addBond(2, 4, IBond.Order.SINGLE); m.addBond(3, 5, IBond.Order.SINGLE); m.addBond(2, 6, IBond.Order.SINGLE); m.addBond(3, 7, IBond.Order.SINGLE); List<IStereoElement> elements = StereoElementFactory.using3DCoordinates(m).createAll(); // XXX: really 3 but we can't tell the middle centre is one ATM, see // 'dontCreateStereoForNonStereogenicIn3D' assertThat(elements.size(), is(2)); }
@Test public void s_butan2ol_3d_expH() { IAtomContainer m = new AtomContainer(6, 5, 0, 0); m.addAtom(atom("C", 0, -0.17d, -0.12d, -0.89d)); m.addAtom(atom("C", 2, 1.12d, -0.91d, -0.51d)); m.addAtom(atom("C", 3, -0.10d, 0.46d, -2.32d)); m.addAtom(atom("C", 3, 1.07d, -1.54d, 0.91d)); m.addAtom(atom("O", 1, -0.38d, 0.96d, 0.02d)); m.addAtom(atom("H", 0, -1.03d, -0.79d, -0.83d)); m.addBond(0, 1, IBond.Order.SINGLE); m.addBond(0, 2, IBond.Order.SINGLE); m.addBond(1, 3, IBond.Order.SINGLE); m.addBond(0, 4, IBond.Order.SINGLE); m.addBond(0, 5, IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using3DCoordinates(m); ITetrahedralChirality element = factory.createTetrahedral(m.getAtom(0), Stereocenters.of(m)); assertNotNull(element); assertThat(element.getStereo(), is(ITetrahedralChirality.Stereo.ANTI_CLOCKWISE)); }
@Test public void r_butan2ol_3d_expH() { IAtomContainer m = new AtomContainer(6, 5, 0, 0); m.addAtom(atom("C", 0, -0.07d, -0.14d, 0.50d)); m.addAtom(atom("C", 2, -0.05d, -1.20d, -0.65d)); m.addAtom(atom("C", 3, 0.98d, -0.46d, 1.60d)); m.addAtom(atom("C", 3, -1.11d, -0.94d, -1.75d)); m.addAtom(atom("O", 1, 0.21d, 1.16d, -0.01d)); m.addAtom(atom("H", 0, -1.06d, -0.13d, 0.96d)); m.addBond(0, 1, IBond.Order.SINGLE); m.addBond(0, 2, IBond.Order.SINGLE); m.addBond(1, 3, IBond.Order.SINGLE); m.addBond(0, 4, IBond.Order.SINGLE); m.addBond(0, 5, IBond.Order.SINGLE); StereoElementFactory factory = StereoElementFactory.using3DCoordinates(m); ITetrahedralChirality element = factory.createTetrahedral(m.getAtom(0), Stereocenters.of(m)); assertNotNull(element); assertThat(element.getStereo(), is(ITetrahedralChirality.Stereo.CLOCKWISE)); }
m.addBond(13, 14, IBond.Order.SINGLE); List<IStereoElement> stereo = StereoElementFactory.using3DCoordinates(m) .createAll(); assertThat(stereo.size(), is(1));