예제 #1
0
 /** Tests the method saturate(). */
 @Test
 public void testSaturate_NumberingProblem() throws Exception {
   IAtomContainer mol = new AtomContainer();
   Atom a1 = new Atom("C");
   mol.addAtom(a1);
   Atom a2 = new Atom("C");
   mol.addAtom(a2);
   Atom a3 = new Atom("C");
   mol.addAtom(a3);
   Atom a4 = new Atom("H");
   mol.addAtom(a4);
   Atom a5 = new Atom("C");
   mol.addAtom(a5);
   Atom a6 = new Atom("H");
   mol.addAtom(a6);
   Atom a7 = new Atom("S");
   mol.addAtom(a7);
   Atom a8 = new Atom("H");
   mol.addAtom(a8);
   Atom a9 = new Atom("H");
   mol.addAtom(a9);
   Bond b1 = new Bond(a1, a2, IBond.Order.SINGLE);
   mol.addBond(b1);
   Bond b2 = new Bond(a1, a3, IBond.Order.SINGLE);
   mol.addBond(b2);
   Bond b3 = new Bond(a1, a4, IBond.Order.SINGLE);
   mol.addBond(b3);
   Bond b4 = new Bond(a5, a2, IBond.Order.SINGLE);
   mol.addBond(b4);
   Bond b5 = new Bond(a2, a6, IBond.Order.SINGLE);
   mol.addBond(b5);
   Bond b6 = new Bond(a3, a7, IBond.Order.SINGLE);
   mol.addBond(b6);
   Bond b7 = new Bond(a3, a8, IBond.Order.SINGLE);
   mol.addBond(b7);
   Bond b8 = new Bond(a7, a5, IBond.Order.SINGLE);
   mol.addBond(b8);
   Bond b9 = new Bond(a5, a9, IBond.Order.SINGLE);
   mol.addBond(b9);
   satcheck.saturate(mol);
   Assert.assertEquals(IBond.Order.SINGLE, b1.getOrder());
   Assert.assertEquals(IBond.Order.DOUBLE, b2.getOrder());
   Assert.assertEquals(IBond.Order.SINGLE, b6.getOrder());
   Assert.assertEquals(IBond.Order.SINGLE, b8.getOrder());
   Assert.assertEquals(IBond.Order.DOUBLE, b4.getOrder());
 }
예제 #2
0
 /** Tests the method saturate(). */
 @Test
 public void testSaturate_WithNitrate() throws Exception {
   IAtomContainer mol = new AtomContainer();
   Atom a1 = new Atom("O");
   mol.addAtom(a1);
   Atom a2 = new Atom("N");
   mol.addAtom(a2);
   Atom a3 = new Atom("O");
   mol.addAtom(a3);
   Atom a4 = new Atom("C");
   mol.addAtom(a4);
   Atom a5 = new Atom("C");
   mol.addAtom(a5);
   Atom a6 = new Atom("C");
   mol.addAtom(a6);
   Atom a7 = new Atom("H");
   mol.addAtom(a7);
   Atom a8 = new Atom("C");
   mol.addAtom(a8);
   Atom a9 = new Atom("C");
   mol.addAtom(a9);
   Atom a10 = new Atom("H");
   mol.addAtom(a10);
   Atom a11 = new Atom("H");
   mol.addAtom(a11);
   Atom a12 = new Atom("C");
   mol.addAtom(a12);
   Atom a13 = new Atom("H");
   mol.addAtom(a13);
   Atom a14 = new Atom("N");
   mol.addAtom(a14);
   Atom a15 = new Atom("H");
   mol.addAtom(a15);
   Atom a16 = new Atom("H");
   mol.addAtom(a16);
   Bond b1 = new Bond(a2, a1, IBond.Order.SINGLE);
   mol.addBond(b1);
   Bond b2 = new Bond(a3, a2, IBond.Order.SINGLE);
   mol.addBond(b2);
   Bond b3 = new Bond(a2, a4, IBond.Order.SINGLE);
   mol.addBond(b3);
   Bond b4 = new Bond(a5, a4, IBond.Order.SINGLE);
   mol.addBond(b4);
   Bond b5 = new Bond(a4, a6, IBond.Order.SINGLE);
   mol.addBond(b5);
   Bond b6 = new Bond(a7, a5, IBond.Order.SINGLE);
   mol.addBond(b6);
   Bond b7 = new Bond(a8, a5, IBond.Order.SINGLE);
   mol.addBond(b7);
   Bond b8 = new Bond(a6, a9, IBond.Order.SINGLE);
   mol.addBond(b8);
   Bond b9 = new Bond(a6, a10, IBond.Order.SINGLE);
   mol.addBond(b9);
   Bond b10 = new Bond(a11, a8, IBond.Order.SINGLE);
   mol.addBond(b10);
   Bond b11 = new Bond(a8, a12, IBond.Order.SINGLE);
   mol.addBond(b11);
   Bond b12 = new Bond(a9, a13, IBond.Order.SINGLE);
   mol.addBond(b12);
   Bond b13 = new Bond(a12, a9, IBond.Order.SINGLE);
   mol.addBond(b13);
   Bond b14 = new Bond(a14, a12, IBond.Order.SINGLE);
   mol.addBond(b14);
   Bond b15 = new Bond(a15, a14, IBond.Order.SINGLE);
   mol.addBond(b15);
   Bond b16 = new Bond(a14, a16, IBond.Order.SINGLE);
   mol.addBond(b16);
   satcheck.saturate(mol);
   Assert.assertEquals(IBond.Order.DOUBLE, b1.getOrder());
   Assert.assertEquals(IBond.Order.DOUBLE, b2.getOrder());
 }