InductivePartialCharges implements IChargeCalculator { public IAtomContainer assignInductivePartialCharges(IAtomContainer ac) throws Exception { if (factory == null) { factory = AtomTypeFactory .getInstance("org/openscience/cdk/config/data/jmol_atomtypes.txt", ac.getBuilder()); } int stepsLimit = 9; IAtom[] atoms = AtomContainerManipulator.getAtomArray(ac); double[] pChInch = new double[atoms.length * (stepsLimit + 1)]; double[] ElEn = new double[atoms.length * (stepsLimit + 1)]; double[] pCh = new double[atoms.length * (stepsLimit + 1)]; double[] startEE = getPaulingElectronegativities(ac, true); for (int e = 0; e < atoms.length; e++) { ElEn[e] = startEE[e]; } for (int s = 1; s < 10; s++) { for (int a = 0; a < atoms.length; a++) { pChInch[a + (s * atoms.length)] = getAtomicChargeIncrement(ac, a, ElEn, s); pCh[a + (s * atoms.length)] = pChInch[a + (s * atoms.length)] + pCh[a + ((s - 1) * atoms.length)]; ElEn[a + (s * atoms.length)] = ElEn[a + ((s - 1) * atoms.length)] + (pChInch[a + (s * atoms.length)] / getAtomicSoftnessCore(ac, a)); if (s == 9) { atoms[a].setProperty("InductivePartialCharge", new Double(pCh[a + (s * atoms.length)])); atoms[a].setProperty("EffectiveAtomicElectronegativity", new Double(ElEn[a + (s * atoms.length)])); } } } return ac; } InductivePartialCharges(); IAtomContainer assignInductivePartialCharges(IAtomContainer ac); @Override void calculateCharges(IAtomContainer container); double[] getPaulingElectronegativities(IAtomContainer ac, boolean modified); double getAtomicSoftnessCore(IAtomContainer ac, int atomPosition);  }
@Test public void testCalculateCharges_IAtomContainer() throws java.lang.Exception { double[] testResult = {0.197, -0.492, 0.051, 0.099, 0.099}; Point3d c_coord = new Point3d(1.392, 0.0, 0.0); Point3d f_coord = new Point3d(0.0, 0.0, 0.0); Point3d h1_coord = new Point3d(1.7439615035767404, 1.0558845107302222, 0.0); Point3d h2_coord = new Point3d(1.7439615035767404, -0.5279422553651107, 0.914422809754875); Point3d h3_coord = new Point3d(1.7439615035767402, -0.5279422553651113, -0.9144228097548747); IAtomContainer mol = new AtomContainer(); Atom c = new Atom("C"); mol.addAtom(c); c.setPoint3d(c_coord); Atom f = new Atom("F"); mol.addAtom(f); f.setPoint3d(f_coord); Atom h1 = new Atom("H"); mol.addAtom(h1); h1.setPoint3d(h1_coord); Atom h2 = new Atom("H"); mol.addAtom(h2); h2.setPoint3d(h2_coord); Atom h3 = new Atom("H"); mol.addAtom(h3); h3.setPoint3d(h3_coord); mol.addBond(0, 1, IBond.Order.SINGLE); mol.addBond(0, 2, IBond.Order.SINGLE); mol.addBond(0, 3, IBond.Order.SINGLE); mol.addBond(0, 4, IBond.Order.SINGLE); InductivePartialCharges ipc = new InductivePartialCharges(); ipc.assignInductivePartialCharges(mol); for (int i = 0; i < mol.getAtomCount(); i++) { Assert.assertEquals(testResult[i], ((Double) mol.getAtom(i).getProperty("InductivePartialCharge")).doubleValue(), 0.1); } }