/**
   * A unit test suite for JUnit.
   *
   * @cdk.inchi InChI=1/C2H4/c1-2/h1-2H2
   * @return The test suite
   */
  @Test
  public void testCDKConstants_REACTIVE_CENTER() throws Exception {
    IReactionProcess type = new AdductionProtonPBReaction();
    IMoleculeSet setOfReactants = builder.newMoleculeSet();
    IMolecule molecule = getEthene();

    /*manually putting the active center*/
    molecule.getAtom(0).setFlag(CDKConstants.REACTIVE_CENTER, true);
    molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true);
    molecule.getBond(0).setFlag(CDKConstants.REACTIVE_CENTER, true);

    setOfReactants.addMolecule(molecule);
    List<IParameterReact> paramList = new ArrayList<IParameterReact>();
    IParameterReact param = new SetReactionCenter();
    param.setParameter(Boolean.TRUE);
    paramList.add(param);
    type.setParameterList(paramList);

    /* initiate */
    IReactionSet setOfReactions = type.initiate(setOfReactants, null);

    IMolecule reactant = setOfReactions.getReaction(0).getReactants().getMolecule(0);
    Assert.assertTrue(molecule.getAtom(0).getFlag(CDKConstants.REACTIVE_CENTER));
    Assert.assertTrue(reactant.getAtom(0).getFlag(CDKConstants.REACTIVE_CENTER));
    Assert.assertTrue(molecule.getAtom(1).getFlag(CDKConstants.REACTIVE_CENTER));
    Assert.assertTrue(reactant.getAtom(1).getFlag(CDKConstants.REACTIVE_CENTER));
    Assert.assertTrue(molecule.getBond(0).getFlag(CDKConstants.REACTIVE_CENTER));
    Assert.assertTrue(reactant.getBond(0).getFlag(CDKConstants.REACTIVE_CENTER));
  }
Ejemplo n.º 2
0
  @Test
  public void testFractional3D() throws Exception {
    String cmlString =
        "<molecule id='m1'><atomArray atomID='a1 a2' xFract='0.0 0.1' yFract='1.2 1.3' zFract='2.1 2.5'/></molecule>";

    IChemFile chemFile = parseCMLString(cmlString);
    IMolecule mol = checkForSingleMoleculeFile(chemFile);

    Assert.assertEquals(2, mol.getAtomCount());
    Assert.assertNull(mol.getAtom(0).getPoint3d());
    Assert.assertNull(mol.getAtom(1).getPoint3d());
    Assert.assertNotNull(mol.getAtom(0).getFractionalPoint3d());
    Assert.assertNotNull(mol.getAtom(1).getFractionalPoint3d());
  }
  /**
   * A unit test suite for JUnit for Ethene. Reaction: O=C-C-H => O(H)-C=C. Manually putting for
   * active center.
   *
   * @cdk.inchi InChI=1/C2H4/c1-2/h1-2H2
   * @return The test suite
   */
  @Test
  public void testManuallyCentreActive() throws Exception {
    IReactionProcess type = new AdductionProtonPBReaction();
    IMolecule molecule = getEthene();

    IMoleculeSet setOfReactants = DefaultChemObjectBuilder.getInstance().newMoleculeSet();
    setOfReactants.addMolecule(molecule);

    /*manually putting the active center*/
    molecule.getAtom(0).setFlag(CDKConstants.REACTIVE_CENTER, true);
    molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true);
    molecule.getBond(0).setFlag(CDKConstants.REACTIVE_CENTER, true);

    /* initiate */
    List<IParameterReact> paramList = new ArrayList<IParameterReact>();
    IParameterReact param = new SetReactionCenter();
    param.setParameter(Boolean.TRUE);
    paramList.add(param);
    type.setParameterList(paramList);
    IReactionSet setOfReactions = type.initiate(setOfReactants, null);

    Assert.assertEquals(2, setOfReactions.getReactionCount());
    Assert.assertEquals(1, setOfReactions.getReaction(0).getProductCount());

    IMolecule product = setOfReactions.getReaction(0).getProducts().getMolecule(0);

    IMolecule molecule2 = getExpected();

    IQueryAtomContainer queryAtom =
        QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(product);
    Assert.assertTrue(UniversalIsomorphismTester.isIsomorph(molecule2, queryAtom));
  }
  /** A unit test for JUnit with ethoxyethane */
  @Test
  public void testPartialTotalChargeDescriptor_Ethoxyethane()
      throws ClassNotFoundException, CDKException, java.lang.Exception {
    double[] testResult = {
      0.28, -0.56, 0.28,
    }; /* from Merck Molecular Force Field. II. Thomas A. Halgren*/
    IAtomicDescriptor descriptor = new PartialTChargeMMFF94Descriptor();

    //		IMolecule mol = sp.parseSmiles("COC");
    IMolecule mol = builder.newInstance(IMolecule.class);
    IAtom carbon = builder.newInstance(IAtom.class, Elements.CARBON);
    IAtom oxygen = builder.newInstance(IAtom.class, Elements.OXYGEN);
    IAtom carbon2 = builder.newInstance(IAtom.class, Elements.CARBON);
    // making sure the order matches the test results
    mol.addAtom(carbon);
    mol.addAtom(oxygen);
    mol.addAtom(carbon2);
    mol.addBond(builder.newInstance(IBond.class, carbon, oxygen, CDKConstants.BONDORDER_SINGLE));
    mol.addBond(builder.newInstance(IBond.class, carbon2, oxygen, CDKConstants.BONDORDER_SINGLE));
    addExplicitHydrogens(mol);

    for (int i = 0; i < 3; i++) {
      double result =
          ((DoubleResult) descriptor.calculate(mol.getAtom(i), mol).getValue()).doubleValue();
      Assert.assertEquals(testResult[i], result, METHOD_ERROR);
    }
  }
Ejemplo n.º 5
0
  /** @cdk.bug 2142400 */
  @Test
  public void testHydrogenCount2() throws Exception {
    String cmlString =
        "<molecule><atomArray>"
            + "<atom id='a1' elementType='C' hydrogenCount='4'/>"
            + "<atom id='a2' elementType='H'/>"
            + "<atom id='a3' elementType='H'/>"
            + "<atom id='a4' elementType='H'/>"
            + "<atom id='a5' elementType='H'/>"
            + "</atomArray>"
            + "<bondArray>"
            + "<bond id='b1' atomRefs2='a1 a2' order='S'/>"
            + "<bond id='b2' atomRefs2='a1 a3' order='S'/>"
            + "<bond id='b3' atomRefs2='a1 a4' order='S'/>"
            + "<bond id='b4' atomRefs2='a1 a5' order='S'/>"
            + "</bondArray></molecule>";

    IChemFile chemFile = parseCMLString(cmlString);
    IMolecule mol = checkForSingleMoleculeFile(chemFile);

    Assert.assertEquals(5, mol.getAtomCount());
    IAtom atom = mol.getAtom(0);
    Assert.assertNotNull(atom);
    Assert.assertEquals("C", atom.getSymbol());
    Assert.assertNotNull(atom.getImplicitHydrogenCount());
    Assert.assertEquals(0, atom.getImplicitHydrogenCount().intValue());
  }
Ejemplo n.º 6
0
  @Test
  public void testMissing3DCoordinates() throws Exception {
    String cmlString =
        "<molecule id='m1'><atomArray><atom id='a1' xyz3='0.0 0.1 0.2'/><atom id='a2'/><atom id='a3' xyz3='0.1 0.0 0.2'/></atomArray></molecule>";

    IChemFile chemFile = parseCMLString(cmlString);
    IMolecule mol = checkForSingleMoleculeFile(chemFile);

    Assert.assertEquals(3, mol.getAtomCount());
    IAtom atom1 = mol.getAtom(0);
    IAtom atom2 = mol.getAtom(1);
    IAtom atom3 = mol.getAtom(2);

    Assert.assertNotNull(atom1.getPoint3d());
    Assert.assertNull(atom2.getPoint3d());
    Assert.assertNotNull(atom3.getPoint3d());
  }
Ejemplo n.º 7
0
  @Test
  public void testReading3DCoords() throws Exception {
    String filename = "data/asn/pubchem/cid176.xml";
    logger.info("Testing: " + filename);
    InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
    PCCompoundXMLReader reader = new PCCompoundXMLReader(ins);
    IMolecule molecule = (IMolecule) reader.read(new Molecule());
    Assert.assertNotNull(molecule);

    // check atom stuff
    Assert.assertEquals(8, molecule.getAtomCount());
    Assert.assertNull(molecule.getAtom(0).getPoint2d());
    Point3d point = molecule.getAtom(0).getPoint3d();
    Assert.assertNotNull(point);
    Assert.assertEquals(-0.9598, point.x, 0.0001);
    Assert.assertEquals(1.5616, point.y, 0.0001);
    Assert.assertEquals(1.8714, point.z, 0.0001);
  }
Ejemplo n.º 8
0
  /**
   * Bug #1610997 says the modelbuilder does not work if 2d coordinates exist before - we test this
   * here
   *
   * @cdk.bug 1610997
   */
  @Test
  public void testModelBuilder3D_CCCCCCCCCC_with2d() throws Exception {
    Assume.assumeTrue(runSlowTests());

    ModelBuilder3D mb3d = ModelBuilder3D.getInstance();
    String smile = "CCCCCCCCCC";
    SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
    IMolecule mol = sp.parseSmiles(smile);
    for (int i = 0; i < mol.getAtomCount(); i++) {
      mol.getAtom(i).setPoint2d(new Point2d(1, 1));
    }
    addExplicitHydrogens(mol);
    mol = mb3d.generate3DCoordinates(mol, false);
    for (int i = 0; i < mol.getAtomCount(); i++) {
      Assert.assertNotNull(mol.getAtom(i).getPoint3d());
    }
    checkAverageBondLength(mol);
  }
Ejemplo n.º 9
0
  @Test
  public void testAtomElementType3() throws Exception {
    String cmlString = "<molecule id='m1'><atomArray atomID='a1' elementType='C'/></molecule>";

    IChemFile chemFile = parseCMLString(cmlString);
    IMolecule mol = checkForSingleMoleculeFile(chemFile);

    Assert.assertEquals(1, mol.getAtomCount());
    IAtom atom = mol.getAtom(0);
    Assert.assertEquals("C", atom.getSymbol());
  }
Ejemplo n.º 10
0
  @Test
  public void testAtomId3() throws Exception {
    String cmlString = "<molecule id='m1'><atomArray atomID='a1 a2 a3'/></molecule>";

    IChemFile chemFile = parseCMLString(cmlString);
    IMolecule mol = checkForSingleMoleculeFile(chemFile);

    Assert.assertEquals(3, mol.getAtomCount());
    IAtom atom = mol.getAtom(1);
    Assert.assertEquals("a2", atom.getID());
  }
Ejemplo n.º 11
0
  @Test
  public void testVdWRadiusDescriptor()
      throws ClassNotFoundException, CDKException, java.lang.Exception {
    double[] testResult = {1.7};
    IAtomicDescriptor descriptor = new VdWRadiusDescriptor();
    SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
    IMolecule mol = sp.parseSmiles("NCCN(C)(C)");
    double retval =
        ((DoubleResult) descriptor.calculate(mol.getAtom(1), mol).getValue()).doubleValue();

    Assert.assertEquals(testResult[0], retval, 0.01);
  }
Ejemplo n.º 12
0
  //  A unit test for JUnit with methylenfluoride\
  @Test
  public void testModelBuilder3D_CF() throws Exception {
    ModelBuilder3D mb3d = ModelBuilder3D.getInstance();
    Point3d c_coord = new Point3d(1.392, 0.0, 0.0);
    Point3d f_coord = new Point3d(0.0, 0.0, 0.0);
    Point3d h1_coord = new Point3d(1.7439615035767404, 1.0558845107302222, 0.0);
    Point3d h2_coord = new Point3d(1.7439615035767404, -0.5279422553651107, 0.914422809754875);
    Point3d h3_coord = new Point3d(1.7439615035767402, -0.5279422553651113, -0.9144228097548747);

    SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
    IMolecule mol = sp.parseSmiles("CF");
    addExplicitHydrogens(mol);
    // mb3d.setTemplateHandler();
    mol = mb3d.generate3DCoordinates(mol, false);
    assertEquals(c_coord, mol.getAtom(0).getPoint3d(), 0.0001);
    assertEquals(f_coord, mol.getAtom(1).getPoint3d(), 0.0001);
    assertEquals(h1_coord, mol.getAtom(2).getPoint3d(), 0.0001);
    assertEquals(h2_coord, mol.getAtom(3).getPoint3d(), 0.0001);
    assertEquals(h3_coord, mol.getAtom(4).getPoint3d(), 0.0001);
    checkAverageBondLength(mol);
  }
Ejemplo n.º 13
0
  @Test
  public void testReading() throws Exception {
    String filename = "data/asn/pubchem/cid1145.xml";
    logger.info("Testing: " + filename);
    InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
    PCCompoundXMLReader reader = new PCCompoundXMLReader(ins);
    IMolecule molecule = (IMolecule) reader.read(new Molecule());
    Assert.assertNotNull(molecule);

    // check atom stuff
    Assert.assertEquals(14, molecule.getAtomCount());
    Assert.assertEquals("O", molecule.getAtom(0).getSymbol());
    Assert.assertEquals(Integer.valueOf(-1), molecule.getAtom(0).getFormalCharge());
    Assert.assertEquals("N", molecule.getAtom(1).getSymbol());
    Assert.assertEquals(Integer.valueOf(1), molecule.getAtom(1).getFormalCharge());

    // check bond stuff
    Assert.assertEquals(13, molecule.getBondCount());
    Assert.assertNotNull(molecule.getBond(3));

    // coordinates
    Assert.assertNull(molecule.getAtom(0).getPoint3d());
    Point2d point = molecule.getAtom(0).getPoint2d();
    Assert.assertNotNull(point);
    Assert.assertEquals(3.7320508956909, point.x, 0.00000001);
    Assert.assertEquals(0.5, point.y, 0.00000001);
  }
  /**
   * A unit test suite for JUnit.
   *
   * @cdk.inchi InChI=1/C2H4/c1-2/h1-2H2
   * @return The test suite
   */
  @Test
  public void testMapping() throws Exception {
    IReactionProcess type = new AdductionProtonPBReaction();

    IMoleculeSet setOfReactants = DefaultChemObjectBuilder.getInstance().newMoleculeSet();
    IMolecule molecule = getEthene();

    setOfReactants.addMolecule(molecule);

    /*automatic looking for active center*/
    List<IParameterReact> paramList = new ArrayList<IParameterReact>();
    IParameterReact param = new SetReactionCenter();
    param.setParameter(Boolean.FALSE);
    paramList.add(param);
    type.setParameterList(paramList);

    /* initiate */

    IReactionSet setOfReactions = type.initiate(setOfReactants, null);

    IMolecule product = setOfReactions.getReaction(0).getProducts().getMolecule(0);

    Assert.assertEquals(3, setOfReactions.getReaction(0).getMappingCount());

    IAtom mappedProductA1 =
        (IAtom)
            ReactionManipulator.getMappedChemObject(
                setOfReactions.getReaction(0), molecule.getAtom(0));
    Assert.assertEquals(mappedProductA1, product.getAtom(0));
    mappedProductA1 =
        (IAtom)
            ReactionManipulator.getMappedChemObject(
                setOfReactions.getReaction(0), molecule.getAtom(1));
    Assert.assertEquals(mappedProductA1, product.getAtom(1));
    IBond mappedProductB1 =
        (IBond)
            ReactionManipulator.getMappedChemObject(
                setOfReactions.getReaction(0), molecule.getBond(0));
    Assert.assertEquals(mappedProductB1, product.getBond(0));
  }
Ejemplo n.º 15
0
  @Test
  public void testIsotopicMass() throws Exception {
    String cmlString =
        "<molecule><atomArray><atom id='a1' elementType=\"C\"><scalar dataType=\"xsd:float\" dictRef=\"cdk:isotopicMass\">12.0</scalar></atom></atomArray></molecule>";

    IChemFile chemFile = parseCMLString(cmlString);
    IMolecule mol = checkForSingleMoleculeFile(chemFile);

    Assert.assertEquals(1, mol.getAtomCount());
    IAtom atom = mol.getAtom(0);
    Assert.assertEquals("C", atom.getSymbol());
    Assert.assertEquals(12.0, atom.getExactMass().doubleValue(), 0.01);
  }
Ejemplo n.º 16
0
  @Test
  public void testMassNumber() throws Exception {
    String cmlString =
        "<molecule id='m1'><atomArray><atom id='a1' elementType='C' isotopeNumber='12'/></atomArray></molecule>";

    IChemFile chemFile = parseCMLString(cmlString);
    IMolecule mol = checkForSingleMoleculeFile(chemFile);

    Assert.assertEquals(1, mol.getAtomCount());
    IAtom atom = mol.getAtom(0);
    Assert.assertEquals("C", atom.getSymbol());
    Assert.assertEquals(12, atom.getMassNumber().intValue());
  }
Ejemplo n.º 17
0
  @Test
  public void testAtomicNumber() throws Exception {
    String cmlString =
        "<molecule><atomArray><atom id='a1' elementType=\"C\"><scalar dataType=\"xsd:integer\" dictRef=\"cdk:atomicNumber\">6</scalar></atom></atomArray></molecule>";

    IChemFile chemFile = parseCMLString(cmlString);
    IMolecule mol = checkForSingleMoleculeFile(chemFile);

    Assert.assertEquals(1, mol.getAtomCount());
    IAtom atom = mol.getAtom(0);
    Assert.assertEquals("C", atom.getSymbol());
    Assert.assertEquals(6, atom.getAtomicNumber().intValue());
  }
Ejemplo n.º 18
0
 @Test
 public void testModelBuilder3D_CccccC() throws Exception {
   ModelBuilder3D mb3d = ModelBuilder3D.getInstance();
   String smile = "CccccC";
   SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
   IMolecule mol = sp.parseSmiles(smile);
   addExplicitHydrogens(mol);
   mol = mb3d.generate3DCoordinates(mol, false);
   for (int i = 0; i < mol.getAtomCount(); i++) {
     Assert.assertNotNull(mol.getAtom(i).getPoint3d());
   }
   checkAverageBondLength(mol);
   // logger.debug("Layout molecule with SMILE: "+smile);
 }
Ejemplo n.º 19
0
  /** @cdk.bug 2142400 */
  @Test
  public void testHydrogenCount1() throws Exception {
    String cmlString =
        "<molecule><atomArray><atom id='a1' elementType='C' hydrogenCount='4'/></atomArray></molecule>";

    IChemFile chemFile = parseCMLString(cmlString);
    IMolecule mol = checkForSingleMoleculeFile(chemFile);

    Assert.assertEquals(1, mol.getAtomCount());
    IAtom atom = mol.getAtom(0);
    Assert.assertNotNull(atom);
    Assert.assertNotNull(atom.getImplicitHydrogenCount());
    Assert.assertEquals(4, atom.getImplicitHydrogenCount().intValue());
  }
Ejemplo n.º 20
0
 @Test
 public void testModelBuilder3D_reserpine() throws Exception {
   ModelBuilder3D mb3d = ModelBuilder3D.getInstance();
   String filename = "data/mdl/reserpine.mol";
   InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
   MDLV2000Reader reader = new MDLV2000Reader(ins);
   ChemFile chemFile = (ChemFile) reader.read((ChemObject) new ChemFile());
   List containersList = ChemFileManipulator.getAllAtomContainers(chemFile);
   IMolecule ac = new NNMolecule((IAtomContainer) containersList.get(0));
   ac = mb3d.generate3DCoordinates(ac, false);
   for (int i = 0; i < ac.getAtomCount(); i++) {
     Assert.assertNotNull(ac.getAtom(i).getPoint3d());
   }
   checkAverageBondLength(ac);
 }
Ejemplo n.º 21
0
  @Test
  public void testModelBuilder3D_Konstanz() throws Exception {
    Assume.assumeTrue(runSlowTests());

    ModelBuilder3D mb3d = ModelBuilder3D.getInstance();
    String smile =
        "C12(-[H])-C3(-C(-[H])(-[H])-C(-C4(-C5(-C(-Cl)(-Cl)-C(-C-3-4-[H])(-Cl)-C(-Cl)(-[H])-C-5(-Cl)-[H])-Cl)-[H])(-[H])-C-2(-O-1)-[H])-[H]";
    SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
    IMolecule mol = sp.parseSmiles(smile);
    addExplicitHydrogens(mol);
    mol = mb3d.generate3DCoordinates(mol, false);
    for (int i = 0; i < mol.getAtomCount(); i++) {
      Assert.assertNotNull(mol.getAtom(i).getPoint3d());
    }
    checkAverageBondLength(mol);
  }
Ejemplo n.º 22
0
  /** @cdk.bug 1315823 */
  @Test
  public void testModelBuilder3D_232() throws Exception {
    Assume.assumeTrue(runSlowTests());

    ModelBuilder3D mb3d = ModelBuilder3D.getInstance();
    String filename = "data/mdl/allmol232.mol";
    InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
    MDLV2000Reader reader = new MDLV2000Reader(ins);
    ChemFile chemFile = (ChemFile) reader.read((ChemObject) new ChemFile());
    List containersList = ChemFileManipulator.getAllAtomContainers(chemFile);
    IMolecule ac = new NNMolecule((IAtomContainer) containersList.get(0));
    addExplicitHydrogens(ac);
    ac = mb3d.generate3DCoordinates(ac, false);
    Assert.assertNotNull(ac.getAtom(0).getPoint3d());
    checkAverageBondLength(ac);
  }
  /** A unit test for JUnit with Water */
  @Test
  public void testPartialTotalChargeDescriptor_Water()
      throws ClassNotFoundException, CDKException, java.lang.Exception {
    double[] testResult = {
      -0.86, 0.43, 0.43
    }; /* from Merck Molecular Force Field. II. Thomas A. Halgren*/
    IAtomicDescriptor descriptor = new PartialTChargeMMFF94Descriptor();

    IMolecule mol = builder.newInstance(IMolecule.class);
    IAtom oxygen = builder.newInstance(IAtom.class, Elements.OXYGEN);
    // making sure the order matches the test results
    mol.addAtom(oxygen);
    addExplicitHydrogens(mol);

    for (int i = 0; i < 3; i++) {
      double result =
          ((DoubleResult) descriptor.calculate(mol.getAtom(i), mol).getValue()).doubleValue();
      Assert.assertEquals(testResult[i], result, METHOD_ERROR);
    }
  }
  /**
   * Get the expected structure.
   *
   * @return The IMolecule
   * @throws CDKException
   */
  private IMolecule getExpected() throws Exception {
    IMolecule molecule = builder.newMolecule();
    molecule.addAtom(builder.newAtom("C"));
    molecule.getAtom(0).setFormalCharge(1);
    molecule.addAtom(builder.newAtom("C"));
    molecule.addBond(0, 1, IBond.Order.SINGLE);
    molecule.addAtom(builder.newAtom("H"));
    molecule.addAtom(builder.newAtom("H"));
    molecule.addAtom(builder.newAtom("H"));
    molecule.addAtom(builder.newAtom("H"));
    molecule.addAtom(builder.newAtom("H"));
    molecule.addBond(0, 2, IBond.Order.SINGLE);
    molecule.addBond(0, 3, IBond.Order.SINGLE);
    molecule.addBond(1, 4, IBond.Order.SINGLE);
    molecule.addBond(1, 5, IBond.Order.SINGLE);
    molecule.addBond(1, 6, IBond.Order.SINGLE);
    AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule);

    LonePairElectronChecker lpcheck = new LonePairElectronChecker();
    lpcheck.saturate(molecule);
    return molecule;
  }
  /**
   * Choose any possible quadruple of the set of atoms in ac and establish all of the possible
   * bonding schemes according to Faulon's equations.
   */
  public static List sample(IMolecule ac) {
    logger.debug("RandomGenerator->mutate() Start");
    List structures = new ArrayList();

    int nrOfAtoms = ac.getAtomCount();
    double a11 = 0, a12 = 0, a22 = 0, a21 = 0;
    double b11 = 0, lowerborder = 0, upperborder = 0;
    double b12 = 0;
    double b21 = 0;
    double b22 = 0;
    double[] cmax = new double[4];
    double[] cmin = new double[4];
    IAtomContainer newAc = null;

    IAtom ax1 = null, ax2 = null, ay1 = null, ay2 = null;
    IBond b1 = null, b2 = null, b3 = null, b4 = null;
    // int[] choices = new int[3];
    /* We need at least two non-zero bonds in order to be successful */
    int nonZeroBondsCounter = 0;
    for (int x1 = 0; x1 < nrOfAtoms; x1++) {
      for (int x2 = x1 + 1; x2 < nrOfAtoms; x2++) {
        for (int y1 = x2 + 1; y1 < nrOfAtoms; y1++) {
          for (int y2 = y1 + 1; y2 < nrOfAtoms; y2++) {
            nonZeroBondsCounter = 0;
            ax1 = ac.getAtom(x1);
            ay1 = ac.getAtom(y1);
            ax2 = ac.getAtom(x2);
            ay2 = ac.getAtom(y2);

            /* Get four bonds for these four atoms */

            b1 = ac.getBond(ax1, ay1);
            if (b1 != null) {
              a11 = BondManipulator.destroyBondOrder(b1.getOrder());
              nonZeroBondsCounter++;
            } else {
              a11 = 0;
            }

            b2 = ac.getBond(ax1, ay2);
            if (b2 != null) {
              a12 = BondManipulator.destroyBondOrder(b2.getOrder());
              nonZeroBondsCounter++;
            } else {
              a12 = 0;
            }

            b3 = ac.getBond(ax2, ay1);
            if (b3 != null) {
              a21 = BondManipulator.destroyBondOrder(b3.getOrder());
              nonZeroBondsCounter++;
            } else {
              a21 = 0;
            }

            b4 = ac.getBond(ax2, ay2);
            if (b4 != null) {
              a22 = BondManipulator.destroyBondOrder(b4.getOrder());
              nonZeroBondsCounter++;
            } else {
              a22 = 0;
            }
            if (nonZeroBondsCounter > 1) {
              /* Compute the range for b11 (see Faulons formulae for details) */

              cmax[0] = 0;
              cmax[1] = a11 - a22;
              cmax[2] = a11 + a12 - 3;
              cmax[3] = a11 + a21 - 3;
              cmin[0] = 3;
              cmin[1] = a11 + a12;
              cmin[2] = a11 + a21;
              cmin[3] = a11 - a22 + 3;
              lowerborder = MathTools.max(cmax);
              upperborder = MathTools.min(cmin);
              for (b11 = lowerborder; b11 <= upperborder; b11++) {
                if (b11 != a11) {

                  b12 = a11 + a12 - b11;
                  b21 = a11 + a21 - b11;
                  b22 = a22 - a11 + b11;
                  logger.debug("Trying atom combination : " + x1 + ":" + x2 + ":" + y1 + ":" + y2);
                  try {
                    newAc = (IAtomContainer) ac.clone();
                    change(newAc, x1, y1, x2, y2, b11, b12, b21, b22);
                    if (ConnectivityChecker.isConnected(newAc)) {
                      structures.add(newAc);
                    } else {
                      logger.debug("not connected");
                    }
                  } catch (CloneNotSupportedException e) {
                    logger.error("Cloning exception: " + e.getMessage());
                    logger.debug(e);
                  }
                }
              }
            }
          }
        }
      }
    }
    return structures;
  }
  /** A unit test for JUnit with Benzene */
  @Test
  public void testPartialTotalChargeDescriptor_Benzene()
      throws ClassNotFoundException, CDKException, java.lang.Exception {
    double[] testResult = {
      -0.15, -0.15, -0.15, -0.15, -0.15, -0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15
    }; /* from Merck Molecular Force Field. II. Thomas A. Halgren*/
    IAtomicDescriptor descriptor = new PartialTChargeMMFF94Descriptor();

    //		IMolecule mol = sp.parseSmiles("c1ccccc1");
    IMolecule mol = builder.newInstance(IMolecule.class);
    for (int i = 0; i < 6; i++) {
      IAtom carbon = builder.newInstance(IAtom.class, Elements.CARBON);
      carbon.setFlag(CDKConstants.ISAROMATIC, true);
      // making sure the order matches the test results
      mol.addAtom(carbon);
    }
    IBond ringBond =
        builder.newInstance(
            IBond.class, mol.getAtom(0), mol.getAtom(1), CDKConstants.BONDORDER_DOUBLE);
    ringBond.setFlag(CDKConstants.ISAROMATIC, true);
    mol.addBond(ringBond);
    ringBond =
        builder.newInstance(
            IBond.class, mol.getAtom(1), mol.getAtom(2), CDKConstants.BONDORDER_SINGLE);
    ringBond.setFlag(CDKConstants.ISAROMATIC, true);
    mol.addBond(ringBond);
    ringBond =
        builder.newInstance(
            IBond.class, mol.getAtom(2), mol.getAtom(3), CDKConstants.BONDORDER_DOUBLE);
    ringBond.setFlag(CDKConstants.ISAROMATIC, true);
    mol.addBond(ringBond);
    ringBond =
        builder.newInstance(
            IBond.class, mol.getAtom(3), mol.getAtom(4), CDKConstants.BONDORDER_SINGLE);
    ringBond.setFlag(CDKConstants.ISAROMATIC, true);
    mol.addBond(ringBond);
    ringBond =
        builder.newInstance(
            IBond.class, mol.getAtom(4), mol.getAtom(5), CDKConstants.BONDORDER_DOUBLE);
    ringBond.setFlag(CDKConstants.ISAROMATIC, true);
    mol.addBond(ringBond);
    ringBond =
        builder.newInstance(
            IBond.class, mol.getAtom(5), mol.getAtom(0), CDKConstants.BONDORDER_SINGLE);
    ringBond.setFlag(CDKConstants.ISAROMATIC, true);
    mol.addBond(ringBond);
    addExplicitHydrogens(mol);

    for (int i = 0; i < 12; i++) {
      double result =
          ((DoubleResult) descriptor.calculate(mol.getAtom(i), mol).getValue()).doubleValue();
      Assert.assertEquals(testResult[i], result, METHOD_ERROR);
    }
  }