Use when computing linearized Boltzmann collision operators, transport coefficients (conductivity, thermal conductivity, viscosity), or eigenmode analysis for any quantum or classical many-body system — electrons, phonons, cold atoms, classical gases. Covers Fermi-Dirac, Bose-Einstein, and Maxwell-Boltzmann statistics with 1-body, 2-body, and 3-body scattering.
Compute the linearized collision operator, extract transport coefficients, and analyze eigenmodes for quantum and classical many-body systems.
At every stage, you MUST explain what you are doing and why, in enough detail that the user can:
This means: explain the physical reasoning, show the key formulas with their meaning, present results with interpretation, and point out where things could go wrong. The user is a physicist — talk to them as a collaborator, not a customer waiting for output.
After completing each stage, you MUST output:
Never produce results without explaining how to verify them. Never produce figures without analysis text explaining what the figure shows, what the user should look for, and what would indicate a problem.
At each checkpoint, do NOT simply ask "shall I proceed?" Instead:
The goal is a scientific dialogue, not a permission workflow.
If you are not confident about a physical interpretation, do NOT write it down as if it were established. Instead:
Vague or incorrect analysis is worse than no analysis. The user is the domain expert — let them draw conclusions from clean data. When in doubt, show the numbers and ask.
The pipeline has two phases: Planning (Stages 0–C) and Execution (Stages 1–8). No code is written until the user approves the theory document and coding plan.
digraph pipeline {
rankdir=TB;
subgraph cluster_planning {
label="Planning Phase (no code yet)";
style=dashed;
"0. Clarify requirements\n(system, results, scope)" [shape=box];
"A. Basis assessment\n(does this need expansion?)" [shape=box];
"B. Theory document\n(write derivation .md, user reviews)" [shape=box];
"C. Coding plan\n(write plan .md, user reviews)" [shape=box];
}
subgraph cluster_execution {
label="Execution Phase";
"1. Define system\n(discuss with user)" [shape=box];
"2. Natural units\n(explain choices)" [shape=box];
"3. Equilibrium & weight\n(show plots, explain physics)" [shape=box];
"4. Symmetry & basis\n(present options, explain trade-offs)" [shape=box];
"5. Collision kernel\n(show matrix structure, verify)" [shape=box];
"6. Diagnostics\n(present all checks, explain failures)" [shape=box];
"Diagnostics pass?" [shape=diamond];
"7. Transport coefficients\n(explain each coefficient, compare RTA)" [shape=box];
"8. Eigenmode analysis\n(full spectrum, mode-resolved transport)" [shape=box];
}
"0. Clarify requirements\n(system, results, scope)" -> "A. Basis assessment\n(does this need expansion?)";
"A. Basis assessment\n(does this need expansion?)" -> "B. Theory document\n(write derivation .md, user reviews)";
"B. Theory document\n(write derivation .md, user reviews)" -> "C. Coding plan\n(write plan .md, user reviews)";
"C. Coding plan\n(write plan .md, user reviews)" -> "1. Define system\n(discuss with user)" [label="user approves"];
"1. Define system\n(discuss with user)" -> "2. Natural units\n(explain choices)";
"2. Natural units\n(explain choices)" -> "3. Equilibrium & weight\n(show plots, explain physics)";
"3. Equilibrium & weight\n(show plots, explain physics)" -> "4. Symmetry & basis\n(present options, explain trade-offs)";
"4. Symmetry & basis\n(present options, explain trade-offs)" -> "5. Collision kernel\n(show matrix structure, verify)";
"5. Collision kernel\n(show matrix structure, verify)" -> "6. Diagnostics\n(present all checks, explain failures)";
"6. Diagnostics\n(present all checks, explain failures)" -> "Diagnostics pass?";
"Diagnostics pass?" -> "7. Transport coefficients\n(explain each coefficient, compare RTA)" [label="yes"];
"Diagnostics pass?" -> "5. Collision kernel\n(show matrix structure, verify)" [label="no → explain what's wrong"];
"7. Transport coefficients\n(explain each coefficient, compare RTA)" -> "8. Eigenmode analysis\n(full spectrum, mode-resolved transport)";
}
Every stage is a dialogue. Explain what you did, show the results with interpretation, point out what the user should verify, and invite questions before continuing.
No code is written during the planning phase. The goal is to fully understand the problem, work out the theory, and agree on a plan before touching any code.
Before anything else, have a structured conversation with the user to pin down exactly what they need. Ask about each of the following, one at a time:
Output: A requirements summary table. Example:
| Aspect | User's specification |
|---|---|
| System | 2D parabolic electron gas, Coulomb (TF-screened) |
| Statistics | Fermi-Dirac |
| Scattering | e-e normal + impurity ($\tau_{\mathrm{mr}}$) |
| Parameters | $r_s = 1$, $T/T_F = 0.05$, $\tau_{\mathrm{mr}}^{-1} = 0.01$ |
| Results wanted | $\sigma$, $\kappa$, Seebeck, Lorenz ratio, full eigenmode spectrum |
| Benchmarks | Wiedemann-Franz limit, known 2DEG results |
Present this summary to the user and confirm before moving on. Misunderstanding the problem here wastes everything downstream.
Before choosing a specific basis, assess whether the problem requires a basis function expansion at all, and if so, what kind.
Does this problem have continuous degrees of freedom that need discretization?
What symmetry can be exploited?
What is the natural energy variable?
What weight function defines the inner product?
How many basis functions are needed?
Are there existing implementations that cover this system?
boltzmann_transport already has the needed dispersion, interaction, and scattering topologyOutput: A brief assessment document addressing these questions, with a recommendation:
Present to user and discuss. The user may have insight about which basis works best for their system.
HARD GATE: Do NOT write any computation code until this document is written and approved.
After understanding the requirements (Stage 0) and basis strategy (Stage A), write a self-contained theoretical derivation document covering the specific calculation to be performed. Save it as a markdown file (e.g., docs/theory_<system_name>.md).
This is a physics document, not a code document. It should read like a methods section of a paper — someone who reads it should understand the full derivation from Hamiltonian to transport coefficient, without needing to read any code.
Present the document to the user for review. Ask:
Do NOT proceed to Stage C until the user confirms the theory is correct.
After the theory document is approved, write a concrete coding plan. Save it as a markdown file (e.g., docs/plan_<system_name>.md).
boltzmann_transport (or boltzmann_2deg) can be reused as-isPresent the plan to the user. Ask:
Do NOT begin execution (Stage 1) until the user approves the plan.
Now proceed with the computation, following the approved theory document and coding plan.
Discuss with the user to determine the five choices:
| Choice | Options | What to explain |
|---|---|---|
| Dimension | 1D, 2D, 3D | How dimension affects density of states and phase space |
| Dispersion $\varepsilon(k)$ | parabolic, Dirac, acoustic phonon, custom | How the band structure determines velocity and DoS |
| Statistics | fermi, bose, classical | How quantum statistics affects scattering weights and the weight function |
| Interaction $ | M(q) | ^2$ |
| Scattering | 1-body, 2-body, 3-body | Which conservation laws each channel satisfies; why momentum relaxation is needed |
Plus parameters: coupling $r_s$, degeneracy $T/T_F$, momentum relaxation $\tau_{\mathrm{mr}}^{-1}$.
Output: Summary table of all choices. Explain what regime the parameters put us in (e.g., "at $T/T_F = 0.05$, the system is strongly degenerate — only states within $5%$ of the Fermi energy participate in scattering").
Explain why we nondimensionalize and present the chosen scales:
| System | Energy unit | Dimensionless energy | Why this choice |
|---|---|---|---|
| Degenerate fermion | $E_F$ | $\xi = (\varepsilon - \mu)/k_BT$ | Centers on Fermi surface where physics happens |
| Phonon | $k_BT_D$ | $\xi = \hbar\omega/k_BT$ | Natural scale for thermal occupation |
| Classical | $k_BT$ | $\xi = \varepsilon/k_BT$ | Boltzmann factor is $e^{-\xi}$ |
Output: Derived dimensionless parameters with physical meaning:
Point out what the user should check: Are the derived parameters physically reasonable for their material/experiment?
Compute and plot $f^0(\xi)$ and $g(\xi)$. Explain what $g(\xi)$ physically means:
Output:
Explain the symmetry analysis and why the basis choice matters:
| System symmetry | Angular basis | Energy basis | Why this works |
|---|---|---|---|
| 2D isotropic | Fourier $e^{il\theta}$ | Gram-Schmidt poly | Rotational symmetry makes $C_l$ block-diagonal — huge reduction |
| 3D isotropic | $Y_{lm}$ | Gram-Schmidt poly | Same, but with spherical harmonics |
| Anisotropic | Full grid | Direct | No symmetry to exploit — brute force required |
Output:
Build the collision matrix $C_l$ using the outer-product construction:
$$C_l \mathrel{+}= P_e \cdot \mathbf{c}_e \mathbf{c}_e^T$$
By topology:
| Type | Sign vector | Weight $P_e$ |
|---|---|---|
| 2-body $(1,2\to3,4)$ | $[-1,-1,+1,+1]$ | $f_1 f_2, S_3, S_4, |
| 1-body $(k\to k')$ | $[-1,+1]$ | $f_k, S_{k'}, |
| 3-body merge $(1,2\to3)$ | $[-1,-1,+1]$ | $n_1 n_2 (1{+}n_3), |
| 3-body split $(1\to2,3)$ | $[-1,+1,+1]$ | $n_1 (1{+}n_2)(1{+}n_3), |
Critical implementation detail: Use plain $\psi$ (NOT $\psi \cdot gw$) for basis projection. Explain why: "The $gw$ factor is already part of the inner product definition $\langle f, h \rangle = \sum f_i h_i g_i w_i$. Including it in the sign vector would double-count it, giving eigenvalues that are too small by a factor of $\sim gw^2$."
Output:
Run ALL checks and explain what each one tests and why it matters:
| Check | Expected | Why it matters |
|---|---|---|
| $C_l = C_l^T$ | Exact | Detailed balance / time-reversal symmetry |
| All eigenvalues $\geq 0$ | H-theorem | Entropy always increases; violation = unphysical |
| $l=0$: 2 zero modes | Particle + energy | These quantities cannot be changed by e-e scattering |
| $l=1$: 1 zero mode | Momentum | Total momentum is conserved in normal scattering |
| $l \geq 2$: 0 zero modes | No conservation | No rank-2+ tensor is conserved |
Output:
Explain the physics of the transport solve:
"We solve $(C_1 + \tau_{\mathrm{mr}}^{-1} I), \mathbf{a} = \mathbf{s}$ — this is the steady-state balance between the external driving force ($\mathbf{s}$) and the combined relaxation from e-e collisions ($C_1$) plus momentum relaxation ($\tau_{\mathrm{mr}}^{-1}$)."
| Recipe | Source $\mathbf{s}$ | Output | Physical meaning |
|---|---|---|---|
| Thermoelectric | $v(\xi)$, $v(\xi)\xi$ | $\sigma$, $\kappa$, $S$ | Charge and heat response to E-field and $\nabla T$ |
| Phonon thermal | $v(\xi)\xi$ | $\kappa_{\mathrm{ph}}$ | Heat current response to $\nabla T$ |
| Viscosity | Stress tensor ($l=2$) | $\eta$ | Stress response to strain rate |
Output:
Output the numerical results. Do NOT provide pre-baked interpretations. Present the data clearly and discuss with the user what the results mean for their system.
Output:
Complete eigenvalue table — all eigenvalues sorted, with classification (zero/slow/fast)
Eigenvalue histogram — show the distribution of eigenvalues
Log-log plot of $\lambda_n$ vs $n$ — fit a power law if the data supports it; if the fit is poor, say so
Mode-resolved transport — bar chart showing each mode's contribution to each transport coefficient the user requested
Eigenvector structure — plot representative eigenstates (e.g., slowest and fastest)
Save ALL data as .txt files
After presenting the data, discuss with the user:
Do NOT make blanket claims about RTA validity, power-law exponents, or mode dominance patterns. These depend on the specific system and must be verified case by case with the user.
Codebase location: ~/Desktop/Github/boltzmann_transport/
from boltzmann_transport import SystemConfig, BoltzmannSolver
system = SystemConfig(
dimension=2, # 1, 2, or 3
dispersion="parabolic", # or "dirac", "acoustic_phonon", custom callable
statistics="fermi", # or "bose", "classical"
interaction="coulomb_tf", # or "contact", "coulomb_3d", custom callable
scattering=["ee_normal"], # or ["impurity"], ["phonon_3body_merge"]
params={"r_s": 1.0, "T_over_TF": 0.05},
tau_mr_inv=0.01,
)
solver = BoltzmannSolver(system)
result = solver.run(recipe="thermoelectric") # or "phonon_thermal"
# Access results
result.transport["sigma"] # electrical conductivity
result.transport["kappa"] # thermal conductivity
result.transport["sigma_ratio_rta"] # exact/RTA ratio
result.eigenmodes[1].eigenvalues # l=1 eigenvalue spectrum
Basis advisor (automated basis selection):
result = solver.run(auto_advise=True)
print(result.basis_recommendation.reasoning)
| Mistake | Fix |
|---|---|
| Using $\psi \cdot gw$ in sign vector projection | Use plain $\psi$. The $gw$ is in the inner product, not the kernel. |
| Too few angular quadrature points | Use $n_\alpha, n_\beta \geq 24$. Check zero-mode accuracy. |
| $\xi_{\max}$ too small for the weight function | Fermi: $\xi_{\max} \geq 12$. Bose: $\xi_{\max} \geq 15$. |
| Trusting RTA without checking | If computing RTA, always compare exact vs RTA and discuss the ratio with the user. |
| Skipping diagnostics | Run ALL checks before extracting transport. Failed diagnostics = wrong physics. |
| N-point Lagrange interpolation for outgoing particles | Use 2-point linear interpolation. Preserves conservation laws, avoids 1/gw blowup at large N. |
| Producing figures without analysis | Always output numerical values, physical interpretation, and .txt data files alongside every plot. |
| Computing without explaining | Every formula, every choice, every result needs physical reasoning. The user is a physicist — help them verify correctness. |
| Treating checkpoints as permission gates | Don't just ask "shall I proceed?" — explain what was done, what the results mean, what could go wrong, and what the user should verify. |
| Document | Location |
|---|---|
| Calculation summary | boltzmann_transport/docs/calculation_summary.md |
| RTA failure analysis | boltzmann_transport/docs/rta_failure_universal.md |
| Kernel/operator math | boltzmann_2deg/docs/kernel_operator_explanation.md |
| Eigenvalue analysis | boltzmann_2deg/docs/eigenvalue_analysis.md |
| N_b=100 eigenvalues | boltzmann_2deg/docs/eigenvalue_100_analysis.md |
| Mode-transport connection | boltzmann_2deg/docs/mode_transport_analysis.md |
| Full results with figures | boltzmann_2deg/docs/results_analysis.md |