|
1 | 1 | from __future__ import annotations |
2 | 2 |
|
| 3 | +import contextlib |
3 | 4 | import logging |
4 | 5 | from abc import ABC |
5 | 6 | from typing import TYPE_CHECKING, Any, ClassVar, Literal, overload |
@@ -773,15 +774,17 @@ def quantum_numbers_to_angular_ket( |
773 | 774 | Optional, only needed for concrete angular matrix elements. |
774 | 775 |
|
775 | 776 | """ |
776 | | - if all(qn is None for qn in [j_c, f_c, j_r]): |
| 777 | + with contextlib.suppress(InvalidQuantumNumbersError, ValueError): |
777 | 778 | return AngularKetLS( |
778 | 779 | s_c=s_c, l_c=l_c, s_r=s_r, l_r=l_r, s_tot=s_tot, l_tot=l_tot, j_tot=j_tot, f_tot=f_tot, m=m, species=species |
779 | 780 | ) |
780 | | - if all(qn is None for qn in [s_tot, l_tot, f_c]): |
| 781 | + |
| 782 | + with contextlib.suppress(InvalidQuantumNumbersError, ValueError): |
781 | 783 | return AngularKetJJ( |
782 | 784 | s_c=s_c, l_c=l_c, j_c=j_c, s_r=s_r, l_r=l_r, j_r=j_r, j_tot=j_tot, f_tot=f_tot, m=m, species=species |
783 | 785 | ) |
784 | | - if all(qn is None for qn in [s_tot, l_tot, j_tot]): |
| 786 | + |
| 787 | + with contextlib.suppress(InvalidQuantumNumbersError, ValueError): |
785 | 788 | return AngularKetFJ( |
786 | 789 | s_c=s_c, l_c=l_c, j_c=j_c, f_c=f_c, s_r=s_r, l_r=l_r, j_r=j_r, f_tot=f_tot, m=m, species=species |
787 | 790 | ) |
|
0 commit comments