import math


def CH2_Calc(PH2, T):
    """
    Calculate CH2.

    :param PH2: partial pressure [atm]
    :type PH2 : float
    :param T: cell operation temperature [K]
    :type T:float
    :return: CH2 [mol/cm^3] as float
    """
    try:
        result = PH2 / (1.09 * (10 ** 6) * math.exp(77 / T))
        return result
    except (TypeError, ZeroDivisionError, OverflowError, ValueError):
        print(
            "[Error] CH2 Calculation Failed (PH2:%s, T:%s)" %
            (str(PH2), str(T)))