IPAtomicHOSEDescriptor extends AbstractAtomicDescriptor { @Override public DescriptorValue calculate(IAtom atom, IAtomContainer container) { double value; String originalAtomtypeName = atom.getAtomTypeName(); Integer originalNeighborCount = atom.getFormalNeighbourCount(); Integer originalValency = atom.getValency(); Double originalBondOrderSum = atom.getBondOrderSum(); Order originalMaxBondOrder = atom.getMaxBondOrder(); IAtomType.Hybridization originalHybridization = atom.getHybridization(); if (!isCachedAtomContainer(container)) { try { AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(container); LonePairElectronChecker lpcheck = new LonePairElectronChecker(); lpcheck.saturate(container); } catch (CDKException e) { return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult( Double.NaN), NAMES, e); } } value = db.extractIP(container, atom); atom.setAtomTypeName(originalAtomtypeName); atom.setFormalNeighbourCount(originalNeighborCount); atom.setValency(originalValency); atom.setHybridization(originalHybridization); atom.setMaxBondOrder(originalMaxBondOrder); atom.setBondOrderSum(originalBondOrderSum); return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(value), NAMES); } IPAtomicHOSEDescriptor(); @Override DescriptorSpecification getSpecification(); @Override void setParameters(Object[] params); @Override Object[] getParameters(); @Override String[] getDescriptorNames(); @Override DescriptorValue calculate(IAtom atom, IAtomContainer container); @Override String[] getParameterNames(); @Override Object getParameterType(String name);  }
@Test public void testIPDescriptor1() throws Exception { IAtomContainer mol = sp.parseSmiles("CCCCl"); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol); addExplicitHydrogens(mol); lpcheck.saturate(mol); double result = ((DoubleResult) descriptor.calculate(mol.getAtom(3), mol).getValue()).doubleValue(); double resultAccordingNIST = 10.8; Assert.assertEquals(resultAccordingNIST, result, 0.00001); }
@Test public void testIPDescriptor2() throws Exception { IAtomContainer mol = sp.parseSmiles("CC(CC)Cl"); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol); addExplicitHydrogens(mol); lpcheck.saturate(mol); double result = ((DoubleResult) descriptor.calculate(mol.getAtom(4), mol).getValue()).doubleValue(); double resultAccordingNIST = 10.57; Assert.assertEquals(resultAccordingNIST, result, 0.00001); }
@Test public void testNotDB() throws Exception { IAtomContainer mol = sp.parseSmiles("C=CCCl"); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol); addExplicitHydrogens(mol); lpcheck.saturate(mol); double result = ((DoubleResult) descriptor.calculate(mol.getAtom(3), mol).getValue()).doubleValue(); double resultAccordingNIST = 10.8; Assert.assertEquals(resultAccordingNIST, result, 0.00001); }
@Test public void testIPDescriptor_1() throws Exception { IAtomContainer mol = sp.parseSmiles("C-Cl"); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol); addExplicitHydrogens(mol); lpcheck.saturate(mol); double result = ((DoubleResult) descriptor.calculate(mol.getAtom(1), mol).getValue()).doubleValue(); double resultAccordingNIST = 11.26; Assert.assertEquals(resultAccordingNIST, result, 0.42); }
@Test public void testIPDescriptor_2() throws Exception { IAtomContainer mol = sp.parseSmiles("C-C-Br"); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol); addExplicitHydrogens(mol); lpcheck.saturate(mol); double result = ((DoubleResult) descriptor.calculate(mol.getAtom(2), mol).getValue()).doubleValue(); double resultAccordingNIST = 11.29; Assert.assertEquals(resultAccordingNIST, result, 1.95); }
@Test public void testIPDescriptor_3() throws Exception { IAtomContainer mol = sp.parseSmiles("C-C-C-I"); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol); addExplicitHydrogens(mol); lpcheck.saturate(mol); double result = ((DoubleResult) descriptor.calculate(mol.getAtom(3), mol).getValue()).doubleValue(); double resultAccordingNIST = 9.27; Assert.assertEquals(resultAccordingNIST, result, 0.02); }