.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/semiclassical/scattering/plot_miller_classical_s_matrix.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_semiclassical_scattering_plot_miller_classical_s_matrix.py: Miller's classical S-matrix ============================== Miller (1970) computed quantum transition probabilities for a molecular collision from classical trajectories alone. Write the vibration in action-angle variables :math:`(n,q)`, start it with the quantized action :math:`n_1+\tfrac12` and an initial angle :math:`q_1`, and record the final action :math:`n_2(q_1)`. Every angle that lands on :math:`n_2=m+\tfrac12` contributes an amplitude .. math:: S_{mn_1}=\sum_{\text{roots}}\left[2\pi i\,\frac{\partial n_2}{\partial q_1}\right]^{-1/2} e^{i\Phi(q_1)}, with :math:`\Phi` the classical action of the trajectory. There are two roots for each allowed :math:`m`. Squaring the sum without the cross term gives the classical probability; keeping it gives the quantum interference. The model is the one Miller tested first: a collinear collision treated as a harmonic oscillator driven by a force pulse :math:`F(t)`, for which the exact quantum probabilities are Laguerre polynomials (:func:`~physicskit.semiclassical.core.classical_s_matrix.forced_oscillator_quantum_probability`). The trajectories come from :func:`~physicskit.semiclassical.core.classical_s_matrix.forced_oscillator_classical_map`. Units: :math:`\hbar=m=\omega=1`. .. GENERATED FROM PYTHON SOURCE LINES 32-42 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from physicskit.semiclassical.core.classical_s_matrix import ( classical_s_matrix_probability, classical_s_matrix_roots, forced_oscillator_classical_map, forced_oscillator_quantum_probability, ) .. GENERATED FROM PYTHON SOURCE LINES 43-50 The classical map from initial angle to final action -------------------------------------------------------- A Gaussian force pulse kicks the oscillator out of :math:`n_1=20`. The final action is a sinusoid in the initial angle; a horizontal line at :math:`m+\tfrac12` crosses it twice, and those two trajectories are the ones that contribute to :math:`S_{m,20}`. Beyond the extrema (the classical "rainbows") there is no real trajectory at all. .. GENERATED FROM PYTHON SOURCE LINES 50-71 .. code-block:: Python t = np.linspace(-8, 8, 4001) n1 = 20 q1, n2, phase, lam = forced_oscillator_classical_map(n1, 2.0 * np.exp(-(t**2)), t, n_angles=8192) print(f"energy transfer lambda = {lam:.4f}, classical range of n2: {n2.min() - 0.5:.2f} to {n2.max() - 0.5:.2f}") m_show = 30 roots = classical_s_matrix_roots(q1, n2, phase, m_show) fig1, ax = plt.subplots(figsize=(7, 4)) ax.plot(q1, n2 - 0.5, color="k") for m in range(int(n2.min()), int(n2.max()) + 1): ax.axhline(m, color="0.85", lw=0.6, zorder=0) ax.axhline(m_show, color="firebrick", lw=1.2, label=rf"$m={m_show}$") for r, _, _ in roots: ax.plot(r, m_show, "o", color="firebrick") ax.set_xlabel(r"initial angle $q_1$") ax.set_ylabel(r"final action $n_2-\frac{1}{2}$") ax.set_title("Two classical trajectories end on each final state") ax.legend() fig1.tight_layout() .. image-sg:: /api/gallery/semiclassical/scattering/images/sphx_glr_plot_miller_classical_s_matrix_001.png :alt: Two classical trajectories end on each final state :srcset: /api/gallery/semiclassical/scattering/images/sphx_glr_plot_miller_classical_s_matrix_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none energy transfer lambda = 3.8109, classical range of n2: 6.13 to 41.49 .. GENERATED FROM PYTHON SOURCE LINES 72-82 Classical, primitive and uniform probabilities -------------------------------------------------- Without interference the classical probability is a smooth envelope that diverges at the rainbows. The primitive semiclassical sum adds the interference between the two roots and reproduces the quantum oscillations away from the rainbows. Miller's uniform (Airy) version stays finite where the two roots merge and follows the exact result across the whole classically allowed range. Only the exponentially small tails beyond the rainbows, which need complex-valued trajectories, are missing. .. GENERATED FROM PYTHON SOURCE LINES 82-109 .. code-block:: Python ms = np.arange(0, 50) exact = np.array([forced_oscillator_quantum_probability(n1, m, lam) for m in ms]) p_cl = np.array([classical_s_matrix_probability(q1, n2, phase, m, "classical") for m in ms]) p_prim = np.array([classical_s_matrix_probability(q1, n2, phase, m, "primitive") for m in ms]) p_uni = np.array([classical_s_matrix_probability(q1, n2, phase, m, "uniform") for m in ms]) fig2, ax = plt.subplots(figsize=(9, 4.5)) ax.bar(ms, exact, color="0.8", label="exact quantum") ax.plot(ms, p_cl, color="steelblue", ls="--", label="classical (no interference)") ax.plot(ms, p_prim, "s", color="darkorange", ms=4, mfc="none", label="primitive classical S-matrix") ax.plot(ms, p_uni, "o", color="firebrick", ms=3, label="uniform classical S-matrix") ax.axvline(n2.min() - 0.5, color="k", lw=0.6, ls=":") ax.axvline(n2.max() - 0.5, color="k", lw=0.6, ls=":") ax.set_ylim(0, 0.1) ax.set_xlabel(r"final state $m$") ax.set_ylabel(r"$P_{20\to m}$") ax.set_title("Miller's classical S-matrix for a forced oscillator") ax.legend(fontsize=8) fig2.tight_layout() plt.show() allowed = (ms > n2.min() - 0.5) & (ms < n2.max() - 0.5) interior = (ms > n2.min() + 4) & (ms < n2.max() - 4) print(f"max |uniform - exact| in allowed range: {np.max(np.abs(p_uni - exact)[allowed]):.2e}") print(f"max |primitive - exact| away from rainbows: {np.max(np.abs(p_prim - exact)[interior]):.2e}") print(f"max |classical - exact| away from rainbows: {np.max(np.abs(p_cl - exact)[interior]):.2e}") .. image-sg:: /api/gallery/semiclassical/scattering/images/sphx_glr_plot_miller_classical_s_matrix_002.png :alt: Miller's classical S-matrix for a forced oscillator :srcset: /api/gallery/semiclassical/scattering/images/sphx_glr_plot_miller_classical_s_matrix_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none max |uniform - exact| in allowed range: 7.51e-05 max |primitive - exact| away from rainbows: 1.48e-03 max |classical - exact| away from rainbows: 2.59e-02 .. GENERATED FROM PYTHON SOURCE LINES 110-115 Check ----- Two roots per allowed final state, the uniform result matches the exact quantum probabilities, the primitive one matches away from the rainbows, and the classical one misses the interference. .. GENERATED FROM PYTHON SOURCE LINES 115-120 .. code-block:: Python assert len(roots) == 2 assert np.max(np.abs(p_uni - exact)[allowed]) < 2e-3 assert np.max(np.abs(p_prim - exact)[interior]) < 2e-3 assert np.max(np.abs(p_cl - exact)[interior]) > 0.01 assert np.all(p_uni[~allowed] == 0) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.405 seconds) .. _sphx_glr_download_api_gallery_semiclassical_scattering_plot_miller_classical_s_matrix.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_miller_classical_s_matrix.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_miller_classical_s_matrix.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_miller_classical_s_matrix.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_