コード例 #1
0
  /**
   * A unit test for JUnit
   *
   * @throws Exception
   */
  @Test
  public void testStabilizationComparative() throws Exception {

    IAtomContainer mol1 = builder.newInstance(IAtomContainer.class);
    mol1.addAtom(builder.newInstance(IAtom.class, "C"));
    mol1.addAtom(builder.newInstance(IAtom.class, "C"));
    mol1.getAtom(1).setFormalCharge(1);
    mol1.addBond(0, 1, Order.SINGLE);
    mol1.addAtom(builder.newInstance(IAtom.class, "C"));
    mol1.addBond(1, 2, Order.SINGLE);
    mol1.addAtom(builder.newInstance(IAtom.class, "O"));
    mol1.addBond(1, 3, Order.SINGLE);
    addExplicitHydrogens(mol1);
    lpcheck.saturate(mol1);

    DoubleResult result1 = ((DoubleResult) descriptor.calculate(mol1.getAtom(1), mol1).getValue());

    IAtomContainer mol2 = builder.newInstance(IAtomContainer.class);
    mol2.addAtom(builder.newInstance(IAtom.class, "C"));
    mol2.addAtom(builder.newInstance(IAtom.class, "C"));
    mol2.getAtom(1).setFormalCharge(1);
    mol2.addBond(0, 1, Order.SINGLE);
    mol2.addAtom(builder.newInstance(IAtom.class, "O"));
    mol2.addBond(1, 2, Order.SINGLE);
    addExplicitHydrogens(mol2);
    lpcheck.saturate(mol2);

    DoubleResult result2 = ((DoubleResult) descriptor.calculate(mol2.getAtom(1), mol2).getValue());

    IAtomContainer mol3 = builder.newInstance(IAtomContainer.class);
    mol3.addAtom(builder.newInstance(IAtom.class, "C"));
    mol3.addAtom(builder.newInstance(IAtom.class, "C"));
    mol3.getAtom(1).setFormalCharge(1);
    mol3.addBond(0, 1, Order.SINGLE);
    mol3.addAtom(builder.newInstance(IAtom.class, "C"));
    mol3.addBond(1, 2, Order.SINGLE);
    addExplicitHydrogens(mol3);
    lpcheck.saturate(mol3);

    DoubleResult result3 = ((DoubleResult) descriptor.calculate(mol3.getAtom(1), mol3).getValue());

    Assert.assertTrue(result3.doubleValue() < result2.doubleValue());
    Assert.assertTrue(result2.doubleValue() < result1.doubleValue());
  }
コード例 #2
0
  @Test
  public void testNotCharged() throws Exception {

    IAtomContainer mol = builder.newInstance(IAtomContainer.class);
    mol.addAtom(builder.newInstance(IAtom.class, "C"));
    mol.getAtom(0).setFormalCharge(-1);
    mol.addAtom(builder.newInstance(IAtom.class, "C"));
    mol.addBond(0, 1, Order.DOUBLE);
    mol.addAtom(builder.newInstance(IAtom.class, "F"));
    mol.addBond(1, 2, Order.SINGLE);

    addExplicitHydrogens(mol);
    lpcheck.saturate(mol);

    DoubleResult result = ((DoubleResult) descriptor.calculate(mol.getAtom(0), mol).getValue());

    Assert.assertEquals(0.0, result.doubleValue(), 0.00001);
  }