public void Benzene() { Assert.AreEqual(6, cdk.FindBonds(Percieve(CreateFromSmiles("C1=CC=CC=C1"))).Count()); Assert.AreEqual(6, daylight.FindBonds(CreateFromSmiles("C1=CC=CC=C1")).Count()); }
public void Quinone() { Assert.AreEqual(0, cdk.FindBonds(Percieve(CreateFromSmiles("O=C1C=CC(=O)C=C1"))).Count()); Assert.AreEqual(6, cdkExo.FindBonds(Percieve(CreateFromSmiles("O=C1C=CC(=O)C=C1"))).Count()); Assert.AreEqual(0, daylight.FindBonds(CreateFromSmiles("O=C1C=CC(=O)C=C1")).Count()); }
public static void Main(string[] args) { { var molecules = new Silent.AtomContainerSet(); #region ElectronDonation model = ElectronDonation.DaylightModel; ICycleFinder cycles = Cycles.Or(Cycles.AllSimpleFinder, Cycles.GetAllFinder(6)); Aromaticity aromaticity = new Aromaticity(model, cycles); // apply our configured model to each molecule foreach (IAtomContainer molecule in molecules) { aromaticity.Apply(molecule); } #endregion } { #region ctor // mimics the CDKHuckelAromaticityDetector Aromaticity aromaticity_cdk = new Aromaticity(ElectronDonation.CDKModel, Cycles.CDKAromaticSetFinder); // mimics the DoubleBondAcceptingAromaticityDetector Aromaticity aromaticity_exo = new Aromaticity(ElectronDonation.CDKAllowingExocyclicModel, Cycles.CDKAromaticSetFinder); // a good model for writing SMILES Aromaticity aromaticity_smi = new Aromaticity(ElectronDonation.DaylightModel, Cycles.AllSimpleFinder); // a good model for writing MDL/Mol2 Aromaticity aromaticity_mdl = new Aromaticity(ElectronDonation.PiBondsModel, Cycles.AllSimpleFinder); #endregion } { #region FindBonds Aromaticity aromaticity = new Aromaticity(ElectronDonation.CDKModel, Cycles.AllSimpleFinder); IAtomContainer container = TestMoleculeFactory.MakeAnthracene(); AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(container); try { var bonds = aromaticity.FindBonds(container); int nAromaticBonds = bonds.Count(); } catch (CDKException) { // cycle computation was intractable } #endregion } { #region Apply Aromaticity aromaticity = new Aromaticity(ElectronDonation.CDKModel, Cycles.AllSimpleFinder); IAtomContainer container = TestMoleculeFactory.MakeAnthracene(); try { if (aromaticity.Apply(container)) { // } } catch (CDKException) { // cycle computation was intractable } #endregion } { #region CDKLegacy_CDKAromaticSetFinder new Aromaticity(ElectronDonation.CDKModel, Cycles.CDKAromaticSetFinder); #endregion } { #region CDKLegacy_AllFinder_RelevantFinder new Aromaticity(ElectronDonation.CDKModel, Cycles.Or(Cycles.AllSimpleFinder, Cycles.RelevantFinder)); #endregion } }