EffectiveAtomPolarizabilityDescriptor extends AbstractAtomicDescriptor implements IAtomicDescriptor { @Override public DescriptorValue calculate(IAtom atom, IAtomContainer ac) { double polarizability; try { String originalAtomtypeName = atom.getAtomTypeName(); Integer originalNeighborCount = atom.getFormalNeighbourCount(); Integer originalHCount = atom.getImplicitHydrogenCount(); Integer originalValency = atom.getValency(); IAtomType.Hybridization originalHybridization = atom.getHybridization(); boolean originalFlag = atom.getFlag(CDKConstants.VISITED); Double originalBondOrderSum = atom.getBondOrderSum(); Order originalMaxBondOrder = atom.getMaxBondOrder(); polarizability = pol.calculateGHEffectiveAtomPolarizability(ac, atom, 100, true); atom.setAtomTypeName(originalAtomtypeName); atom.setFormalNeighbourCount(originalNeighborCount); atom.setValency(originalValency); atom.setImplicitHydrogenCount(originalHCount); atom.setFlag(CDKConstants.VISITED, originalFlag); atom.setHybridization(originalHybridization); atom.setMaxBondOrder(originalMaxBondOrder); atom.setBondOrderSum(originalBondOrderSum); return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult( polarizability), getDescriptorNames()); } catch (Exception ex1) { return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult( Double.NaN), getDescriptorNames(), ex1); } } EffectiveAtomPolarizabilityDescriptor(); @Override DescriptorSpecification getSpecification(); @Override void setParameters(Object[] params); @Override Object[] getParameters(); @Override String[] getDescriptorNames(); @Override DescriptorValue calculate(IAtom atom, IAtomContainer ac); @Override String[] getParameterNames(); @Override Object getParameterType(String name);  }
@Test public void testEffectivePolarizabilityDescriptor() throws ClassNotFoundException, CDKException, java.lang.Exception { double[] testResult = {4.7253, 6.1345, 6.763, 6.925, 5.41, 5.41}; IAtomicDescriptor descriptor = new EffectiveAtomPolarizabilityDescriptor(); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("NCCN(C)(C)"); addExplicitHydrogens(mol); for (int i = 0; i < 6; i++) { double result = ((DoubleResult) descriptor.calculate(mol.getAtom(i), mol).getValue()).doubleValue(); Assert.assertEquals(testResult[i], result, 0.01); } }
@Test public void testPolarizabilityDescriptor_Ethyl_chloride() throws Exception { double[] testResult = {4.8445, 5.824, 4.6165}; EffectiveAtomPolarizabilityDescriptor descriptor = new EffectiveAtomPolarizabilityDescriptor(); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("CCCl"); addExplicitHydrogens(mol); for (int i = 0; i < 3; i++) { double result = ((DoubleResult) descriptor.calculate(mol.getAtom(i), mol).getValue()).doubleValue(); Assert.assertEquals(testResult[i], result, 0.01); } }
@Test public void testPolarizabilityDescriptor_Allyl_bromide() throws Exception { double testResult = 6.1745; EffectiveAtomPolarizabilityDescriptor descriptor = new EffectiveAtomPolarizabilityDescriptor(); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("C=CCBr"); addExplicitHydrogens(mol); double result = ((DoubleResult) descriptor.calculate(mol.getAtom(3), mol).getValue()).doubleValue(); Assert.assertEquals(testResult, result, 0.01); }
@Test public void testPolarizabilityDescriptor_Isopentyl_iodide() throws Exception { double[] testResult = {8.3585, 6.1118, 6.1118, 9.081, 10.526, 8.69}; EffectiveAtomPolarizabilityDescriptor descriptor = new EffectiveAtomPolarizabilityDescriptor(); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("C(C)(C)CCI"); addExplicitHydrogens(mol); for (int i = 0; i < 6; i++) { double result = ((DoubleResult) descriptor.calculate(mol.getAtom(i), mol).getValue()).doubleValue(); Assert.assertEquals(testResult[i], result, 0.01); } }
@Test public void testPolarizabilityDescriptor_Ethoxy_ethane() throws Exception { double testResult = 5.207; EffectiveAtomPolarizabilityDescriptor descriptor = new EffectiveAtomPolarizabilityDescriptor(); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("CCOCC"); addExplicitHydrogens(mol); double result = ((DoubleResult) descriptor.calculate(mol.getAtom(2), mol).getValue()).doubleValue(); Assert.assertEquals(testResult, result, 0.01); }
@Test public void testPolarizabilityDescriptor_Ethanolamine() throws Exception { double[] testResult = {4.2552, 5.1945, 4.883, 3.595}; EffectiveAtomPolarizabilityDescriptor descriptor = new EffectiveAtomPolarizabilityDescriptor(); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("NCCO"); addExplicitHydrogens(mol); for (int i = 0; i < 4; i++) { double result = ((DoubleResult) descriptor.calculate(mol.getAtom(i), mol).getValue()).doubleValue(); Assert.assertEquals(testResult[i], result, 0.01); } }
@Test public void testPolarizabilityDescriptor_Allyl_mercaptan() throws Exception { double[] testResult = {5.2995, 6.677, 7.677, 6.2545}; EffectiveAtomPolarizabilityDescriptor descriptor = new EffectiveAtomPolarizabilityDescriptor(); 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.getAtom(i), mol).getValue()).doubleValue(); Assert.assertEquals(testResult[i], result, 0.02); } }