Domain: Physics — Condensed Matter Physics

Problem:
A single-walled carbon nanotube with \((10,0)\) zigzag chirality is used as an adsorbent for glyphosate in aqueous solution at \(T=300\ \mathrm{K}\). The nanotube surface is partially hydroxylated, and glyphosate exists in five pH-dependent ionization states \(G_1,\dots,G_5\). 

Consider the following coarse-grained model; all energies are in \(\mathrm{eV}\), pH is dimensionless, and no further physical input is required beyond what is stated here, and determine the unique numerical value of \(Q\) as defined at the end following the stipulated steps. 

Hydroxyl coverage distribution:

The local hydroxyl coverage fraction \(x\) (fraction of carbon sites that are functionalized by \(\mathrm{OH}\)) takes one of six discrete values

\[
x \in \{0.00,\ 0.05,\ 0.10,\ 0.15,\ 0.20,\ 0.25\} .
\]

Due to a quasi-entropy–based structural selection procedure, the corresponding unnormalized weights \(\eta(x)\) are

\[
\eta(0.00)=0.40,\quad \eta(0.05)=1.00,\quad \eta(0.10)=2.00,\quad \eta(0.15)=3.00,\quad \eta(0.20)=2.00,\quad \eta(0.25)=1.00 .
\]

The normalized probability of finding a segment with coverage \(x\) is

\[
P_x(x)=\frac{\eta(x)}{\sum_{x'}\eta(x')} .
\]

pH-dependent glyphosate speciation:

Let \(h\) denote the pH variable. 
Glyphosate is modeled as a tetra-protic acid with effective dissociation constants

\[
pK_{a,1}=2.0,\quad pK_{a,2}=2.6,\quad pK_{a,3}=5.6,\quad pK_{a,4}=10.6 .
\]

For each \(h\), define

\[
L_i(h)=10^{h-pK_{a,i}}\quad (i=1,\dots,4) .
\]

The five ionization states \(G_1,\dots,G_5\) have unnormalized populations

\[
w_1(h)=1,\quad
w_2(h)=L_1(h),\quad
w_3(h)=L_1(h)L_2(h),\quad
w_4(h)=L_1(h)L_2(h)L_3(h),\quad
w_5(h)=L_1(h)L_2(h)L_3(h)L_4(h) .
\]

The normalized fractions of each state at pH \(h\) are
\[
p_j(h)=\frac{w_j(h)}{\sum_{k=1}^{5}w_k(h)}\quad (j=1,\dots,5) .
\]

Coverage- and state-dependent adsorption energies:

The adsorption energy of glyphosate in state \(G_j\) on a segment with hydroxyl coverage \(x\) is modeled as

\[
E_{\mathrm{ads}}(x,G_j)=E_{0,j}-A_j x+B x^2 ,
\]

with parameters

\[
E_{0,1}=-0.45,\quad E_{0,2}=-0.55,\quad E_{0,3}=-0.65,\quad E_{0,4}=-0.80,\quad E_{0,5}=-0.95 ,
\]

\[
A_1=0.10,\quad A_2=0.16,\quad A_3=0.19,\quad A_4=0.23,\quad A_5=0.27 ,
\]

and a coverage-curvature penalty

\[
B=0.80 .
\]

All \(E_{0,j}, A_j\) and \(B\) are in \(\mathrm{eV}\), and \(x\) is dimensionless.

pH-dependent ensemble-averaged adsorption energy:

For a given pH \(h\), the joint distribution of \((x,G_j)\) is assumed to factorize as \(P_x(x)p_j(h)\). The ensemble-averaged adsorption energy at pH \(h\) is

\[
E_{\mathrm{avg}}(h)=\sum_{j=1}^{5}\sum_{x} P_x(x)p_j(h)E_{\mathrm{ads}}(x,G_j) .
\]

Soft-saturation mapping to an effective coverage:

Introduce a reference energy

\[
E_{\mathrm{ref}}=-0.78\ \mathrm{eV}
\]

and a fixed thermal-like energy scale

\[
\Delta E_{\mathrm{th}}=0.025852\ \mathrm{eV} .
\]

For each pH \(h\), define the dimensionless “adsorption strength”

\[
S(h)=\exp\left(-\frac{E_{\mathrm{avg}}(h)-E_{\mathrm{ref}}}{\Delta E_{\mathrm{th}}}\right)
\]

and map it to an effective local coverage fraction

\[
\Theta(h)=\frac{S(h)}{1+S(h)} .
\]

Heterogeneous pH distribution along the nanotube:

Along the nanotube, the local micro-environmental pH is not uniform. The pH \(h\) experienced by different adsorption patches is distributed according to a truncated Gaussian with mean

\[
\mu=6.5
\]

and standard deviation
\[
\sigma=0.6 ,
\]

supported on the interval \(0\le h\le 14\). The heterogeneous ensemble-averaged effective coverage is defined as the Gaussian-weighted average

\[
\Theta_{\mathrm{het}}
=\frac{\displaystyle \int_{0}^{14} \Theta(h)\exp\left(-\frac{(h-\mu)^2}{2\sigma^2}\right)\mathrm{d}h}
{\displaystyle \int_{0}^{14} \exp\left(-\frac{(h-\mu)^2}{2\sigma^2}\right)\mathrm{d}h} .
\]

Treat the above ratio of integrals exactly as written (no linearization of \(\Theta(h)\), no replacement of the Gaussian by a delta, and no truncation of exponentials beyond standard numerical precision).

Percolation mapping and equivalent uniform pH:

Adsorbed glyphosate patches are assumed to form a quasi-2D network that can be mapped onto a site-percolation problem on an effective triangular lattice with site-occupation probability identified with the effective coverage \(\Theta\). For this lattice, take the site-percolation threshold to be

\[
p_c=0.50 .
\]

Define:

1. \(h_c\): the unique pH for a perfectly uniform environment such that

\[
\Theta(h_c)=p_c .
\]

2. \(h_{\mathrm{eq}}\): the unique “equivalent uniform pH” satisfying

\[
\Theta(h_{\mathrm{eq}})=\Theta_{\mathrm{het}} .
\]

Both \(h_c\) and \(h_{\mathrm{eq}}\) must lie in the interval \(0\le h\le 14\) and are determined using the same definitions of \(\Theta(h)\), \(E_{\mathrm{avg}}(h)\) and \(p_j(h)\) given above, without additional approximations.

Finally, define the dimensionless quantity
\[
Q=h_{\mathrm{eq}}-h_c .
\]
Using the definitions above without introducing any further approximations (in particular, do not drop any dependence on \(x\), \(j\), \(h\), or the Gaussian weighting), determine the unique numerical value of \(Q\), and report your final answer as a single real number rounded to three decimal places.

Answer: \\[0.129\\]

Solution code:
# IDEAL RESPONSE

import math


def speciation_p(h, pKa):
    """
    Return the five-species speciation fractions p_j(h) for j=1..5.
    Glyphosate modeled as tetraprotic acid with effective pKa values.
    """
    # L_i(h) = 10^(h - pKa_i)
    L = [10.0 ** (h - pk) for pk in pKa]

    w1 = 1.0
    w2 = L[0]
    w3 = L[0] * L[1]
    w4 = L[0] * L[1] * L[2]
    w5 = L[0] * L[1] * L[2] * L[3]

    w_sum = w1 + w2 + w3 + w4 + w5
    return [w1 / w_sum,
            w2 / w_sum,
            w3 / w_sum,
            w4 / w_sum,
            w5 / w_sum]


def E_avg(h, x_vals, Px_vals, E0, A, B, pKa):
    """
    Ensemble-averaged adsorption energy E_avg(h).
    Average over coverage x and speciation states G_j.
    """
    p = speciation_p(h, pKa)  # p_j(h), j=0..4

    E_sum = 0.0
    for j in range(5):
        for k, x in enumerate(x_vals):
            E_ads = E0[j] - A[j] * x + B * x * x
            E_sum += Px_vals[k] * p[j] * E_ads
    return E_sum


def theta_local(h, x_vals, Px_vals, E0, A, B, pKa, E_ref, Delta_E_th):
    """
    Local effective coverage Theta(h) = S(h) / (1 + S(h)),
    with S(h) = exp(-(E_avg(h) - E_ref)/Delta_E_th).
    """
    Eav = E_avg(h, x_vals, Px_vals, E0, A, B, pKa)
    S = math.exp(-(Eav - E_ref) / Delta_E_th)
    return S / (1.0 + S)


def gaussian_weight(h, mu, sigma):
    """
    Unnormalized Gaussian weight exp(-(h - mu)^2 / (2 sigma^2)).
    """
    return math.exp(-((h - mu) ** 2) / (2.0 * sigma * sigma))


def theta_het(x_vals, Px_vals, E0, A, B, pKa, E_ref, Delta_E_th,
              mu, sigma, N=4096):
    """
    Heterogeneous effective coverage Theta_het:
    ratio of two integrals over h in [0, 14] with Gaussian weighting.
    Computed via composite Simpson's rule with N sub-intervals (N even).
    """
    a, b = 0.0, 14.0
    if N % 2 == 1:
        N += 1
    dx = (b - a) / N

    # Simpson sums for numerator and denominator
    h0 = a
    hN = b

    th0 = theta_local(h0, x_vals, Px_vals, E0, A, B, pKa, E_ref, Delta_E_th)
    w0 = gaussian_weight(h0, mu, sigma)
    num0 = th0 * w0
    den0 = w0

    thN = theta_local(hN, x_vals, Px_vals, E0, A, B, pKa, E_ref, Delta_E_th)
    wN = gaussian_weight(hN, mu, sigma)
    numN = thN * wN
    denN = wN

    num_odd = 0.0
    den_odd = 0.0
    num_even = 0.0
    den_even = 0.0

    for i in range(1, N):
        h = a + i * dx
        w = gaussian_weight(h, mu, sigma)
        th = theta_local(h, x_vals, Px_vals, E0, A, B, pKa, E_ref, Delta_E_th)

        if i % 2 == 1:
            num_odd += th * w
            den_odd += w
        else:
            num_even += th * w
            den_even += w

    num = (num0 + numN + 4.0 * num_odd + 2.0 * num_even) * dx / 3.0
    den = (den0 + denN + 4.0 * den_odd + 2.0 * den_even) * dx / 3.0

    return num / den


def find_h_for_theta(target, x_vals, Px_vals, E0, A, B, pKa,
                     E_ref, Delta_E_th, a=0.0, b=14.0,
                     tol=1e-12, max_iter=200):
    """
    Solve Theta(h) = target for h in [a, b] using bisection.
    Assumes Theta(h) is monotonic and that a, b bracket the root.
    """
    def theta_minus_target(h):
        return theta_local(h, x_vals, Px_vals, E0, A, B, pKa, E_ref, Delta_E_th) - target

    fa = theta_minus_target(a)
    fb = theta_minus_target(b)

    if fa * fb > 0.0:
        raise ValueError("Root is not bracketed in [a, b].")

    left, right = a, b
    for _ in range(max_iter):
        mid = 0.5 * (left + right)
        fm = theta_minus_target(mid)
        if abs(fm) < tol or (right - left) * 0.5 < tol:
            return mid
        if fa * fm < 0.0:
            right = mid
            fb = fm
        else:
            left = mid
            fa = fm

    return 0.5 * (left + right)


def main():
    # 1. Coverage distribution
    x_vals = [0.00, 0.05, 0.10, 0.15, 0.20, 0.25]
    eta_vals = [0.40, 1.00, 2.00, 3.00, 2.00, 1.00]
    eta_sum = sum(eta_vals)
    Px_vals = [e / eta_sum for e in eta_vals]

    # 2. Adsorption parameters
    E0 = [-0.45, -0.55, -0.65, -0.80, -0.95]
    A = [0.10, 0.16, 0.19, 0.23, 0.27]
    B = 0.80

    # 3. Speciation pKa values
    pKa = [2.0, 2.6, 5.6, 10.6]

    # 4. Reference and thermal scale
    E_ref = -0.78
    Delta_E_th = 0.025852

    # 5. Heterogeneous pH distribution parameters
    mu = 6.5
    sigma = 0.6

    # 6. Compute heterogeneous effective coverage
    theta_het_val = theta_het(x_vals, Px_vals, E0, A, B, pKa,
                              E_ref, Delta_E_th, mu, sigma)

    # 7. Find h_c such that Theta(h_c) = 0.5
    h_c = find_h_for_theta(0.5, x_vals, Px_vals, E0, A, B, pKa,
                           E_ref, Delta_E_th)

    # 8. Find h_eq such that Theta(h_eq) = Theta_het
    h_eq = find_h_for_theta(theta_het_val, x_vals, Px_vals, E0, A, B, pKa,
                            E_ref, Delta_E_th)

    # 9. Quantity of interest Q
    Q = h_eq - h_c

    # Print GTFA to three decimal places
    print(f"{Q:.3f}")


if __name__ == "__main__":
    main()