Search in sources :

Example 1 with IChargeCalculator

use of org.openscience.cdk.charges.IChargeCalculator in project ambit-mirror by ideaconsult.

the class TestUtils method testPartialCharges.

public static void testPartialCharges(String smi) throws Exception {
    System.out.println("Test partial charges for " + smi);
    DecimalFormat df = new DecimalFormat("0.000", new DecimalFormatSymbols(new Locale("en-US")));
    IAtomContainer mol = SmartsHelper.getMoleculeFromSmiles(smi, true);
    // IChargeCalculator chargeCalc = new GasteigerPEPEPartialCharges(); - not working --> only 0.0 charges
    // IChargeCalculator chargeCalc = new InductivePartialCharges(); - not working --> Exception
    // MMFF94PartialCharges present in CDK 2.3
    // GasteigerPEPEPartialCharges  gastPC = new GasteigerPEPEPartialCharges();
    // gastPC.assignGasteigerPiPartialCharges(mol, true);
    IChargeCalculator chargeCalc = new GasteigerMarsiliPartialCharges();
    chargeCalc.calculateCharges(mol);
    for (int i = 0; i < mol.getAtomCount(); i++) {
        IAtom at = mol.getAtom(i);
        System.out.println("" + (i + 1) + "  " + at.getSymbol() + "  " + df.format(at.getCharge()));
    }
}
Also used : Locale(java.util.Locale) GasteigerMarsiliPartialCharges(org.openscience.cdk.charges.GasteigerMarsiliPartialCharges) IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) IChargeCalculator(org.openscience.cdk.charges.IChargeCalculator) DecimalFormatSymbols(java.text.DecimalFormatSymbols) DecimalFormat(java.text.DecimalFormat) IAtom(org.openscience.cdk.interfaces.IAtom)

Aggregations

DecimalFormat (java.text.DecimalFormat)1 DecimalFormatSymbols (java.text.DecimalFormatSymbols)1 Locale (java.util.Locale)1 GasteigerMarsiliPartialCharges (org.openscience.cdk.charges.GasteigerMarsiliPartialCharges)1 IChargeCalculator (org.openscience.cdk.charges.IChargeCalculator)1 IAtom (org.openscience.cdk.interfaces.IAtom)1 IAtomContainer (org.openscience.cdk.interfaces.IAtomContainer)1