GasteigerPEPEPartialCharges implements IChargeCalculator { @Override public void calculateCharges(IAtomContainer container) throws CDKException { try { this.assignGasteigerPiPartialCharges(container, true); } catch (Exception exception) { throw new CDKException("Could not calculate Gasteiger-Marsili PEPE charges: " + exception.getMessage(), exception); } } GasteigerPEPEPartialCharges(); void setMaxGasteigerIters(int iters); void setMaxResoStruc(int numbReson); int getMaxGasteigerIters(); int getMaxResoStruc(); IAtomContainer assignGasteigerPiPartialCharges(IAtomContainer ac, boolean setCharge); @Override void calculateCharges(IAtomContainer container); int getStepSize(); void setStepSize(int step); double[][] assignrPiMarsilliFactors(IAtomContainerSet setAc);  }
@Test public void testCalculateCharges_IAtomContainer() throws Exception { double[] testResult = {0.0, 0.0, 0.0, 0.0, 0.0}; GasteigerPEPEPartialCharges peoe = new GasteigerPEPEPartialCharges(); IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(new Atom("C")); molecule.addAtom(new Atom("F")); molecule.addBond(0, 1, IBond.Order.SINGLE); addExplicitHydrogens(molecule); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); peoe.calculateCharges(molecule); for (int i = 0; i < molecule.getAtomCount(); i++) { Assert.assertEquals(testResult[i], molecule.getAtom(i).getCharge(), 0.01); } }
@Test public void testAromaticBondOrders() throws Exception { GasteigerPEPEPartialCharges peoe = new GasteigerPEPEPartialCharges(); String smiles1 = "c1ccccc1"; SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol1 = sp.parseSmiles(smiles1); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol1); Aromaticity.cdkLegacy().apply(mol1); addExplicitHydrogens(mol1); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol1); lpcheck.saturate(mol1); List<Boolean> oldBondOrders = new ArrayList<Boolean>(); for (int i = 0; i < mol1.getBondCount(); i++) oldBondOrders.add(mol1.getBond(i).getFlag(CDKConstants.ISAROMATIC)); peoe.calculateCharges(mol1); List<Boolean> newBondOrders = new ArrayList<Boolean>(); for (int i = 0; i < mol1.getBondCount(); i++) newBondOrders.add(mol1.getBond(i).getFlag(CDKConstants.ISAROMATIC)); for (int i = 0; i < oldBondOrders.size(); i++) { Assert.assertEquals("bond " + i + " does not match", oldBondOrders.get(i), newBondOrders.get(i)); } }
@Test public void testAromaticAndNonAromatic() throws Exception { GasteigerPEPEPartialCharges peoe = new GasteigerPEPEPartialCharges(); String smiles1 = "c1ccccc1"; String smiles2 = "C1=CC=CC=C1"; SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol1 = sp.parseSmiles(smiles1); IAtomContainer mol2 = sp.parseSmiles(smiles2); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol1); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol2); Aromaticity.cdkLegacy().apply(mol1); Aromaticity.cdkLegacy().apply(mol2); addExplicitHydrogens(mol1); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol1); lpcheck.saturate(mol1); addExplicitHydrogens(mol2); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol2); lpcheck.saturate(mol2); peoe.calculateCharges(mol1); peoe.calculateCharges(mol2); for (int i = 0; i < mol1.getAtomCount(); i++) { Assert.assertEquals("charge on atom " + i + " does not match", mol1.getAtom(i).getCharge(), mol2.getAtom(i) .getCharge(), 0.01); } }