Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e056721
- made changes that agree with the Julia version (analytic Exchange m…
SparshMishra97 Nov 30, 2025
fade8bb
Did checks and compared Julia implementation results to revised packa…
SparshMishra97 Nov 30, 2025
464cf35
added additional comments
SparshMishra97 Nov 30, 2025
c779552
fix: Update README to include sigma notation for matrix elements and …
SparshMishra97 Dec 2, 2025
c663776
added sigma feature to planewave part
SparshMishra97 Dec 2, 2025
6666cee
fix: Update execution counts and correct sigma parameter in Checks_ex…
SparshMishra97 Dec 2, 2025
126c34c
fix: Remove unused code cell from Checks_exchange_pwme notebook
SparshMishra97 Dec 2, 2025
c69ae55
Edited Exchange matrix elements to include boths sign of sigma (B_z *…
SparshMishra97 Dec 2, 2025
5c0230d
Refactoring and performance improvements
skilledwolf Dec 3, 2025
d9041b6
fix: Correct LaTeX formatting for magnetic field sign in README
skilledwolf Dec 3, 2025
ef7ec6d
fix: Add missing line breaks in wavefunction section of README
skilledwolf Dec 3, 2025
25e6e9e
fix: Add Sparsh Mishra as an author in CITATION.cff and pyproject.toml
skilledwolf Dec 3, 2025
6a2ee53
Initial plan
Copilot Dec 3, 2025
cfb558f
Initial plan
Copilot Dec 3, 2025
01ab16f
Initial plan
Copilot Dec 3, 2025
f766062
Enhance docstring for get_exchange_kernels_GaussLegendre function
Copilot Dec 3, 2025
32e29d9
Remove commented-out code and placeholder comments from exchange_hank…
Copilot Dec 3, 2025
b35935d
Initial plan
Copilot Dec 3, 2025
ba4bee0
Address code review feedback on docstring clarity
Copilot Dec 3, 2025
6a12973
Add sign_magneticfield validation to exchange_legendre.py
Copilot Dec 3, 2025
538bdf5
Add missing blank line before Notes section header
Copilot Dec 3, 2025
b7d69a1
Merge pull request #3 from skilledwolf/copilot/sub-pr-2
skilledwolf Dec 3, 2025
71a8d12
Merge pull request #4 from skilledwolf/copilot/sub-pr-2-again
skilledwolf Dec 3, 2025
5f80dea
Merge pull request #5 from skilledwolf/copilot/sub-pr-2-another-one
skilledwolf Dec 3, 2025
020dac4
Merge pull request #6 from skilledwolf/copilot/sub-pr-2-yet-again
skilledwolf Dec 3, 2025
6564361
Initial plan
Copilot Dec 3, 2025
4e03643
Address PR review comments: trailing whitespace, validation, docstrin…
Copilot Dec 3, 2025
5f98990
Merge pull request #7 from skilledwolf/copilot/sub-pr-2
skilledwolf Dec 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ version: "0.1.0"
doi: 10.5281/zenodo.17646158
date-released: "2025-11-18"
authors:
- family-names: Mishra
given-names: Sparsh
- family-names: Wolf
given-names: Tobias
repository-code: "https://github.com/wolft/quantumhall_matrixelements"
Expand Down
68 changes: 44 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@

Landau-level plane-wave form factors and exchange kernels for quantum Hall systems in a small, reusable package (useful for Hartree-Fock and related calculations). It provides:

- Analytic Landau-level plane-wave form factors $F_{n',n}(\mathbf{q})$.
- Exchange kernels $X_{n_1 m_1 n_2 m_2}(\mathbf{G})$.
- Analytic Landau-level plane-wave form factors $F_{n',n}^\sigma(\mathbf{q})$.
- Exchange kernels $X_{n_1 m_1 n_2 m_2}^\sigma(\mathbf{G})$.
- Symmetry diagnostics for verifying kernel implementations.

### Plane-Wave Landau-level Form Factors
The plane-wave matrix element $F_{n',n}(\mathbf{q}) = \langle n' | e^{i \mathbf{q} \cdot \mathbf{R}} | n \rangle$ can be written as
For $\sigma = \mathrm{sgn}(qB_z)$, where $q$ is the charge of the carrier and $B_z$ is the magnetic field direction,
The plane-wave matrix element $F^\sigma_{n',n}(\mathbf{q}) = \langle n' | e^{i \mathbf{q} \cdot \mathbf{R}_\sigma} | n \rangle$ can be written as

$$
F_{n',n}(\mathbf{q}) =
F_{n',n}^\sigma(\mathbf{q}) =
i^{|n-n'|}
e^{i(n-n')\theta_{\mathbf{q}}}
e^{i\sigma(n'-n)\theta_{\mathbf{q}}}
\sqrt{\frac{n_{<}!}{n_{>}!}}
\left( \frac{|\mathbf{q}|\ell_{B}}{\sqrt{2}} \right)^{|n-n'|}
L_{n_<}^{|n-n'|}\left( \frac{|\mathbf{q}|^2 \ell_{B}^2}{2} \right)
Expand All @@ -26,7 +27,7 @@ where $n_< = \min(n, n')$, $n_> = \max(n, n')$, and $L_n^\alpha$ are the general
### Exchange Kernels


$$ X_{n_1 m_1 n_2 m_2}(\mathbf{G}) = \int \frac{d^2 q}{(2\pi)^2} V(q) F_{m_1, n_1}(\mathbf{q}) F_{n_2, m_2}(-\mathbf{q}) e^{i (\mathbf{q} \times \mathbf{G})_z \ell_B^2} $$
$$ X_{n_1 m_1 n_2 m_2}^\sigma(\mathbf{G}) = \int \frac{d^2 q}{(2\pi)^2} V(q) F_{m_1, n_1}^\sigma(\mathbf{q}) F_{n_2, m_2}^\sigma(-\mathbf{q}) e^{i\sigma (\mathbf{q} \times \mathbf{G})_z \ell_B^2} $$

where $V(q)$ is the interaction potential. For the Coulomb interaction, $V(q) = \frac{2\pi e^2}{\epsilon q}$.

Expand Down Expand Up @@ -92,11 +93,25 @@ X_coulomb = get_exchange_kernels(

For more detailed examples, see the example scripts under `examples/` and the tests under `tests/`.

## Magnetic-field sign

The public APIs expose a `sign_magneticfield` keyword that represents
$\sigma = \mathrm{sgn}(q B_z)$, the sign of the charge–field product.
The default `sign_magneticfield=-1` matches the package's internal convention
(electrons in a positive $B_z$). Passing `sign_magneticfield=+1` returns the
appropriate complex-conjugated form factors or exchange kernels for the
opposite field direction without requiring any manual phase adjustments:

```python
F_plusB = get_form_factors(Gs_dimless, thetas, nmax, sign_magneticfield=+1)
X_plusB = get_exchange_kernels(Gs_dimless, thetas, nmax, method="hankel", sign_magneticfield=+1)
```

## Citation

If you use the package `quantumhall-matrixelements` in academic work, you must cite:

> Tobias Wolf, *quantumhall-matrixelements: Quantum Hall Landau-Level Matrix Elements*, version 0.1.0, 2025.
> Sparsh Mishra and Tobias Wolf, *quantumhall-matrixelements: Quantum Hall Landau-Level Matrix Elements*, version 0.1.0, 2025.
> DOI: https://doi.org/10.5281/zenodo.17646158

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.17646158.svg)](https://doi.org/10.5281/zenodo.17646158)
Expand All @@ -105,25 +120,30 @@ A machine-readable `CITATION.cff` file is included in the repository and can be

## Backends and Reliability

The package provides three backends for computing exchange kernels, each with different performance and stability characteristics:
The package provides two backends for computing exchange kernels:

1. **`gausslegendre` (Default)**
- **Method**: Gauss-Legendre quadrature mapped from $[-1, 1]$ to $[0, \infty)$ via a rational mapping.
- **Pros**: Fast and numerically stable for all Landau-level indices ($n$).
- **Cons**: May require tuning `nquad` for extremely large momenta or indices ($n > 100$).
- **Recommended for**: General usage, especially for $n \ge 10$.

1. **`gausslegendre` (Default)**:
- **Method**: Gauss-Legendre quadrature mapped from $[-1, 1]$ to $[0, \infty)$ via a rational mapping.
- **Pros**: Fast and numerically stable for all Landau level indices ($n$).
- **Cons**: May require tuning `nquad` for extremely large momenta or indices ($n > 100$).
- **Recommended for**: General usage, especially for large $n$ ($n \ge 10$).
2. **`hankel`**
- **Method**: Discrete Hankel transform.
- **Pros**: High precision and stability.
- **Cons**: Significantly slower than quadrature methods.
- **Recommended for**: Reference calculations and verifying the Gauss–Legendre backend.

2. **`gausslag`**:
- **Method**: Generalized Gauss-Laguerre quadrature.
- **Pros**: Very fast for small $n$.
- **Cons**: Numerically unstable for large $n$ ($n \ge 12$) due to high-order Laguerre polynomial roots.
- **Recommended for**: Small systems ($n < 10$) where speed is critical.
## Notes
The following wavefunction is used to find all matrix elements:

3. **`hankel`**:
- **Method**: Discrete Hankel transform.
- **Pros**: High precision and stability.
- **Cons**: Significantly slower than quadrature methods.
- **Recommended for**: Reference calculations and verifying other backends.
$$
\Psi_{nX}^\sigma(x,y)
= \frac{e^{i\sigma X y \ell_B^{-2}}}{\sqrt{L_y}}i^n\,
\phi_{n}(x -X),
\qquad
X = \sigma k_y \ell_B^{2}.
$$

## Development

Expand All @@ -142,6 +162,6 @@ The package provides three backends for computing exchange kernels, each with di

## Authors and license

- Author: Dr. Tobias Wolf
- Authors: Dr. Tobias Wolf, Sparsh Mishra
- Copyright © 2025 Tobias Wolf
- License: MIT (see `LICENSE`).
15 changes: 7 additions & 8 deletions examples/compare_exchange_backends.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Compare Gauss–Laguerre and Hankel exchange-kernel backends.
"""Compare Gauss–Legendre and Hankel exchange-kernel backends.

For a small |G|ℓ_B grid and nmax=2, this script computes the exchange
kernels using both the Gauss–Laguerre and Hankel backends and plots the
relative difference of a representative diagonal element X_{0000}(G).
kernels using both the Gauss–Legendre (default) and Hankel backends and plots
the relative difference of a representative diagonal element X_{0000}(G).
"""
from __future__ import annotations

Expand All @@ -13,11 +13,11 @@


def main() -> None:
nmax = 2
q = np.linspace(0.2, 3.0, 60)
nmax = 10
q = np.linspace(0.2, 20.0, 60)
theta = np.zeros_like(q)

X_gl = get_exchange_kernels(q, theta, nmax, method="gausslag")
X_gl = get_exchange_kernels(q, theta, nmax, method="gausslegendre")
X_hk = get_exchange_kernels(q, theta, nmax, method="hankel")

# Focus on X_{0000}(G) as a simple representative component
Expand All @@ -32,12 +32,11 @@ def main() -> None:
ax.plot(q, rel_diff, marker="o", linestyle="-")
ax.set_xlabel(r"$|G| \ell_B$")
ax.set_ylabel(r"relative difference")
ax.set_title(r"Relative difference of $X_{0000}(G)$: Gauss–Laguerre vs Hankel")
ax.set_title(r"Relative difference of $X_{0000}(G)$: Gauss–Legendre vs Hankel")
ax.grid(True, alpha=0.3)
fig.tight_layout()
plt.show()


if __name__ == "__main__":
main()

7 changes: 3 additions & 4 deletions examples/plot_exchange_kernels_radial.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Exchange kernel diagonal elements X_{nnnn}(G) vs |G|ℓ_B.

This example computes selected diagonal components of the exchange kernel
using the Gauss–Laguerre backend and plots their real parts as a function
using the Gauss–Legendre backend and plots their real parts as a function
of |G|ℓ_B.
"""
from __future__ import annotations
Expand All @@ -18,7 +18,7 @@ def main() -> None:
q = np.linspace(0.2, 4.0, 80)
theta = np.zeros_like(q)

X = get_exchange_kernels(q, theta, nmax, method="gausslag")
X = get_exchange_kernels(q, theta, nmax, method="gausslegendre")

fig, ax = plt.subplots()
for n in range(nmax):
Expand All @@ -31,7 +31,7 @@ def main() -> None:

ax.set_xlabel(r"$|G| \ell_B$")
ax.set_ylabel(r"$\mathrm{Re}\,X_{nnnn}(G)$ (κ=1)")
ax.set_title("Diagonal exchange kernels (Gauss–Laguerre backend)")
ax.set_title("Diagonal exchange kernels (Gauss–Legendre backend)")
ax.legend()
ax.grid(True, alpha=0.3)
fig.tight_layout()
Expand All @@ -40,4 +40,3 @@ def main() -> None:

if __name__ == "__main__":
main()

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ name = "quantumhall_matrixelements"
description = "Landau-level plane-wave form factors and exchange kernels for quantum Hall systems."
readme = "README.md"
authors = [
{ name = "Tobias Wolf", email = "public@wolft.xyz" }
{ name = "Tobias Wolf", email = "public@wolft.xyz" },
{ name = "Sparsh Mishra" }
]
license = { text = "MIT" }
requires-python = ">=3.10"
Expand Down
22 changes: 10 additions & 12 deletions src/quantumhall_matrixelements/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@
"""
from __future__ import annotations

from importlib.metadata import PackageNotFoundError
from importlib.metadata import version as _metadata_version
from typing import TYPE_CHECKING

import numpy as np
from importlib.metadata import PackageNotFoundError, version as _metadata_version

from .planewave import get_form_factors
from .exchange_gausslag import get_exchange_kernels_GaussLag
from .diagnostic import get_exchange_kernels_opposite_field, get_form_factors_opposite_field
from .exchange_hankel import get_exchange_kernels_hankel
from .exchange_legendre import get_exchange_kernels_GaussLegendre
from .planewave import get_form_factors

if TYPE_CHECKING:
from numpy.typing import NDArray
Expand All @@ -28,13 +29,13 @@


def get_exchange_kernels(
G_magnitudes: "RealArray",
G_angles: "RealArray",
G_magnitudes: RealArray,
G_angles: RealArray,
nmax: int,
*,
method: str | None = None,
**kwargs,
) -> "ComplexArray":
) -> ComplexArray:
"""Dispatcher for exchange kernels.

Parameters
Expand All @@ -49,26 +50,24 @@ def get_exchange_kernels(

- ``'gausslegendre'`` (default): Gauss-Legendre quadrature with rational mapping.
Recommended for all nmax.
- ``'gausslag'``: generalized Gauss–Laguerre quadrature.
Fast for small nmax (< 10), but unstable for large nmax.
- ``'hankel'``: Hankel-transform based implementation.

**kwargs :
Additional arguments passed to the backend (e.g. ``nquad``, ``scale``).
Common keywords include ``sign_magneticfield`` (±1) to select the
magnetic-field orientation convention.

Notes
-----
Both backends return kernels normalized for :math:`\\kappa = 1`. Any
physical interaction strength should be applied by the caller.
"""
chosen = (method or "gausslegendre").strip().lower()
if chosen in {"gausslag", "gauss-lag", "gausslaguerre", "gauss-laguerre", "gl"}:
return get_exchange_kernels_GaussLag(G_magnitudes, G_angles, nmax, **kwargs)
if chosen in {"hankel", "hk"}:
return get_exchange_kernels_hankel(G_magnitudes, G_angles, nmax, **kwargs)
if chosen in {"gausslegendre", "gauss-legendre", "legendre", "leg"}:
return get_exchange_kernels_GaussLegendre(G_magnitudes, G_angles, nmax, **kwargs)
raise ValueError(f"Unknown exchange-kernel method: {method!r}. Use 'gausslegendre', 'gausslag', or 'hankel'.")
raise ValueError(f"Unknown exchange-kernel method: {method!r}. Use 'gausslegendre' or 'hankel'.")


try:
Expand All @@ -81,7 +80,6 @@ def get_exchange_kernels(
__all__ = [
"get_form_factors",
"get_exchange_kernels",
"get_exchange_kernels_GaussLag",
"get_exchange_kernels_hankel",
"get_exchange_kernels_GaussLegendre",
"__version__",
Expand Down
50 changes: 0 additions & 50 deletions src/quantumhall_matrixelements/_debug_symmetry.py

This file was deleted.

Loading