From b09fb674ca6c7f66ad72b3537e5535d239c5b1d6 Mon Sep 17 00:00:00 2001 From: Christian Hill Date: Wed, 16 Aug 2023 19:42:00 +0200 Subject: [PATCH] Fix bug in Moore labelling of atomic states --- setup.py | 2 +- src/pyvalem/states/atomic_term_symbol.py | 6 +++--- tests/test_atomic_term_symbols.py | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index f9b8168..31010c2 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setup( name="pyvalem", - version="2.5.14", + version="2.5.15", description="A package for managing simple chemical species and states", long_description=long_description, long_description_content_type="text/x-rst", diff --git a/src/pyvalem/states/atomic_term_symbol.py b/src/pyvalem/states/atomic_term_symbol.py index ba6367c..761dfe9 100644 --- a/src/pyvalem/states/atomic_term_symbol.py +++ b/src/pyvalem/states/atomic_term_symbol.py @@ -47,7 +47,7 @@ def __init__(self, state_str): self.L = None self.parity = None self.J = None - self.moore_letter = "" + self.moore_label = "" self._parse_state(state_str) def _parse_state(self, state_str): @@ -87,7 +87,7 @@ def _validate_j(self): def html(self): html_chunks = [ "{0}{1:d}{2:s}".format( - self.moore_letter, self.Smult, self.Lletter + self.moore_label, self.Smult, self.Lletter ) ] if self.parity: @@ -101,7 +101,7 @@ def html(self): def latex(self): latex_chunks = [ r"{}{{}}^{{{}}}\mathrm{{{}}}".format( - self.moore_letter, self.Smult, self.Lletter + self.moore_label, self.Smult, self.Lletter ) ] if self.parity: diff --git a/tests/test_atomic_term_symbols.py b/tests/test_atomic_term_symbols.py index bb3728a..7c7e0b7 100644 --- a/tests/test_atomic_term_symbols.py +++ b/tests/test_atomic_term_symbols.py @@ -60,6 +60,9 @@ def test_moore_label(self): self.assertEqual(a1.moore_label, "z") self.assertEqual(a2.moore_label, "") self.assertEqual(a3.moore_label, "e") + self.assertEqual(a0.html, "a5D") + self.assertEqual(a0.latex, r"a{}^{5}\mathrm{D}") + self.assertEqual(a1.latex, r"z{}^{3}\mathrm{P}^o") self.assertRaises(AtomicTermSymbolError, AtomicTermSymbol, "A5D")