diff --git a/src/particle/particle/particle.py b/src/particle/particle/particle.py index f41c7f9d..270f1d55 100644 --- a/src/particle/particle/particle.py +++ b/src/particle/particle/particle.py @@ -1117,7 +1117,11 @@ def from_nucleus_info( pdgid = int(1e9 + l_strange * 1e5 + z * 1e4 + a * 10 + i) if anti: - return cls.from_pdgid(-pdgid) + pdgid = -pdgid + + # replace nucleon ids of single hadrons with quark version + if pdgid in _PREFERRED_PDGID: + pdgid = _PREFERRED_PDGID[pdgid] return cls.from_pdgid(pdgid) diff --git a/tests/particle/test_particle.py b/tests/particle/test_particle.py index 97ea7c0a..5951d32d 100644 --- a/tests/particle/test_particle.py +++ b/tests/particle/test_particle.py @@ -171,6 +171,10 @@ def test_from_nucleus_info(): p = Particle.from_nucleus_info(1, 2, anti=True) assert p.pdgid == -1000010020 + # proton and neutron should return the preferred quark representation + assert Particle.from_nucleus_info(a=1, z=1).pdgid == 2212 + assert Particle.from_nucleus_info(a=1, z=0).pdgid == 2112 + def test_from_nucleus_info_ParticleNotFound(): with pytest.raises(ParticleNotFound):