Commit Graph

36 Commits

Author SHA1 Message Date
Nuwan Yapa ba83021a63 Generalized to Hartree-Bogoliubov (RHB)
Canonical-basis BCS with constant-G monopole pairing, following Vretenar et al. 2005 Sec 2.3.3 (Eqs. 48-50).

Changes (~80 new lines, only 3 files touched):
- system.jl:28-40 — spectrum now carries occ::Vector{Float64} plus pairing gap Δ and chemical potential λ.
- nucleons.jl:147-156 — new helpers: Ω_κ(κ)=|κ|, pairing_G(s)=20/A, and a 5 MeV active-window constant E_pair_window that regularizes the constant-G gap equation.
- nucleons.jl:172-232 — solveBCS: freezes orbitals outside ±5 MeV of the Fermi level as core/empty; in the active window alternates two 1-D bisections on λ (particle-number constraint) and Δ (gap equation G/2 · Σ Ω/√((ε-λ)²+Δ²) = 1), falling back to Δ=0 when no non-trivial solution exists. Thin wrapper fillNucleonsBCS returns a spectrum.
- nucleons.jl:209-218 — nucleon_E now adds the BCS pairing energy −(Δ_p² + Δ_n²)/G.
- nucleons.jl:244 — density loop skips orbitals with negligible occupation for speed.
- fillNucleons was kept (one-line sharp filler) since two diagnostic test scripts use it.

Verification:
- Pb-208 (doubly-magic, test/Pb208.jl): Δ_p = Δ_n = 0; binding energy 7.892 MeV/nucleon — bit-identical to the pre-RHB baseline (confirmed by git stash).
- Sn-120 (open neutron shell): Δ_n = 0.56 MeV with properly fractional occupations on the N=50–82 shell (e.g. 1h_{11/2}: 1.03/12, 3s_{1/2}: 1.57/2, 2d_{3/2}: 3.51/4); neutron particle-number sums to 70 exactly. Proton Δ_p = 0 (Z=50 closed). Binding 8.475 MeV/A (exp. 8.50).

Design notes: The ±5 MeV pairing window is the standard BCS cut-off that prevents constant-G from generating spurious gap at closed shells (without it, Pb-208 would pair). It's exposed via E_window kwarg on solveBCS if you want to tune it. G=20/A gives somewhat weaker gaps than experimental (Sn-120 expt ≈1.4 MeV vs our 0.56) — a typical limitation of the Bohr-Mottelson estimate; the user can override pairing_G or pass a custom G through solveBCS directly.
2026-04-16 00:28:56 +00:00
Nuwan Yapa 99b4359972 Increase precision of bisection 2026-04-02 19:22:19 -04:00
Nuwan Yapa 3becb0860f Matching point = 3fm (same as Hartree.f) 2026-04-02 14:28:42 -04:00
Nuwan Yapa 12acf3297e More accurate normalization 2025-08-05 16:27:23 -04:00
Nuwan Yapa 0af47ef161 Reorganize shooting method (not optional anymore) 2025-04-16 16:08:32 -04:00
Nuwan Yapa 897fdf9214 Changed initial boundary condition 2025-04-08 12:29:01 -04:00
Nuwan Yapa 268ce12b6c Tsit5 -> Vern9 for better accuary 2025-04-07 19:40:31 -04:00
Nuwan Yapa d3b2ec4dd8 Integration bug fixed 2025-04-07 19:38:23 -04:00
Nuwan Yapa a143edb496 Elegant method to attach two partitions 2025-04-07 19:24:42 -04:00
Nuwan Yapa 9f8cea12a3 Asymptotic boundary condition 2025-04-04 18:36:01 -04:00
Nuwan Yapa e470e3c804 Quick dependency fix 2025-03-12 19:13:22 -04:00
Nuwan Yapa 5680b7e489 Distinguish in-place functions 2025-02-25 16:37:07 -05:00
Nuwan Yapa 43e91bf78e struct spectrum 2025-02-25 16:12:36 -05:00
Nuwan Yapa 3a0cd0a26a Saving single particle spectrum in struct system 2025-02-24 20:10:28 -05:00
Nuwan Yapa f1553f548f Reorganize dependency structure 2025-02-21 10:55:11 -05:00
Nuwan Yapa a93056d173 Adjust tolerance 2025-02-19 14:14:51 -05:00
Nuwan Yapa df8ed2fe12 Implemented determinant and removed boundary value 2025-02-19 12:49:43 -05:00
Nuwan Yapa b8e82644a8 Some static typing 2025-02-18 19:18:00 -05:00
Nuwan Yapa 5fced75f41 Remove third-party root finding package in favor of bisection (implemented by AI) 2025-02-18 18:59:04 -05:00
Nuwan Yapa f49207fc42 Changed default E_min and E_max 2025-02-18 18:22:58 -05:00
Nuwan Yapa 459d35e08e Major optimization to the Dirac equation 2025-02-18 17:52:26 -05:00
Nuwan Yapa 6c219816ed Merge branch 'structs' 2025-02-18 17:11:54 -05:00
Nuwan Yapa b7dd47eab8 Fields and densities read off from s::system 2025-02-18 16:54:55 -05:00
Nuwan Yapa 63feefbd1b RK4 -> Tsit5 2025-02-17 19:33:47 -05:00
Nuwan Yapa 6850fdf351 All functions take s::system 2025-02-17 19:32:19 -05:00
Nuwan Yapa 95c1083693 RK4 -> Tsit5 2025-02-17 18:12:18 -05:00
Nuwan Yapa 27e8f3c8f5 Simple optimization 2025-02-17 14:46:58 -05:00
Nuwan Yapa fb06d56512 Parameters changed 2025-02-07 17:02:49 -05:00
Nuwan Yapa 5d9193e1a8 Slight interface change 2025-02-07 16:55:36 -05:00
Nuwan Yapa 9f1ed7cc6e Fix silly mistake 2025-02-04 16:56:48 -05:00
Nuwan Yapa 2ee76f2c1b Normalization fix 2025-02-04 14:08:30 -05:00
Nuwan Yapa 6722a917fe Fix the duplicated Es issue 2025-02-04 12:21:31 -05:00
Nuwan Yapa edc9c1537a Single particle energies matched with Hartree.f 2025-02-03 18:42:05 -05:00
Nuwan Yapa 88345aab2c Account for the 2x factor in B0 2025-02-03 16:52:15 -05:00
Nuwan Yapa 4007f2eac2 Fixed some units 2025-01-28 18:03:40 -05:00
Nuwan Yapa 77dcd1da7a Renaming 2025-01-28 12:34:43 -05:00