RDFProtonDescriptor_GHR_topol extends AbstractAtomicDescriptor implements IAtomicDescriptor { @Override public DescriptorValue calculate(IAtom atom, IAtomContainer varAtomContainerSet) { return (calculate(atom, varAtomContainerSet, null)); } RDFProtonDescriptor_GHR_topol(); @Override DescriptorSpecification getSpecification(); @Override void setParameters(Object[] params); @Override Object[] getParameters(); @Override String[] getDescriptorNames(); @Override DescriptorValue calculate(IAtom atom, IAtomContainer varAtomContainerSet); DescriptorValue calculate(IAtom atom, IAtomContainer atomContainer, IRingSet precalculatedringset); @Override String[] getParameterNames(); @Override Object getParameterType(String name);  }
@Test public void testExample1() throws Exception { String filename = "data/mdl/hydroxyamino.mol"; InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename); MDLV2000Reader reader = new MDLV2000Reader(ins, Mode.STRICT); ChemFile chemFile = (ChemFile) reader.read((ChemObject) new ChemFile()); IChemSequence seq = chemFile.getChemSequence(0); IChemModel model = seq.getChemModel(0); IAtomContainerSet som = model.getMoleculeSet(); IAtomContainer mol = som.getAtomContainer(0); for (int i = 0; i < mol.getAtomCount(); i++) { if (mol.getAtom(i).getSymbol().equals("H")) { RDFProtonDescriptor_GHR_topol descriptor = new RDFProtonDescriptor_GHR_topol(); DescriptorValue dv = descriptor.calculate(mol.getAtom(i), mol); IDescriptorResult result = dv.getValue(); Assert.assertNotNull(result); Assert.assertEquals(dv.getNames().length, result.length()); } } }
@Test public void testReturnsNaNForNonHydrogen() throws Exception { IAtomContainer mol = new AtomContainer(); IAtom atom = new Atom("O"); mol.addAtom(atom); DescriptorValue dv = descriptor.calculate(atom, mol); IDescriptorResult result = dv.getValue(); Assert.assertNotNull(result); Assert.assertTrue(result instanceof DoubleArrayResult); DoubleArrayResult dResult = (DoubleArrayResult) result; for (int i = 0; i < result.length(); i++) { Assert.assertEquals(Double.NaN, dResult.get(i), 0.000001); } }