API reference
Everything exported by CFsOnSphere, grouped by topic. Internal helpers that carry docstrings are included for completeness.
CFsOnSphere — Module
CFsOnSphereComposite-fermion wavefunctions on the Haldane sphere for the fractional quantum Hall effect.
The package builds Jain–Kamilla projected (Ψproj, Ψparton) and unprojected (Ψunproj, ΨoneLL) composite-fermion wavefunctions and samples them with a Metropolis–Hastings–Gibbs random walk to estimate densities, pair correlations, energies, and overlaps. The projection uses the quaternion/rotation reformulation of Jain–Kamilla projection (Phys. Rev. Lett. 134, 156501 (2025)): the projected orbital is a sum over a Wigner-D matrix times elementary symmetric polynomials of the Jastrow "vortex ratios".
See the documentation for tutorials and the full API reference.
Wavefunction types and updates
The four wavefunction families and their in-place update routines.
CFsOnSphere.ΨoneLL — Type
ΨoneLLBare single-Landau-level Jastrow wavefunction ∏_{j<k}(uⱼvₖ-uₖvⱼ)^p (no Slater determinant). Fields: p, system_size, U, V, dist_matrix, jastrow_factor_log.
CFsOnSphere.ΨoneLL — Method
ΨoneLL(p, system_size)Construct a bare Jastrow (Laughlin) wavefunction.
CFsOnSphere.Ψparton — Type
ΨpartonMutable state of a Jain-Kamilla projected parton wavefunction (multiple sectors with per-sector Qstars and l_m_lists). As in Ψproj, the JK projection binds a single vortex pair into each orbital (Q₁ = (N-1)/2).
Fields mirror Ψproj, with Qstars/l_m_lists replacing the single-sector versions, max_JK the largest JK order over sectors, and trackers[i] the slater_det row range of parton i.
CFsOnSphere.Ψparton — Method
Ψparton(Qstars, p, system_size, l_m_lists)Construct a Jain-Kamilla projected parton wavefunction. Qstars[i] and l_m_lists[i] give the effective monopole strength and occupied orbitals of parton i.
CFsOnSphere.Ψproj — Type
ΨprojMutable state of a Jain-Kamilla projected composite-fermion wavefunction (electrons + p attached flux), at filling controlled by Qstar, l_m_list.
The JK projection binds a single vortex pair into each orbital (Q₁ = (N-1)/2, ESP roots with multiplicity one). Higher Jastrow powers ν = n/(2pn+1) come from the global Jastrow factor ∏(uᵢvⱼ-uⱼvᵢ)^p: e.g. Ψ_{n/(2pn+1)} = Φ₁^{2(p̃-1)} P_LLL[Φₙ Φ₁²] is obtained with p = 2 p̃.
Key fields
Qstar::Rational{Int64}: effective monopole strengthQ*.p::Int64: power of the global Jastrow factor∏(uᵢvⱼ-uⱼvᵢ)^p.system_size::Int64: number of electronsN.l_m_list: occupied(L, Lz)orbitals.slater_det::Matrix{ComplexF64}: the projected Slater matrix.jastrow_factor_log::ComplexF64: log of the global Jastrow factor.reg_coeffs::Vector{Float64}: ESP normalization,reg_coeffs[i] = i/((N-1)-i+1)so∏ = 1/C(N-1, k).
The remaining fields (U, V, exp_θ, exp_ϕ, dist_matrix, u_v_ratio_matrix, elementary_symmetric_polynomials, wigner_d_matrices, wigner_D_matrices, fourier_tot_matrix, μ_list, Lz_list, Lmax) are work arrays / caches.
CFsOnSphere.Ψproj — Method
Ψproj(Qstar, p, system_size, l_m_list)Construct a Jain-Kamilla projected CF wavefunction. Qstar = Q - p(N-1)/2 is the effective monopole strength, p the global Jastrow power, l_m_list the occupied (L, Lz) orbitals. The JK projection binds a single vortex pair into each orbital (Q₁ = (N-1)/2).
CFsOnSphere.Ψunproj — Type
ΨunprojMutable state of an unprojected composite-fermion wavefunction with single-particle monopole-harmonic orbitals.
Key fields
Qstar::Rational{Int64}: monopole strength of the orbitals.p::Int64: power of the global Jastrow factor∏(uᵢvⱼ-uⱼvᵢ)^p.system_size::Int64: number of electronsN.l_m_list: occupied(L, Lz)orbitals.U,V: spinor coordinates.dist_matrix::Matrix{Float64}: pairwise chord distances.slater_det::Matrix{ComplexF64}:slater_det[orbital, particle] = Y_{Q*,L,Lz}(Ωᵢ).slater_det_inv::Matrix{ComplexF64}: maintained inverse ofslater_det(valid only for a square / closed-shell determinant; updated by the Sherman-Morrison helpers).jastrow_factor_log::ComplexF64: log of the global Jastrow factor.
fourier_tot_matrix, μ_list, Lz_list, exp_θ, exp_ϕ are caches for the orbitals.
CFsOnSphere.Ψunproj — Method
Ψunproj(Qstar, p, system_size, l_m_list)Construct an unprojected CF wavefunction: a Slater determinant of monopole harmonics Y_{Qstar,L,Lz} (the orbitals in l_m_list) times the global Jastrow ∏(uᵢvⱼ-uⱼvᵢ)^p. The orbital transform is precomputed from the J_y eigenstates.
Base.copy! — Method
copy!(ψ1::Ψunproj, ψ2::Ψunproj, iter::Int64)Partial in-place copy assuming only particle iter changed. Does not copy slater_det_inv (the Sherman-Morrison helpers maintain the inverse on the accepted state).
Base.copy! — Method
copy!(ψ1::Ψunproj, ψ2::Ψunproj)Full in-place copy. Includes slater_det_inv.
Base.copy! — Method
copy!(Ψ1, Ψ2, iter::Int64)Partial in-place copy assuming only particle iter changed (the per-particle caches plus the full coupled arrays that a single move touches).
Base.copy! — Method
copy!(Ψ1, Ψ2)Full in-place copy of one projected wavefunction into another of the same type.
CFsOnSphere.update_wavefunction! — Method
update_wavefunction!(Ψ::Union{Ψproj,Ψparton}, θ::Float64, ϕ::Float64, iter::Int64)Update the projected wavefunction after moving only particle iter to (θ, ϕ). Note that because the projection couples all particles, the elementary symmetric polynomials and the whole slater_det are recomputed (no rank-1 shortcut). Modifies Ψ in place.
CFsOnSphere.update_wavefunction! — Method
update_wavefunction!(Ψ::Union{Ψproj,Ψparton}, θ::Vector{Float64}, ϕ::Vector{Float64})Full rebuild of the projected wavefunction Ψ from all particle positions (θ, ϕ). Modifies Ψ in place.
CFsOnSphere.update_wavefunction! — Method
update_wavefunction!(ψ::Ψunproj, θ::Float64, ϕ::Float64, iter::Int64)Incremental update after moving only particle iter to (θ, ϕ): updates the Jastrow log, the iter row/column of dist_matrix, and only column iter of slater_det (single particle orbital). Modifies ψ in place.
CFsOnSphere.update_wavefunction! — Method
update_wavefunction!(ψ::Ψunproj, θ::Vector{Float64}, ϕ::Vector{Float64})Full rebuild of ψ from all particle positions. Modifies ψ in place. (Does not refresh slater_det_inv; call initialize_inverse! afterwards if you maintain the inverse.)
Orbitals, projection, and polynomials
The single-particle monopole harmonics, the Jain–Kamilla projection coefficients, and the elementary symmetric polynomials at the heart of the projection.
CFsOnSphere.calculate_ll — Method
calculate_ll(l::Rational{Int}, Q::Rational{Int}, θ::Float64, φ::Float64) -> Vector{ComplexF64}Evaluate the monopole harmonics $Y_{Q,l,m}(θ, φ)$ of total angular momentum l at monopole strength Q, for all m = -l, -l+1, …, l. The returned vector is ordered by increasing m.
These are the single-particle orbitals making up the unprojected composite-fermion Slater determinant (Ψunproj), and are also used to build the fixed quasihole / quasiparticle orbital columns consumed by build_extended_slater!.
The orbital is assembled from the J_y eigenstates (see calculate_j_y_eigenstates) as a basis rotation,
Y_{Q,l,m}(θ,φ) = √((2l+1)/4π) · Σ_μ ⟨l,μ|_y |l,Q⟩ ⟨l,m|l,μ⟩_y e^{-iμθ} e^{imφ},which avoids the (discontinuous) phase of the explicit monopole-harmonic formula.
CFsOnSphere.custom_logbinomial — Method
custom_logbinomial(q1, q2) -> Float64Logarithm of the binomial coefficient C(q1, q2) via loggamma, returning -Inf when q1 - q2 < 0 (so the corresponding term drops out of projection_coeff).
CFsOnSphere.generate_fourier_matrices — Method
generate_fourier_matrices(Qstar, N, L, Lz_list)Build the Fourier-coefficient matrix for the Jain-Kamilla projection at total angular momentum L, effective monopole strength Qstar, and the requested Lz_list.
The JK projection binds a single vortex pair into each orbital, Jᵢ = ∏_{j≠i}(uᵢvⱼ - uⱼvᵢ), so the projected orbital is [P_LLL Y_{Q*,L,M} Jᵢ] / Jᵢ and the JK angular momentum is Q1 = (N-1)/2 (so 2Q1 = N-1 is the number of Jastrow roots), which enters the binomials of projection_coeff.
CFsOnSphere.projection_coeff — Method
projection_coeff(L, Qstar, Q1, m) -> Float64The Jain-Kamilla projection coefficient N^L_{m,Q*,Q1} (see the manuscript),
N^L_{m,Q*,Q1} = C(2Q1, L-Q*) C(L-Q*, m-Q*) / C(2Q1+L+Q*+1, L-Q*)
· √[ (2L+1)/4π · C(2L, L+Q*) / C(2L, L+m) ],with Q1 = (N-1)/2. Here √(2L+1)/4π is supplied separately in generate_fourier_matrices.
CFsOnSphere.get_symmetric_polynomials! — Method
get_symmetric_polynomials!(dest, roots, b::Int, reg_coeffs)In-place, regularized variant: dest[k+1] holds the degree-k elementary symmetric polynomial multiplied by ∏_{i=1}^{k} reg_coeffs[i].
For the JK projection reg_coeffs[i] = i / ((N-1) - i + 1), so the product equals 1 / C(N-1, k) = 1 / C(2Q₁, k) with Q₁ = (N-1)/2, matching the normalization ẽ in the projection coefficient N^l_{m',Q*,Q1}.
CFsOnSphere.get_symmetric_polynomials! — Method
get_symmetric_polynomials!(dest, roots, b::Int)In-place: fill dest[1:b+1] with the elementary symmetric polynomials of degrees 0…b in roots.
Arguments
dest: destination array of length ≥b+1.roots: the roots.b::Int: maximum ESP degree to compute.
CFsOnSphere.get_symmetric_polynomials — Method
get_symmetric_polynomials(roots, b)Allocating reference implementation (not exported): returns a length-b+1 vector whose k+1-th entry is the elementary symmetric polynomial of degree k in roots. Used to cross-check the in-place versions.
CFsOnSphere.legendre_polynomials! — Method
legendre_polynomials!(res, x, kmax::Int64)Compute the Legendre polynomials up to degree kmax at point x, storing the results in the pre-allocated array res (length kmax+1); res[k] holds P_{k-1}(x).
Uses the recurrence Pₙ₊₁(x) = ((2n+1) x Pₙ(x) - n Pₙ₋₁(x)) / (n+1). Modifies res in-place.
CFsOnSphere.calculate_j_y_eigenstates — Method
calculate_j_y_eigenstates(l::Rational) -> Dict{NTuple{3,Rational{Int64}},ComplexF64}Return a dictionary d[(μ, m1, m2)] = ⟨l,m1|l,μ⟩_y · conj(⟨l,m2|l,μ⟩_y), i.e. the product of J_y-eigenvector components needed to build rotation / Wigner-d matrix elements at angular momentum l. The result is memoised on disk in tempdir().
CFsOnSphere.u_v_generator — Method
u_v_generator(θ, ϕ)Convert spherical coordinates (θ, ϕ) to the spinor (CP¹) coordinates
u = cos(θ/2) exp(+i ϕ/2), v = sin(θ/2) exp(-i ϕ/2).Works for scalar inputs (returns a Tuple{ComplexF64,ComplexF64}) and for vector inputs (returns a tuple of Vector{ComplexF64}), since the body broadcasts.
Slater inverse and excitations
Sherman–Morrison rank-1 inverse tracking for Ψunproj, and the extended Slater determinant for quasihole/quasiparticle amplitudes.
CFsOnSphere.build_extended_slater! — Method
build_extended_slater!(Sfull, ψ, qh_columns) -> LUFill the preallocated (N+k)×(N+k) matrix Sfull with the electron Slater block of ψ (first N columns) and k fixed quasihole / quasiparticle orbital columns qh_columns (built from calculate_ll), and return its LU factorization.
Works for Ψproj (recompute the LU each step — the projection has no rank-1 shortcut) and for Ψunproj. Quasihole amplitudes follow from transpose(LU) \ e_end.
CFsOnSphere.initialize_inverse! — Method
initialize_inverse!(ψ::Ψunproj)Compute ψ.slater_det_inv = inv(ψ.slater_det) (O(N³)). Call once after the first full update_wavefunction!; requires a square (closed-shell) slater_det.
CFsOnSphere.slater_det_ratio — Method
slater_det_ratio(ψcurrent::Ψunproj, ψnext::Ψunproj, iter::Int) -> ComplexF64The determinant ratio det(Sₙₑₓₜ)/det(S_current) for a move of particle iter, computed in O(N) from the maintained inverse of ψcurrent and the new column of ψnext: Sinv[iter, :] · Sₙₑₓₜ[:, iter].
CFsOnSphere.update_inverse! — Method
update_inverse!(ψcurrent::Ψunproj, ψnext::Ψunproj, iter::Int, det_ratio::ComplexF64, temp::Vector{ComplexF64})Rank-1 Sherman-Morrison update of ψcurrent.slater_det_inv for an accepted move of particle iter to ψnext (O(N²)). det_ratio is the value returned by slater_det_ratio; temp is an N-length scratch vector. Call before copy!(ψcurrent, ψnext, iter).
Λ-level builders
Convenience constructors for the (Qstar, l_m_list) of the standard composite-fermion states.
CFsOnSphere.cf_ground_state_lm — Method
cf_ground_state_lm(N, n, p) -> (Qstar, l_m_list)Effective monopole strength and occupied (L, Lz) orbitals for the CF ground state of N electrons in n filled Λ-levels at filling ν = n/(pn+1), where p is the Jastrow power (the number of attached vortices, even) that you pass on to Ψproj/Ψunproj. Qstar = (N//n - n)//2 (independent of p), with all Lz filled in Λ-levels |Qstar| … |Qstar|+|n|-1.
CFsOnSphere.cf_quasihole_lm — Method
cf_quasihole_lm(N, n, p) -> (Qstar, l_m_list)As cf_ground_state_lm but with one quasihole: the top orbital (Lqh, Lqh) of the highest occupied Λ-level (Lqh = |Qstar|+|n|-1) is removed.
CFsOnSphere.cf_quasiparticle_lm — Method
cf_quasiparticle_lm(N, n, p) -> (Qstar, l_m_list)As cf_ground_state_lm but with one quasiparticle: the orbital (Lqp, Lqp) in the next Λ-level (Lqp = |Qstar|+|n|) is added.
Monte Carlo
The Metropolis–Hastings–Gibbs driver, proposal, step-size adaptation, and observable accumulators.
CFsOnSphere.arm_parameters — Method
arm_parameters(ideal_acceptance_ratio::Float64, r::Float64) -> (a, b)Precompute the parameters (a, b) of the ARM (acceptance-rate monitoring) step-size scheme for a target acceptance ratio, via a fixed-point iteration.
CFsOnSphere.arm_scale_factor — Method
arm_scale_factor(p, p_i, a, b) -> Float64Multiplicative step-size rescale factor given current acceptance p, target p_i, and ARM parameters (a, b): > 1 when acceptance is too high, < 1 when too low.
CFsOnSphere.construct_det_ratios — Method
construct_det_ratios(denominator_rows, numerator_rows)Build a closure helper!(res, S, Sinv) computing the determinant ratios det(S[numerator_rows[i], :]) / det(S[denominator_rows, :]) efficiently by reducing to the sub-determinant over rows not shared with the denominator. Sinv is the inverse of S[denominator_rows, :]. All numerator row-sets must have the same length as denominator_rows; matrix elements are assumed ComplexF64.
CFsOnSphere.gibbs_thermalization! — Method
gibbs_thermalization!(RNG, Ψcurrent, Ψnext, θcurrent, ϕcurrent, θnext, ϕnext, σinit, logpdf, num_thermalization)Thermalize a single-particle Gibbs / Metropolis-Hastings walk targeting logpdf(Ψ) (a real scalar), tuning the step size σ toward a 50% acceptance rate via the ARM scheme. Works for any wavefunction type (Ψproj, Ψparton, ΨoneLL, Ψunproj).
Returns (sampling_iter, σ, δt_therm, acceptance_rate).
CFsOnSphere.proposal — Method
proposal(RNG, θcurrent::Float64, ϕcurrent::Float64, σ::Float64) -> (θnew, ϕnew)Propose a new point on the sphere by rotating the current position along a great circle by a Gaussian angle δθ ~ N(0, σ) in a uniformly random tangent direction.
The current position r̂ is taken as a Cartesian unit vector; a random 3D Gaussian is projected onto the tangent plane at r̂ and normalized to give the direction ê, and the new point is r̂ cos(δθ) + ê sin(δθ). This proposal is isotropic about the current point (hence symmetric, preserving detailed balance). Returns (θ, ϕ) in the same convention as rand_θ_ϕ_gen.
CFsOnSphere.rand_θ_ϕ_gen — Method
rand_θ_ϕ_gen(RNG, n_samples::Int) -> (θlist, ϕlist)Generate n_samples points uniformly on the unit sphere, returned as polar angles θ ∈ [0, π] and azimuthal angles ϕ ∈ (-π, π] (via atan). Uses the Marsaglia method (normalize 3D Gaussians).
CFsOnSphere.update_density! — Method
update_density!(θmesh, ϕmesh, θcurrent, ϕcurrent, accumulated_density)Accumulate a 2D (θ, ϕ) density histogram in place.
CFsOnSphere.update_density! — Method
update_density!(θmesh, θcurrent, accumulated_density)Accumulate a 1D polar-angle density histogram in place: for each θ in θcurrent, increment the bin of accumulated_density located by searchsortedfirst(θmesh, θ) - 1.