public final class Aromaticity extends Object
ElectronDonation
model and CycleFinder
. To obtain an instance
of the electron donation model use one of the factory methods,
ElectronDonation.cdk()
, ElectronDonation.cdkAllowingExocyclic()
,
ElectronDonation.daylight()
or ElectronDonation.piBonds()
.
ElectronDonation model = ElectronDonation.daylight(); CycleFinder cycles = Cycles.or(Cycles.all(), Cycles.all(6)); Aromaticity aromaticity = new Aromaticity(model, cycles); // apply our configured model to each molecule for (IAtomContainer molecule : molecules) { aromaticity.apply(molecule); }
Constructor and Description |
---|
Aromaticity(ElectronDonation model,
CycleFinder cycles)
Create an aromaticity model using the specified electron donation
model which is tested on the cycles . |
Modifier and Type | Method and Description |
---|---|
boolean |
apply(IAtomContainer molecule)
Apply this aromaticity model to a molecule.
|
static Aromaticity |
cdkLegacy()
Access an aromaticity instance that replicates the previously utilised -
CDKHueckelAromaticityDetector.
|
Set<IBond> |
findBonds(IAtomContainer molecule)
Find the bonds of a
molecule which this model determined were
aromatic. |
public Aromaticity(ElectronDonation model, CycleFinder cycles)
model
which is tested on the cycles
. The model
defines
how many π-electrons each atom may contribute to an aromatic system. The
cycles
defines the CycleFinder
which is used to find
cycles in a molecule. The total electron donation from each atom in each
cycle is counted and checked. If the electron contribution is equal to
4n + 2
for a n >= 0
then the cycle is considered
aromatic. Changing the electron contribution model or which cycles
are tested affects which atoms/bonds are found to be aromatic. There are
several ElectronDonation
models and Cycles
available. A good choice for the cycles
is to use Cycles.all()
falling back to
Cycles.relevant()
on failure. Finding all cycles is very
fast but may produce an exponential number of cycles. It is therefore not
feasible for complex fused systems and an exception is thrown.
In such cases the aromaticity can either be skipped or a simpler
polynomial cycle set Cycles.relevant()
used.
// mimics the CDKHuckelAromaticityDetector Aromaticity aromaticity = new Aromaticity(ElectronDonation.cdk(), Cycles.cdkAromaticSet()); // mimics the DoubleBondAcceptingAromaticityDetector Aromaticity aromaticity = new Aromaticity(ElectronDonation.cdkAllowingExocyclic(), Cycles.cdkAromaticSet()); // a good model for writing SMILES Aromaticity aromaticity = new Aromaticity(ElectronDonation.daylight(), Cycles.all()); // a good model for writing MDL/Mol2 Aromaticity aromaticity = new Aromaticity(ElectronDonation.piBonds(), Cycles.all());
model
- cycles
- ElectronDonation
,
Cycles
public Set<IBond> findBonds(IAtomContainer molecule) throws CDKException
molecule
which this model determined were
aromatic.
Aromaticity aromaticity = new Aromaticity(ElectronDonation.cdk(), Cycles.all()); IAtomContainer container = ...; try { Set<IBond> bonds = aromaticity.findBonds(container); int nAromaticBonds = bonds.size(); } catch (CDKException e) { // cycle computation was intractable }
molecule
- the molecule to apply the model toCDKException
- a problem occurred with the cycle perception - one
can retry with a simpler cycle setpublic boolean apply(IAtomContainer molecule) throws CDKException
findBonds(IAtomContainer)
can be used to find bonds without setting any
flags.
Aromaticity aromaticity = new Aromaticity(ElectronDonation.cdk(), Cycles.all()); IAtomContainer container = ...; try { if (aromaticity.apply(container)) { // } } catch (CDKException e) { // cycle computation was intractable }
molecule
- the molecule to apply the model toCDKException
public static Aromaticity cdkLegacy()
new Aromaticity(ElectronDonation.cdk(),
Cycles.cdkAromaticSet());
This model is not necessarily bad (or really considered legacy) but should not be considered a gold standard model that covers all possible cases. It was however the primary method used in previous versions of the CDK (1.4).
This factory method is provided for convenience for those wishing to replicate aromaticity perception used in previous versions. The same electron donation model can be used to test aromaticity of more cycles. For instance, the following configuration will identify more bonds in a some structures as aromatic:
new Aromaticity(ElectronDonation.cdk(),
Cycles.or(Cycles.all(), Cycles.relevant()));
Copyright © 2021. All rights reserved.