def ANC_closed(pH, total_carbonates):
    """Calculate the acid neutralizing capacity (ANC) under a closed system
    in which no carbonates are exchanged with the atmosphere during the
    experiment. Based on pH and total carbonates in the system.

    :param pH: pH of the system
    :type pH: float
    :param total_carbonates: Total carbonate concentration in the system (mole/L)
    :type total_carbonates: float

    :return: The acid neutralizing capacity of the closed system (eq/L)
    :rtype: float

    :Examples:

    >>> from aguaclara.research.environmental_processes_analysis import ANC_closed
    >>> from aguaclara.core.units import unit_registry as u
    >>> round(ANC_closed(10, 1*u.mol/u.L), 7)
    <Quantity(1.359831, 'equivalent / liter')>
    """
    return (total_carbonates * (u.eq/u.mol * alpha1_carbonate(pH) +
            2 * u.eq/u.mol * alpha2_carbonate(pH)) +
            1 * u.eq/u.mol * Kw/invpH(pH) - 1 * u.eq/u.mol * invpH(pH))
Calculate the acid neutralizing capacity (ANC) under a closed system
    in which no carbonates are exchanged with the atmosphere during the
    experiment. Based on pH and total carbonates in the system.

    :param pH: pH of the system
    :type pH: float
    :param total_carbonates: Total carbonate concentration in the system (mole/L)
    :type total_carbonates: float

    :return: The acid neutralizing capacity of the closed system (eq/L)
    :rtype: float

    :Examples:

    >>> from aguaclara.research.environmental_processes_analysis import ANC_closed
    >>> from aguaclara.core.units import unit_registry as u
    >>> round(ANC_closed(10, 1*u.mol/u.L), 7)
    <Quantity(1.359831, 'equivalent / liter')>