Search in sources :

Example 1 with Bond

use of org.openscience.cdk.silent.Bond in project cdk by cdk.

the class FischerRecognitionTest method doNotCreateCenterWhenWestIsOffCenter.

@Test
public void doNotCreateCenterWhenWestIsOffCenter() {
    IAtom focus = atom("C", 0, 0.80d, 0.42d);
    IAtom north = atom("C", 0, 0.80d, 1.24d);
    IAtom east = atom("O", 1, 1.63d, 0.8d);
    IAtom south = atom("C", 2, 0.80d, -0.41d);
    IAtom west = atom("H", 0, -0.02d, 0.42d);
    IBond[] bonds = new IBond[] { new Bond(focus, north), new Bond(focus, south), new Bond(focus, west), new Bond(focus, east) };
    ITetrahedralChirality element = FischerRecognition.newTetrahedralCenter(focus, bonds);
    Assert.assertNull(element);
}
Also used : IBond(org.openscience.cdk.interfaces.IBond) Bond(org.openscience.cdk.silent.Bond) IBond(org.openscience.cdk.interfaces.IBond) ITetrahedralChirality(org.openscience.cdk.interfaces.ITetrahedralChirality) IAtom(org.openscience.cdk.interfaces.IAtom) Test(org.junit.Test)

Example 2 with Bond

use of org.openscience.cdk.silent.Bond in project cdk by cdk.

the class FischerRecognitionTest method doNotCreateCenterWhenNorthIsMissing.

@Test
public void doNotCreateCenterWhenNorthIsMissing() {
    IAtom focus = atom("C", 0, 0.80d, 0.42d);
    IAtom east = atom("O", 1, 1.63d, 0.42d);
    IAtom south = atom("C", 2, 0.80d, -0.41d);
    IAtom west = atom("H", 0, -0.02d, 0.42d);
    IBond[] bonds = new IBond[] { new Bond(focus, south), new Bond(focus, west), new Bond(focus, east) };
    ITetrahedralChirality element = FischerRecognition.newTetrahedralCenter(focus, bonds);
    Assert.assertNull(element);
}
Also used : IBond(org.openscience.cdk.interfaces.IBond) Bond(org.openscience.cdk.silent.Bond) IBond(org.openscience.cdk.interfaces.IBond) ITetrahedralChirality(org.openscience.cdk.interfaces.ITetrahedralChirality) IAtom(org.openscience.cdk.interfaces.IAtom) Test(org.junit.Test)

Example 3 with Bond

use of org.openscience.cdk.silent.Bond in project cdk by cdk.

the class ShortestPathsTest method simple.

/**
 * 2,2-dimethylpropane
 */
private static IAtomContainer simple() {
    IAtomContainer container = new AtomContainer();
    IAtom a = new Atom("C");
    IAtom b = new Atom("C");
    IAtom c = new Atom("C");
    IAtom d = new Atom("C");
    IAtom e = new Atom("C");
    IBond ab = new Bond(a, b);
    IBond bc = new Bond(b, c);
    IBond cd = new Bond(c, d);
    IBond be = new Bond(b, e);
    container.addAtom(a);
    container.addAtom(b);
    container.addAtom(c);
    container.addAtom(d);
    container.addAtom(e);
    container.addBond(ab);
    container.addBond(bc);
    container.addBond(cd);
    container.addBond(be);
    return container;
}
Also used : IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) AtomContainer(org.openscience.cdk.silent.AtomContainer) IBond(org.openscience.cdk.interfaces.IBond) Bond(org.openscience.cdk.silent.Bond) IBond(org.openscience.cdk.interfaces.IBond) IAtom(org.openscience.cdk.interfaces.IAtom) Atom(org.openscience.cdk.silent.Atom) IAtom(org.openscience.cdk.interfaces.IAtom)

Example 4 with Bond

use of org.openscience.cdk.silent.Bond in project cdk by cdk.

the class CDKToBeamTest method unsetBondOrder.

@SuppressWarnings("unchecked")
@Test(expected = CDKException.class)
public void unsetBondOrder() throws Exception {
    IAtom u = mock(IAtom.class);
    IAtom v = mock(IAtom.class);
    IBond b = new Bond(u, v, IBond.Order.UNSET);
    Map<IAtom, Integer> mock = mock(Map.class);
    when(mock.get(u)).thenReturn(0);
    when(mock.get(v)).thenReturn(1);
    new CDKToBeam().toBeamEdge(b, mock);
}
Also used : IBond(org.openscience.cdk.interfaces.IBond) Bond(org.openscience.cdk.silent.Bond) IBond(org.openscience.cdk.interfaces.IBond) IAtom(org.openscience.cdk.interfaces.IAtom) Test(org.junit.Test)

Example 5 with Bond

use of org.openscience.cdk.silent.Bond in project cdk by cdk.

the class CDKToBeamTest method tripleBond.

@SuppressWarnings("unchecked")
@Test
public void tripleBond() throws Exception {
    IAtom u = mock(IAtom.class);
    IAtom v = mock(IAtom.class);
    IBond b = new Bond(u, v, IBond.Order.TRIPLE);
    Map<IAtom, Integer> mock = mock(Map.class);
    when(mock.get(u)).thenReturn(0);
    when(mock.get(v)).thenReturn(1);
    CDKToBeam c2g = new CDKToBeam();
    assertThat(c2g.toBeamEdge(b, mock), is(uk.ac.ebi.beam.Bond.TRIPLE.edge(0, 1)));
}
Also used : IBond(org.openscience.cdk.interfaces.IBond) Bond(org.openscience.cdk.silent.Bond) IBond(org.openscience.cdk.interfaces.IBond) IAtom(org.openscience.cdk.interfaces.IAtom) Test(org.junit.Test)

Aggregations

IAtom (org.openscience.cdk.interfaces.IAtom)42 IBond (org.openscience.cdk.interfaces.IBond)42 Bond (org.openscience.cdk.silent.Bond)42 Test (org.junit.Test)36 IAtomContainer (org.openscience.cdk.interfaces.IAtomContainer)20 Atom (org.openscience.cdk.silent.Atom)19 AtomContainer (org.openscience.cdk.silent.AtomContainer)19 ITetrahedralChirality (org.openscience.cdk.interfaces.ITetrahedralChirality)11 Map (java.util.Map)2 Ignore (org.junit.Ignore)2 Element (org.openscience.cdk.Element)1 IChemObjectBuilder (org.openscience.cdk.interfaces.IChemObjectBuilder)1