@Test public void newNitrogenAtom() { IAtom a = g2c.newCDKAtom(AtomBuilder.aliphatic(Element.Nitrogen).build()); assertThat(a, is(instanceOf(IAtom.class))); assertThat(a, is(not(instanceOf(IPseudoAtom.class)))); assertThat(a.getSymbol(), is("N")); }
@Test public void newCarbonAtom() { IAtom a = g2c.newCDKAtom(AtomBuilder.aliphatic(Element.Carbon).build()); assertThat(a, is(instanceOf(IAtom.class))); assertThat(a, is(not(instanceOf(IPseudoAtom.class)))); assertThat(a.getSymbol(), is("C")); }
@Test public void newUnknownAtom() { IAtom a = g2c.newCDKAtom(AtomBuilder.aliphatic(Element.Unknown).build()); assertThat(a, is(instanceOf(IPseudoAtom.class))); assertThat(((IPseudoAtom) a).getLabel(), is("*")); }
@Test public void methaneAtom() { IAtom a = g2c.toCDKAtom(AtomBuilder.aliphatic(Element.Carbon).hydrogens(4).build(), 4); assertThat(a.getSymbol(), is("C")); assertThat(a.getImplicitHydrogenCount(), is(4)); }
@Test public void waterAtom() { IAtom a = g2c.toCDKAtom(AtomBuilder.aliphatic(Element.Oxygen).hydrogens(2).build(), 2); assertThat(a.getSymbol(), is("O")); assertThat(a.getImplicitHydrogenCount(), is(2)); }
private static void traverse(State s, int idx) { s.visit[idx] = true; int mapIdx = s.g.atom(idx).atomClass(); if (mapIdx != 0) { if (s.map[mapIdx] == 0) s.map[mapIdx] = ++s.nMaps; mapIdx = s.map[mapIdx]; s.g.setAtom(idx, AtomBuilder.fromExisting(s.g.atom(idx)).atomClass(mapIdx).build()); } for (Edge e : s.g.edges(idx)) { int nbr = e.other(idx); if (!s.visit[nbr]) traverse(s, nbr); } }
@Test public void carbon_13() { IAtom a = g2c.toCDKAtom(AtomBuilder.aliphatic(Element.Carbon).hydrogens(4).isotope(13).build(), 4); assertThat(a.getMassNumber(), is(13)); }
@Test public void carbon_12() { IAtom a = g2c.toCDKAtom(AtomBuilder.aliphatic(Element.Carbon).hydrogens(4).isotope(12).build(), 4); assertThat(a.getMassNumber(), is(12)); }
@Test public void aromatic() { IAtom a = g2c.toCDKAtom(AtomBuilder.aromatic(Element.Carbon).build(), 0); assertTrue(a.getFlag(CDKConstants.ISAROMATIC)); }
@Test public void oxidanide() { IAtom a = g2c.toCDKAtom(AtomBuilder.aliphatic(Element.Oxygen).hydrogens(1).anion().build(), 1); assertThat(a.getSymbol(), is("O")); assertThat(a.getImplicitHydrogenCount(), is(1)); assertThat(a.getFormalCharge(), is(-1)); }
@Test public void azaniumAtom() { IAtom a = g2c.toCDKAtom(AtomBuilder.aliphatic(Element.Nitrogen).hydrogens(4).cation().build(), 4); assertThat(a.getSymbol(), is("N")); assertThat(a.getImplicitHydrogenCount(), is(4)); assertThat(a.getFormalCharge(), is(+1)); }
@Test public void carbon_14() { IAtom a = g2c.toCDKAtom(AtomBuilder.aliphatic(Element.Carbon).hydrogens(4).isotope(14).build(), 4); assertThat(a.getMassNumber(), is(14)); }
@Test public void unspecifiedMass() { IAtom a = g2c.toCDKAtom(AtomBuilder.aliphatic(Element.Carbon).hydrogens(4).build(), 4); assertNull(a.getMassNumber()); }
return ab.build();