Search in sources :

Example 1 with PiElectronegativity

use of org.openscience.cdk.charges.PiElectronegativity in project cdk by cdk.

the class IonizationPotentialTool method getQSARs.

/**
 * Get the results of 7 qsar descriptors been applied. They are:
 * Electronegativity,
 * GasteigerMarsiliPartialCharges,
 * GasteigerPEPEPartialCharges,
 * Polarizability,
 * StabilizationCharge,
 * Number of Atom in resonance
 * if the container in resonance is aromatic.
 *
 * @param container  The IAtomContainer which contain the IAtom
 * @param atom       The IAtom to calculate
 * @return           An Array containing the results
 */
public static double[] getQSARs(IAtomContainer container, IAtom atom) throws CDKException {
    Electronegativity electronegativity = new Electronegativity();
    PiElectronegativity pielectronegativity = new PiElectronegativity();
    GasteigerMarsiliPartialCharges peoe = new GasteigerMarsiliPartialCharges();
    GasteigerPEPEPartialCharges pepe = new GasteigerPEPEPartialCharges();
    Polarizability pol = new Polarizability();
    StabilizationCharges stabil = new StabilizationCharges();
    StructureResonanceGenerator gRI = new StructureResonanceGenerator();
    IAtomContainer product = initiateIonization(container, atom);
    double[] results = new double[8];
    // sigmaElectronegativity
    results[0] = electronegativity.calculateSigmaElectronegativity(container, atom);
    // piElectronegativity
    results[1] = pielectronegativity.calculatePiElectronegativity(container, atom);
    // partialSigmaCharge
    try {
        peoe.assignGasteigerMarsiliSigmaPartialCharges(container, true);
    } catch (Exception e) {
    // ignored, underlying classes are logging this and this class
    // is deprecated
    }
    results[2] = atom.getCharge();
    // partialPiCharge
    for (int i = 0; i < container.getAtomCount(); i++) container.getAtom(i).setCharge(0.0);
    try {
        pepe.assignGasteigerPiPartialCharges(container, true);
    } catch (Exception e) {
        LoggingToolFactory.createLoggingTool(IonizationPotentialTool.class).warn("Unexpected Error:", e);
    }
    results[3] = atom.getCharge();
    // effectiveAtomicPolarizability
    results[4] = pol.calculateGHEffectiveAtomPolarizability(container, atom, 100, true);
    int position = container.indexOf(atom);
    if (product != null)
        results[5] = stabil.calculatePositive(product, product.getAtom(position));
    else
        results[5] = 0.0;
    // numberResonance
    IAtomContainer acR = gRI.getContainer(container, atom);
    if (acR != null) {
        results[6] = acR.getAtomCount();
        // numberAromaticAtoms
        // boolean isAromatic = Aromaticity.cdkLegacy().apply(container);
        IRingSet ringSet = Cycles.sssr(container).toRingSet();
        RingSetManipulator.markAromaticRings(ringSet);
        int aromRingCount = 0;
        for (IAtomContainer ring : ringSet.atomContainers()) {
            if (ring.getFlag(CDKConstants.ISAROMATIC))
                aromRingCount++;
        }
        results[7] = aromRingCount;
    } else {
        results[6] = 0;
        results[7] = 0;
    }
    return results;
}
Also used : GasteigerMarsiliPartialCharges(org.openscience.cdk.charges.GasteigerMarsiliPartialCharges) IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) PiElectronegativity(org.openscience.cdk.charges.PiElectronegativity) Polarizability(org.openscience.cdk.charges.Polarizability) IRingSet(org.openscience.cdk.interfaces.IRingSet) Electronegativity(org.openscience.cdk.charges.Electronegativity) PiElectronegativity(org.openscience.cdk.charges.PiElectronegativity) GasteigerPEPEPartialCharges(org.openscience.cdk.charges.GasteigerPEPEPartialCharges) StabilizationCharges(org.openscience.cdk.charges.StabilizationCharges) CDKException(org.openscience.cdk.exception.CDKException)

Example 2 with PiElectronegativity

use of org.openscience.cdk.charges.PiElectronegativity in project cdk by cdk.

the class IonizationPotentialTool method getQSARs.

/**
 * Get the results of 7 qsar descriptors been applied. They are:
 * Electronegativity,
 * GasteigerMarsiliPartialCharges,
 * GasteigerPEPEPartialCharges,
 * Polarizability,
 * StabilizationCharge,
 * Number of Atom in resonance
 * if the container in resonance is aromatic.
 *
 * @param container  The IAtomContainer which contain the IAtom
 * @param bond       The IBond to calculate
 * @return           An Array containing the results
 */
public static double[] getQSARs(IAtomContainer container, IBond bond) throws CDKException {
    Electronegativity electronegativity = new Electronegativity();
    PiElectronegativity pielectronegativity = new PiElectronegativity();
    GasteigerMarsiliPartialCharges peoe = new GasteigerMarsiliPartialCharges();
    GasteigerPEPEPartialCharges pepe = new GasteigerPEPEPartialCharges();
    Polarizability pol = new Polarizability();
    StabilizationCharges stabil = new StabilizationCharges();
    StructureResonanceGenerator gRI = new StructureResonanceGenerator();
    double[] results = new double[7];
    for (int ia = 0; ia < 2; ia++) {
        IAtom atom = bond.getAtom(ia);
        IAtomContainer product = initiateIonization(container, atom);
        // sigmaElectronegativity
        results[0] += electronegativity.calculateSigmaElectronegativity(container, atom);
        // piElectronegativity
        results[1] += pielectronegativity.calculatePiElectronegativity(container, atom);
        // partialSigmaCharge
        try {
            peoe.assignGasteigerMarsiliSigmaPartialCharges(container, true);
        } catch (Exception e) {
            LoggingToolFactory.createLoggingTool(IonizationPotentialTool.class).warn("Unexpected Error:", e);
        }
        results[2] += atom.getCharge();
        // partialPiCharge
        for (int i = 0; i < container.getAtomCount(); i++) container.getAtom(i).setCharge(0.0);
        try {
            pepe.assignGasteigerPiPartialCharges(container, true);
        } catch (Exception e) {
            LoggingToolFactory.createLoggingTool(IonizationPotentialTool.class).warn("Unexpected Error:", e);
        }
        results[3] += atom.getCharge();
        // effectiveAtomicPolarizability
        results[4] += pol.calculateGHEffectiveAtomPolarizability(container, atom, 100, true);
        int position = container.indexOf(atom);
        if (product != null)
            results[5] += stabil.calculatePositive(product, product.getAtom(position));
        else
            results[5] += 0.0;
        // numberResonance
        IAtomContainer acR = gRI.getContainer(container, atom);
        if (acR != null) {
            results[6] += acR.getAtomCount();
        // numberAromaticAtoms
        // boolean isAromatic = Aromaticity.cdkLegacy().apply(container);
        // if(isAromatic)
        // results[7] += 0.1;
        } else {
            results[6] += 0;
        // results[7] += 0;
        }
    }
    for (int i = 0; i < results.length; i++) results[i] = results[i] / 2;
    return results;
}
Also used : GasteigerMarsiliPartialCharges(org.openscience.cdk.charges.GasteigerMarsiliPartialCharges) IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) PiElectronegativity(org.openscience.cdk.charges.PiElectronegativity) Polarizability(org.openscience.cdk.charges.Polarizability) Electronegativity(org.openscience.cdk.charges.Electronegativity) PiElectronegativity(org.openscience.cdk.charges.PiElectronegativity) GasteigerPEPEPartialCharges(org.openscience.cdk.charges.GasteigerPEPEPartialCharges) StabilizationCharges(org.openscience.cdk.charges.StabilizationCharges) IAtom(org.openscience.cdk.interfaces.IAtom) CDKException(org.openscience.cdk.exception.CDKException)

Aggregations

Electronegativity (org.openscience.cdk.charges.Electronegativity)2 GasteigerMarsiliPartialCharges (org.openscience.cdk.charges.GasteigerMarsiliPartialCharges)2 GasteigerPEPEPartialCharges (org.openscience.cdk.charges.GasteigerPEPEPartialCharges)2 PiElectronegativity (org.openscience.cdk.charges.PiElectronegativity)2 Polarizability (org.openscience.cdk.charges.Polarizability)2 StabilizationCharges (org.openscience.cdk.charges.StabilizationCharges)2 CDKException (org.openscience.cdk.exception.CDKException)2 IAtomContainer (org.openscience.cdk.interfaces.IAtomContainer)2 IAtom (org.openscience.cdk.interfaces.IAtom)1 IRingSet (org.openscience.cdk.interfaces.IRingSet)1