use of org.openscience.cdk.charges.GasteigerPEPEPartialCharges 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;
}
use of org.openscience.cdk.charges.GasteigerPEPEPartialCharges 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;
}
Aggregations