class HybridizationRatioDescriptor extends AbstractMolecularDescriptor implements IMolecularDescriptor {

    @Override
    public DescriptorValue calculate(IAtomContainer container) {
        try {
            IAtomContainer clone = (IAtomContainer) container.clone();
            AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(clone);
            int nsp2 = 0;
            int nsp3 = 0;
            for (IAtom atom : clone.atoms()) {
                if (atom.getAtomicNumber() != IElement.C) continue;
                if (atom.getHybridization() == Hybridization.SP2)
                    nsp2++;
                else if (atom.getHybridization() == Hybridization.SP3) nsp3++;
            }
            double ratio = nsp3 / (double) (nsp2 + nsp3);
            return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(),
                    new DoubleResult(ratio), getDescriptorNames());
        } catch (CloneNotSupportedException e) {
            return getDummyDescriptorValue(e);
        } catch (CDKException e) {
            return getDummyDescriptorValue(e);
        }
    }

    public  HybridizationRatioDescriptor();

}