StructureResonanceGenerator { public IAtomContainerSet getStructures(IAtomContainer molecule) { int countStructure = 0; IAtomContainerSet setOfMol = molecule.getBuilder().newInstance(IAtomContainerSet.class); setOfMol.addAtomContainer(molecule); for (int i = 0; i < setOfMol.getAtomContainerCount(); i++) { IAtomContainer mol = setOfMol.getAtomContainer(i); for (IReactionProcess aReactionsList : reactionsList) { IReactionProcess reaction = aReactionsList; IAtomContainerSet setOfReactants = molecule.getBuilder().newInstance(IAtomContainerSet.class); setOfReactants.addAtomContainer(mol); try { IReactionSet setOfReactions = reaction.initiate(setOfReactants, null); if (setOfReactions.getReactionCount() != 0) for (int k = 0; k < setOfReactions.getReactionCount(); k++) for (int j = 0; j < setOfReactions.getReaction(k).getProducts().getAtomContainerCount(); j++) { IAtomContainer product = setOfReactions.getReaction(k).getProducts() .getAtomContainer(j); if (!existAC(setOfMol, product)) { setOfMol.addAtomContainer(product); countStructure++; if (countStructure > maxStructures) return setOfMol; } } } catch (CDKException e) { e.printStackTrace(); } } } return setOfMol; } StructureResonanceGenerator();  StructureResonanceGenerator(boolean lookingSymmetry); void setReactions(List<IReactionProcess> newReactionsList); List<IReactionProcess> getReactions(); void setMaximalStructures(int maxStruct); int getMaximalStructures(); void setDefaultReactions(); IAtomContainerSet getStructures(IAtomContainer molecule); IAtomContainerSet getContainers(IAtomContainer molecule); IAtomContainer getContainer(IAtomContainer molecule, IAtom atom); IAtomContainer getContainer(IAtomContainer molecule, IBond bond);  }
@Test public void testGetStructures_IAtomContainer() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(new Atom("C")); molecule.addAtom(new Atom("C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addAtom(new Atom("C")); molecule.addBond(1, 2, IBond.Order.DOUBLE); molecule.addAtom(new Atom("C")); molecule.getAtom(3).setFormalCharge(+1); molecule.addBond(2, 3, IBond.Order.SINGLE); molecule.addAtom(new Atom("C")); molecule.addBond(3, 4, IBond.Order.SINGLE); molecule.addAtom(new Atom("C")); molecule.addBond(4, 5, IBond.Order.SINGLE); molecule.addAtom(new Atom("C")); molecule.addBond(5, 6, IBond.Order.DOUBLE); molecule.addAtom(new Atom("C")); molecule.addBond(6, 7, IBond.Order.SINGLE); molecule.getAtom(7).setFormalCharge(+1); addExplicitHydrogens(molecule); StructureResonanceGenerator sRG = new StructureResonanceGenerator(); IAtomContainerSet setOfMolecules = sRG.getStructures(molecule); Assert.assertEquals(4, setOfMolecules.getAtomContainerCount()); }
@Test public void testtestGetStructures2() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(1, 2, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(2, 3, IBond.Order.SINGLE); molecule.getAtom(3).setFormalCharge(-1); molecule.addLonePair(new LonePair(molecule.getAtom(3))); addExplicitHydrogens(molecule); StructureResonanceGenerator gR = new StructureResonanceGenerator(); IAtomContainerSet setOfMolecules = gR.getStructures(molecule); Assert.assertEquals(2, setOfMolecules.getAtomContainerCount()); IAtomContainer molecule2 = builder.newInstance(IAtomContainer.class); molecule2.addAtom(builder.newInstance(IAtom.class, "C")); molecule2.addAtom(builder.newInstance(IAtom.class, "C")); molecule2.addBond(0, 1, IBond.Order.DOUBLE); molecule2.addAtom(builder.newInstance(IAtom.class, "C")); molecule2.addBond(1, 2, IBond.Order.SINGLE); molecule2.addAtom(builder.newInstance(IAtom.class, "C")); molecule2.addBond(2, 3, IBond.Order.SINGLE); molecule2.getAtom(2).setFormalCharge(-1); molecule2.addLonePair(new LonePair(molecule2.getAtom(2))); addExplicitHydrogens(molecule2); QueryAtomContainer qAC = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(molecule2); Assert.assertTrue(new UniversalIsomorphismTester().isIsomorph(setOfMolecules.getAtomContainer(1), qAC)); }
@Test public void testFluoroethene() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "F")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(1, 2, IBond.Order.DOUBLE); addExplicitHydrogens(molecule); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); StructureResonanceGenerator gR = new StructureResonanceGenerator(); IAtomContainerSet setOfMolecules = gR.getStructures(molecule); Assert.assertEquals(2, setOfMolecules.getAtomContainerCount()); IAtomContainer molecule1 = builder.newInstance(IAtomContainer.class); molecule1.addAtom(builder.newInstance(IAtom.class, "F")); molecule1.addAtom(builder.newInstance(IAtom.class, "C")); molecule1.addBond(0, 1, IBond.Order.DOUBLE); molecule1.addAtom(builder.newInstance(IAtom.class, "C")); molecule1.addBond(1, 2, IBond.Order.SINGLE); molecule1.getAtom(0).setFormalCharge(+1); molecule1.getAtom(2).setFormalCharge(-1); addExplicitHydrogens(molecule1); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule1); lpcheck.saturate(molecule1); QueryAtomContainer qAC = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(molecule1); Assert.assertTrue(new UniversalIsomorphismTester().isIsomorph(setOfMolecules.getAtomContainer(1), qAC)); }
@Test @Category(SlowTest.class) public void testFluorobenzene() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "F")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(1, 2, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(2, 3, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(3, 4, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(4, 5, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(5, 6, IBond.Order.DOUBLE); molecule.addBond(6, 1, IBond.Order.SINGLE); addExplicitHydrogens(molecule); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); StructureResonanceGenerator gRI = new StructureResonanceGenerator(); IAtomContainerSet setOfMolecules = gRI.getStructures(molecule); Assert.assertEquals(5, setOfMolecules.getAtomContainerCount()); IAtomContainer molecule1 = builder.newInstance(IAtomContainer.class); molecule1.addAtom(builder.newInstance(IAtom.class, "F")); molecule1.getAtom(0).setFormalCharge(1); molecule1.addAtom(builder.newInstance(IAtom.class, "C")); molecule1.addBond(0, 1, IBond.Order.DOUBLE); molecule1.addAtom(builder.newInstance(IAtom.class, "C")); molecule1.getAtom(2).setFormalCharge(-1); molecule1.addBond(1, 2, IBond.Order.SINGLE); molecule1.addAtom(builder.newInstance(IAtom.class, "C")); molecule1.addBond(2, 3, IBond.Order.SINGLE); molecule1.addAtom(builder.newInstance(IAtom.class, "C")); molecule1.addBond(3, 4, IBond.Order.DOUBLE); molecule1.addAtom(builder.newInstance(IAtom.class, "C")); molecule1.addBond(4, 5, IBond.Order.SINGLE); molecule1.addAtom(builder.newInstance(IAtom.class, "C")); molecule1.addBond(5, 6, IBond.Order.DOUBLE); molecule1.addBond(6, 1, IBond.Order.SINGLE); addExplicitHydrogens(molecule1); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule1); lpcheck.saturate(molecule1); QueryAtomContainer qAC = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(molecule1); Assert.assertTrue(new UniversalIsomorphismTester().isIsomorph(setOfMolecules.getAtomContainer(2), qAC)); IAtomContainer molecule2 = builder.newInstance(IAtomContainer.class); molecule2.addAtom(builder.newInstance(IAtom.class, "F")); molecule2.getAtom(0).setFormalCharge(1); molecule2.addAtom(builder.newInstance(IAtom.class, "C")); molecule2.addBond(0, 1, IBond.Order.DOUBLE); molecule2.addAtom(builder.newInstance(IAtom.class, "C")); molecule2.addBond(1, 2, IBond.Order.SINGLE); molecule2.addAtom(builder.newInstance(IAtom.class, "C")); molecule2.addBond(2, 3, IBond.Order.DOUBLE); molecule2.addAtom(builder.newInstance(IAtom.class, "C")); molecule2.addBond(3, 4, IBond.Order.SINGLE); molecule2.addAtom(builder.newInstance(IAtom.class, "C")); molecule2.getAtom(4).setFormalCharge(-1); molecule2.addBond(4, 5, IBond.Order.SINGLE); molecule2.addAtom(builder.newInstance(IAtom.class, "C")); molecule2.addBond(5, 6, IBond.Order.DOUBLE); molecule2.addBond(6, 1, IBond.Order.SINGLE); addExplicitHydrogens(molecule2); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule2); lpcheck.saturate(molecule2); IAtomContainer product2 = setOfMolecules.getAtomContainer(4); qAC = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(molecule2); Assert.assertTrue(new UniversalIsomorphismTester().isIsomorph(product2, qAC)); }
@Test @Category(SlowTest.class) public void testFluorobenzene_symm() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "F")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(1, 2, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(2, 3, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(3, 4, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(4, 5, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(5, 6, IBond.Order.DOUBLE); molecule.addBond(6, 1, IBond.Order.SINGLE); addExplicitHydrogens(molecule); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); StructureResonanceGenerator gRI = new StructureResonanceGenerator(true); IAtomContainerSet setOfMolecules = gRI.getStructures(molecule); Assert.assertEquals(3, setOfMolecules.getAtomContainerCount()); IAtomContainer molecule1 = builder.newInstance(IAtomContainer.class); molecule1.addAtom(builder.newInstance(IAtom.class, "F")); molecule1.getAtom(0).setFormalCharge(1); molecule1.addAtom(builder.newInstance(IAtom.class, "C")); molecule1.addBond(0, 1, IBond.Order.DOUBLE); molecule1.addAtom(builder.newInstance(IAtom.class, "C")); molecule1.getAtom(2).setFormalCharge(-1); molecule1.addBond(1, 2, IBond.Order.SINGLE); molecule1.addAtom(builder.newInstance(IAtom.class, "C")); molecule1.addBond(2, 3, IBond.Order.SINGLE); molecule1.addAtom(builder.newInstance(IAtom.class, "C")); molecule1.addBond(3, 4, IBond.Order.DOUBLE); molecule1.addAtom(builder.newInstance(IAtom.class, "C")); molecule1.addBond(4, 5, IBond.Order.SINGLE); molecule1.addAtom(builder.newInstance(IAtom.class, "C")); molecule1.addBond(5, 6, IBond.Order.DOUBLE); molecule1.addBond(6, 1, IBond.Order.SINGLE); addExplicitHydrogens(molecule1); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule1); lpcheck.saturate(molecule1); QueryAtomContainer qAC = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(molecule1); Assert.assertTrue(new UniversalIsomorphismTester().isIsomorph(setOfMolecules.getAtomContainer(1), qAC)); IAtomContainer molecule2 = builder.newInstance(IAtomContainer.class); molecule2.addAtom(builder.newInstance(IAtom.class, "F")); molecule2.getAtom(0).setFormalCharge(1); molecule2.addAtom(builder.newInstance(IAtom.class, "C")); molecule2.addBond(0, 1, IBond.Order.DOUBLE); molecule2.addAtom(builder.newInstance(IAtom.class, "C")); molecule2.addBond(1, 2, IBond.Order.SINGLE); molecule2.addAtom(builder.newInstance(IAtom.class, "C")); molecule2.addBond(2, 3, IBond.Order.DOUBLE); molecule2.addAtom(builder.newInstance(IAtom.class, "C")); molecule2.addBond(3, 4, IBond.Order.SINGLE); molecule2.addAtom(builder.newInstance(IAtom.class, "C")); molecule2.getAtom(4).setFormalCharge(-1); molecule2.addBond(4, 5, IBond.Order.SINGLE); molecule2.addAtom(builder.newInstance(IAtom.class, "C")); molecule2.addBond(5, 6, IBond.Order.DOUBLE); molecule2.addBond(6, 1, IBond.Order.SINGLE); addExplicitHydrogens(molecule2); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule2); lpcheck.saturate(molecule2); IAtomContainer product2 = setOfMolecules.getAtomContainer(2); qAC = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(molecule2); Assert.assertTrue(new UniversalIsomorphismTester().isIsomorph(product2, qAC)); }
@Test @Category(SlowTest.class) public void testAniline() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "N")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(1, 2, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(2, 3, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(3, 4, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(4, 5, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(5, 6, IBond.Order.DOUBLE); molecule.addBond(6, 1, IBond.Order.SINGLE); addExplicitHydrogens(molecule); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); StructureResonanceGenerator gRI = new StructureResonanceGenerator(); IAtomContainerSet setOfMolecules = gRI.getStructures(molecule); Assert.assertEquals(5, setOfMolecules.getAtomContainerCount()); }
@Test public void testAniline_Symm() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "N")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(1, 2, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(2, 3, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(3, 4, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(4, 5, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(5, 6, IBond.Order.DOUBLE); molecule.addBond(6, 1, IBond.Order.SINGLE); addExplicitHydrogens(molecule); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); StructureResonanceGenerator gRI = new StructureResonanceGenerator(true); IAtomContainerSet setOfMolecules = gRI.getStructures(molecule); Assert.assertEquals(3, setOfMolecules.getAtomContainerCount()); }
@Test @Category(SlowTest.class) public void testAllyl() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "Cl")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addBond(1, 2, IBond.Order.DOUBLE); molecule.addBond(2, 3, IBond.Order.SINGLE); molecule.getAtom(0).setFormalCharge(+1); addExplicitHydrogens(molecule); Assert.assertEquals(8, molecule.getAtomCount()); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); StructureResonanceGenerator gRI = new StructureResonanceGenerator(); IAtomContainerSet resonanceStructures = gRI.getStructures(molecule); Assert.assertEquals(4, resonanceStructures.getAtomContainerCount()); }
@Test @Category(SlowTest.class) public void testAllylRadical() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.getAtom(0).setFormalCharge(1); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addBond(1, 2, IBond.Order.DOUBLE); molecule.addBond(2, 3, IBond.Order.SINGLE); addExplicitHydrogens(molecule); molecule.getAtom(0).setFormalCharge(0); molecule.addSingleElectron(new SingleElectron(molecule.getAtom(0))); Assert.assertEquals(11, molecule.getAtomCount()); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); StructureResonanceGenerator gRI = new StructureResonanceGenerator(); IAtomContainerSet resonanceStructures = gRI.getStructures(molecule); Assert.assertEquals(2, resonanceStructures.getAtomContainerCount()); }
@Test public void testEthenolate() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "O")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addBond(1, 2, IBond.Order.DOUBLE); molecule.getAtom(0).setFormalCharge(-1); addExplicitHydrogens(molecule); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); Assert.assertEquals(6, molecule.getAtomCount()); StructureResonanceGenerator gRI = new StructureResonanceGenerator(); IAtomContainerSet resonanceStructures = gRI.getStructures(molecule); Assert.assertEquals(2, resonanceStructures.getAtomContainerCount()); }
@Test public void test2Methylaniline() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "N")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addBond(1, 2, IBond.Order.DOUBLE); molecule.addBond(2, 3, IBond.Order.SINGLE); molecule.addBond(3, 4, IBond.Order.DOUBLE); molecule.addBond(4, 5, IBond.Order.SINGLE); molecule.addBond(5, 0, IBond.Order.DOUBLE); molecule.addBond(0, 6, IBond.Order.SINGLE); molecule.addBond(1, 7, IBond.Order.SINGLE); addExplicitHydrogens(molecule); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); Assert.assertEquals(17, molecule.getAtomCount()); StructureResonanceGenerator gRI = new StructureResonanceGenerator(true); IAtomContainerSet resonanceStructures = gRI.getStructures(molecule); Assert.assertEquals(4, resonanceStructures.getAtomContainerCount()); }
@Test public void testPreservingAromaticity() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "F")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(1, 2, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(2, 3, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(3, 4, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(4, 5, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(5, 6, IBond.Order.DOUBLE); molecule.addBond(6, 1, IBond.Order.SINGLE); addExplicitHydrogens(molecule); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); boolean isAromatic = Aromaticity.cdkLegacy().apply(molecule); Assert.assertTrue("Molecule is expected to be marked aromatic!", isAromatic); Assert.assertTrue("Bond is expected to be marked aromatic!", molecule.getBond(1).getFlag(CDKConstants.ISAROMATIC)); Assert.assertTrue("Bond is expected to be marked aromatic!", molecule.getBond(2).getFlag(CDKConstants.ISAROMATIC)); Assert.assertTrue("Bond is expected to be marked aromatic!", molecule.getBond(3).getFlag(CDKConstants.ISAROMATIC)); Assert.assertTrue("Bond is expected to be marked aromatic!", molecule.getBond(4).getFlag(CDKConstants.ISAROMATIC)); Assert.assertTrue("Bond is expected to be marked aromatic!", molecule.getBond(5).getFlag(CDKConstants.ISAROMATIC)); Assert.assertTrue("Bond is expected to be marked aromatic!", molecule.getBond(6).getFlag(CDKConstants.ISAROMATIC)); StructureResonanceGenerator gRI = new StructureResonanceGenerator(false); IAtomContainerSet setOfMolecules = gRI.getStructures(molecule); Assert.assertEquals(5, setOfMolecules.getAtomContainerCount()); IAtomContainer prod1 = setOfMolecules.getAtomContainer(1); Assert.assertTrue("Bond is expected to be marked aromatic!", prod1.getBond(1).getFlag(CDKConstants.ISAROMATIC)); Assert.assertTrue("Bond is expected to be marked aromatic!", prod1.getBond(2).getFlag(CDKConstants.ISAROMATIC)); Assert.assertTrue("Bond is expected to be marked aromatic!", prod1.getBond(3).getFlag(CDKConstants.ISAROMATIC)); Assert.assertTrue("Bond is expected to be marked aromatic!", prod1.getBond(4).getFlag(CDKConstants.ISAROMATIC)); Assert.assertTrue("Bond is expected to be marked aromatic!", prod1.getBond(5).getFlag(CDKConstants.ISAROMATIC)); Assert.assertTrue("Bond is expected to be marked aromatic!", prod1.getBond(6).getFlag(CDKConstants.ISAROMATIC)); IAtomContainer prod2 = setOfMolecules.getAtomContainer(2); Assert.assertTrue("Bond is expected to be marked aromatic!", prod2.getBond(1).getFlag(CDKConstants.ISAROMATIC)); Assert.assertTrue("Bond is expected to be marked aromatic!", prod2.getBond(2).getFlag(CDKConstants.ISAROMATIC)); Assert.assertTrue("Bond is expected to be marked aromatic!", prod2.getBond(3).getFlag(CDKConstants.ISAROMATIC)); Assert.assertTrue("Bond is expected to be marked aromatic!", prod2.getBond(4).getFlag(CDKConstants.ISAROMATIC)); Assert.assertTrue("Bond is expected to be marked aromatic!", prod2.getBond(5).getFlag(CDKConstants.ISAROMATIC)); Assert.assertTrue("Bond is expected to be marked aromatic!", prod2.getBond(6).getFlag(CDKConstants.ISAROMATIC)); IAtomContainer prod3 = setOfMolecules.getAtomContainer(3); Assert.assertTrue("Bond is expected to be marked aromatic!", prod3.getBond(1).getFlag(CDKConstants.ISAROMATIC)); Assert.assertTrue("Bond is expected to be marked aromatic!", prod3.getBond(2).getFlag(CDKConstants.ISAROMATIC)); Assert.assertTrue("Bond is expected to be marked aromatic!", prod3.getBond(3).getFlag(CDKConstants.ISAROMATIC)); Assert.assertTrue("Bond is expected to be marked aromatic!", prod3.getBond(4).getFlag(CDKConstants.ISAROMATIC)); Assert.assertTrue("Bond is expected to be marked aromatic!", prod3.getBond(5).getFlag(CDKConstants.ISAROMATIC)); Assert.assertTrue("Bond is expected to be marked aromatic!", prod3.getBond(6).getFlag(CDKConstants.ISAROMATIC)); }
@Test public void testCyclobutadiene() throws Exception { IAtomContainer molecule = TestMoleculeFactory.makeCyclobutadiene(); addExplicitHydrogens(molecule); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); StructureResonanceGenerator gRI = new StructureResonanceGenerator(); IAtomContainerSet setOfMolecules = gRI.getStructures(molecule); Assert.assertEquals(2, setOfMolecules.getAtomContainerCount()); }
@Test @Category(SlowTest.class) public void testBenzene() throws Exception { IAtomContainer molecule = TestMoleculeFactory.makeBenzene(); addExplicitHydrogens(molecule); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); StructureResonanceGenerator gRI = new StructureResonanceGenerator(); IAtomContainerSet setOfMolecules = gRI.getStructures(molecule); Assert.assertEquals(2, setOfMolecules.getAtomContainerCount()); }