@beerwright/core
    Preparing search index...

    Function protonsDonatedPerMolecule

    • Mean number of protons an acid has donated at a given pH.

      For an acid HₙA with stepwise dissociation constants K₁…Kₙ, the relative abundance of the species that has lost j protons is

      Rⱼ = (Π_{k≤j} K_k) / [H⁺]ʲ      →      log₁₀ Rⱼ = j·pH − Σ_{k≤j} pKa_k
      

      and the mean protons donated is the abundance-weighted mean of j:

      f(pH) = Σ j·Rⱼ / Σ Rⱼ
      

      This is Henderson–Hasselbalch generalised to a polyprotic acid. It gives the number of equivalents one mole of the acid delivers at this pH, which is what the charge balance needs. We work in the exponent domain and subtract the max so that strong acids (pKa ≪ 0) and very high pH can't overflow.

      Sanity checks, all covered by tests:

      • lactic (pKa 3.86) at pH 5.40 → 0.9722
      • phosphoric (2.148 / 7.198 / 12.32) at pH 5.40 → 1.0151
      • citric (3.128 / 4.761 / 6.396) at pH 5.40 → 1.9015
      • hydrochloric (strong) → 1.0000 at every brewing pH

      Parameters

      • pKa: readonly number[]
      • ph: number

      Returns number