@Override
    public DescriptorValue calculate(IAtom atom, IAtomContainer container) {
        double value;

        try {
            int i = container.indexOf(atom);
            if (i < 0) throw new CDKException("atom was not a memeber of the provided container");

            // don't modify the original
            container = container.clone();
            atom = container.getAtom(i);

            AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(container);
            LonePairElectronChecker lpcheck = new LonePairElectronChecker();
            lpcheck.saturate(container);
        } catch (CDKException | CloneNotSupportedException e) {
            return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(
                    Double.NaN), NAMES, null);
        }

        value = db.extractAffinity(container, atom);
        return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(value),
                                   NAMES);

    }
@ Override public DescriptorValue calculate ( IAtom atom , IAtomContainer container ) { double value ; try { int i = container . indexOf ( atom ) ; if ( i < 0 ) throw new CDKException ( "atom was not a memeber of the provided container" ) ; container = container . clone ( ) ; atom = container . getAtom ( i ) ; AtomContainerManipulator . percieveAtomTypesAndConfigureAtoms ( container ) ; LonePairElectronChecker lpcheck = new LonePairElectronChecker ( ) ; lpcheck . saturate ( container ) ; } catch ( CDKException | CloneNotSupportedException e ) { return new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , new DoubleResult ( Double . NaN ) , NAMES , null ) ; } value = db . extractAffinity ( container , atom ) ; return new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , new DoubleResult ( value ) , NAMES ) ; }
This method calculates the protonation affinity of an atom.

@param  atom              The IAtom to protonate
@param  container         Parameter is the IAtomContainer.
@return                   The protonation affinity. Not possible the ionization.