IPMolecularLearningDescriptor extends AbstractMolecularDescriptor implements IMolecularDescriptor { @Override public DescriptorValue calculate(IAtomContainer atomContainer) { IAtomContainer local; if (addlp) { try { local = (IAtomContainer) atomContainer.clone(); LonePairElectronChecker lpcheck = new LonePairElectronChecker(); lpcheck.saturate(local); } catch (CloneNotSupportedException e) { return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult( Double.NaN), getDescriptorNames(), e); } catch (CDKException e) { return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult( Double.NaN), getDescriptorNames(), e); } } else local = atomContainer; DoubleResult value; try { value = new DoubleResult(((DoubleArrayResult) calculatePlus(local).getValue()).get(0)); } catch (CDKException e) { return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult( Double.NaN), getDescriptorNames(), e); } return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), value, getDescriptorNames()); } IPMolecularLearningDescriptor(); @Override DescriptorSpecification getSpecification(); @Override void setParameters(Object[] params); @Override Object[] getParameters(); @Override String[] getDescriptorNames(); @Override DescriptorValue calculate(IAtomContainer atomContainer); DescriptorValue calculatePlus(IAtomContainer container); @Override IDescriptorResult getDescriptorResultType(); @Override String[] getParameterNames(); @Override Object getParameterType(String name);  }
@Test @Category(SlowTest.class) public void testIPDescriptor0() throws Exception { IAtomContainer mol = builder.newInstance(IAtomContainer.class); mol.addAtom(builder.newInstance(IAtom.class, "C")); mol.addAtom(builder.newInstance(IAtom.class, "C")); mol.addBond(0, 1, Order.SINGLE); mol.addAtom(builder.newInstance(IAtom.class, "C")); mol.addBond(1, 2, Order.SINGLE); mol.addAtom(builder.newInstance(IAtom.class, "C")); mol.addBond(1, 3, Order.SINGLE); mol.addAtom(builder.newInstance(IAtom.class, "C")); mol.addBond(3, 4, Order.SINGLE); mol.addAtom(builder.newInstance(IAtom.class, "C")); mol.addBond(3, 5, Order.SINGLE); addExplicitHydrogens(mol); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol); lpcheck.saturate(mol); IPMolecularLearningDescriptor descriptor = new IPMolecularLearningDescriptor(); double result = ((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(); double resultAccordingNIST = 0.0; Assert.assertEquals(resultAccordingNIST, result, 0.0001); }
@Test @Category(SlowTest.class) public void testIPDescriptor_1() throws Exception { IAtomContainer mol = sp.parseSmiles("C-Cl"); addExplicitHydrogens(mol); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol); lpcheck.saturate(mol); IPMolecularLearningDescriptor descriptor = new IPMolecularLearningDescriptor(); double result = ((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(); double resultAccordingNIST = 11.26; Assert.assertEquals(resultAccordingNIST, result, 0.53); }