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()));
}
}
Aggregations