class KierHallSmartsDescriptor extends AbstractMolecularDescriptor implements IMolecularDescriptor {

    @Override
    public DescriptorValue calculate(IAtomContainer container) {
        if (container == null || container.getAtomCount() == 0) {
            return getDummyDescriptorValue(new CDKException("Container was null or else had no atoms"));
        }

        IAtomContainer atomContainer;
        try {
            atomContainer = (IAtomContainer) container.clone();
            for (IAtom atom : atomContainer.atoms()) {
                if (atom.getImplicitHydrogenCount() == null)
                    atom.setImplicitHydrogenCount(0);
            }
            atomContainer = AtomContainerManipulator.removeHydrogens(atomContainer);
        } catch (CloneNotSupportedException e) {
            return getDummyDescriptorValue(new CDKException("Error during clone"));
        }

        int[] counts = new int[SMARTS.length];
        SmartsPattern.prepare(atomContainer);
        for (int i = 0; i < SMARTS.length; i++) {
            counts[i] = SMARTS[i].matchAll(atomContainer).countUnique();
        }

        IntegerArrayResult result = new IntegerArrayResult();
        for (Integer i : counts)
            result.add(i);

        return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), result,
                                   getDescriptorNames());
    }

    public  KierHallSmartsDescriptor();

}