Skip to content

Implement pairing field implementations #2

Description

@danielpecak

Implement pairing field implementations from paper:
https://link.springer.com/article/10.1140/epja/s10050-025-01503-x#citeas

libnest/libnest/bsk.py

Lines 345 to 370 in ed1345f

# ================================
# Alternative interpolation schemes (delta_n, delta_p from delta_sm, delta_neu)
# ================================
# TODO(Adarsh): neutron_ref_pairing_field() / proton_ref_pairing_field() above
# implement one interpolation scheme (Formula 5.10 from NeST.pdf) for getting
# delta_n and delta_p from delta_sm (symmetric_pairing_field) and delta_neu
# (neutron_pairing_field). Add two more schemes here, following:
# https://link.springer.com/article/10.1140/epja/s10050-025-01503-x#citeas
def ref_pairing_field_eq2(rho_n, rho_p):
"""TODO(Adarsh): implement the interpolation scheme from Eq. (2) of
https://link.springer.com/article/10.1140/epja/s10050-025-01503-x#citeas
"""
raise NotImplementedError
def ref_pairing_field_eq3(rho_n, rho_p):
"""TODO(Adarsh): implement the interpolation scheme from Eq. (3) of
https://link.springer.com/article/10.1140/epja/s10050-025-01503-x#citeas
"""
raise NotImplementedError
def ref_pairing_field_eq6(rho_n, rho_p):
"""TODO(Adarsh): implement the interpolation scheme from Eq. (6) of
https://link.springer.com/article/10.1140/epja/s10050-025-01503-x#citeas
"""
raise NotImplementedError

And the tests for it:

libnest/tests/test_bsk.py

Lines 211 to 244 in dbc4f76

class TestAlternativePairingSchemes(unittest.TestCase):
"""Tests for the alternative delta_n/delta_p interpolation schemes
(bsk.ref_pairing_field_eq2/eq3/eq6), based on Eq. (2), (3) and (6) of
https://link.springer.com/article/10.1140/epja/s10050-025-01503-x#citeas
TODO(Adarsh): each scheme is currently a stub that raises
NotImplementedError (see bsk.py). As you implement a scheme, remove its
@unittest.skip decorator and fill in real assertions - e.g. following the
pattern in TestReferencePairingFields above:
- eta = 0 (rho_n == rho_p) should reduce to symmetric_pairing_field
- rho_p = 0 should reduce to neutron_pairing_field
- finite output for both scalar and array input
"""
@unittest.skip("TODO(Adarsh): implement ref_pairing_field_eq2 (Eq. 2)")
def test_ref_pairing_field_eq2(self):
rho_n, rho_p = 0.05, 0.05
ref = bsk.ref_pairing_field_eq2(rho_n, rho_p)
sym = bsk.symmetric_pairing_field(rho_n, rho_p)
self.assertAlmostEqual(float(ref), float(sym), places=6)
@unittest.skip("TODO(Adarsh): implement ref_pairing_field_eq3 (Eq. 3)")
def test_ref_pairing_field_eq3(self):
rho_n, rho_p = 0.05, 0.05
ref = bsk.ref_pairing_field_eq3(rho_n, rho_p)
sym = bsk.symmetric_pairing_field(rho_n, rho_p)
self.assertAlmostEqual(float(ref), float(sym), places=6)
@unittest.skip("TODO(Adarsh): implement ref_pairing_field_eq6 (Eq. 6)")
def test_ref_pairing_field_eq6(self):
rho_n, rho_p = 0.05, 0.05
ref = bsk.ref_pairing_field_eq6(rho_n, rho_p)
sym = bsk.symmetric_pairing_field(rho_n, rho_p)
self.assertAlmostEqual(float(ref), float(sym), places=6)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions