BondPartialSigmaChargeDescriptor extends AbstractBondDescriptor { @Override public DescriptorValue calculate(IBond bond, IAtomContainer ac) { Double originalCharge1 = bond.getBegin().getCharge(); Double originalCharge2 = bond.getEnd().getCharge(); if (!isCachedAtomContainer(ac)) { IAtomContainer mol = ac.getBuilder().newInstance(IAtomContainer.class, ac); if (maxIterations != 0) peoe.setMaxGasteigerIters(maxIterations); try { peoe.assignGasteigerMarsiliSigmaPartialCharges(mol, true); for (Iterator<IBond> it = ac.bonds().iterator(); it.hasNext();) { IBond bondi = it.next(); double result = Math.abs(bondi.getBegin().getCharge() - bondi.getEnd().getCharge()); cacheDescriptorValue(bondi, ac, new DoubleResult(result)); } } catch (Exception ex1) { return getDummyDescriptorValue(ex1); } } bond.getBegin().setCharge(originalCharge1); bond.getEnd().setCharge(originalCharge2); return getCachedDescriptorValue(bond) != null ? new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), getCachedDescriptorValue(bond), NAMES) : null; } BondPartialSigmaChargeDescriptor(); @Override DescriptorSpecification getSpecification(); @Override void setParameters(Object[] params); @Override Object[] getParameters(); @Override String[] getDescriptorNames(); @Override DescriptorValue calculate(IBond bond, IAtomContainer ac); @Override String[] getParameterNames(); @Override Object getParameterType(String name);  }
@Test public void testBondSigmaElectronegativityDescriptor() throws ClassNotFoundException, CDKException, java.lang.Exception { double[] testResult = {0.3323, 0.0218}; SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("CF"); addExplicitHydrogens(mol); for (int i = 0; i < 2; i++) { double result = ((DoubleResult) descriptor.calculate(mol.getBond(i), mol).getValue()).doubleValue(); Assert.assertEquals(testResult[i], result, 0.01); } }
@Test public void testBondSigmaElectronegativityDescriptor_Methyl_chloride() throws ClassNotFoundException, CDKException, java.lang.Exception { double[] testResult = {0.2137, 0.0075}; SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("CCl"); addExplicitHydrogens(mol); for (int i = 0; i < 2; i++) { double result = ((DoubleResult) descriptor.calculate(mol.getBond(i), mol).getValue()).doubleValue(); Assert.assertEquals(testResult[i], result, 0.05); } }
@Test public void testBondSigmaElectronegativityDescriptor_Allyl_bromide() throws ClassNotFoundException, CDKException, java.lang.Exception { double[] testResult = {0.0265, 0.1268, 0.1872, 0.1564, 0.1564, 0.1347, 0.0013, 0.0013}; SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("C=CCBr"); addExplicitHydrogens(mol); for (int i = 0; i < 8; i++) { double result = ((DoubleResult) descriptor.calculate(mol.getBond(i), mol).getValue()).doubleValue(); Assert.assertEquals(testResult[i], result, 0.03); } }
@Test public void testBondSigmaElectronegativityDescriptor_Isopentyl_iodide() throws ClassNotFoundException, CDKException, java.lang.Exception { double testResult = 0.0165; SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("C(C)(C)CCI"); addExplicitHydrogens(mol); double result = ((DoubleResult) descriptor.calculate(mol.getBond(0), mol).getValue()).doubleValue(); Assert.assertEquals(testResult, result, 0.001); }
@Test public void testBondSigmaElectronegativityDescriptor_Ethoxy_ethane() throws ClassNotFoundException, CDKException, java.lang.Exception { double[] testResult = {0.0864, 0.4262, 0.4262, 0.0864, 0.0662, 0.0662, 0.0662, 0.0104, 0.0104}; SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("CCOCC"); addExplicitHydrogens(mol); for (int i = 0; i < 8; i++) { double result = ((DoubleResult) descriptor.calculate(mol.getBond(i), mol).getValue()).doubleValue(); Assert.assertEquals(testResult[i], result, 0.002); } }
@Test public void testBondSigmaElectronegativityDescriptor_Ethanolamine() throws ClassNotFoundException, CDKException, java.lang.Exception { double[] testResult = {0.3463, 0.0274, 0.448, 0.448, 0.448}; SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("NCCO"); addExplicitHydrogens(mol); for (int i = 0; i < 5; i++) { double result = ((DoubleResult) descriptor.calculate(mol.getBond(i), mol).getValue()).doubleValue(); Assert.assertEquals(testResult[i], result, 0.06); } }
@Test public void testBondSigmaElectronegativityDescriptor_Allyl_mercaptan() throws ClassNotFoundException, CDKException, java.lang.Exception { double[] testResult = {0.0203, 0.0921, 0.1835, 0.1569, 0.3593, 8.5917}; SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("C=CCS"); addExplicitHydrogens(mol); for (int i = 0; i < 4; i++) { double result = ((DoubleResult) descriptor.calculate(mol.getBond(i), mol).getValue()).doubleValue(); Assert.assertEquals(testResult[i], result, 0.005); } }