From f993b13107bbce37d74c10681ae3337362152a0f Mon Sep 17 00:00:00 2001 From: Wim Haeck Date: Fri, 28 Jun 2024 10:24:51 -0600 Subject: [PATCH] Fixing the STA issue --- ReleaseNotes.md | 1 + python/src/section/1/451.python.cpp | 10 ++++++++-- python/test/MF1/Test_ENDFtk_MF1_MT451_Section.py | 7 ++++--- src/ENDFtk/section/1/451.hpp | 9 +++++++-- src/ENDFtk/section/1/451/src/ctor.hpp | 2 +- src/ENDFtk/section/1/451/test/451.test.cpp | 7 ++++--- 6 files changed, 25 insertions(+), 11 deletions(-) diff --git a/ReleaseNotes.md b/ReleaseNotes.md index 199fd160..b59626c9 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -7,6 +7,7 @@ This update removes the regions() and pairs() interface functions on the TAB1 re In addition, the following issues were corrected: - A minor bug in the rectangular matrix covariance block was corrected. The values for the row and column energies are lifted out of a larger array using the std::ranges::take and std::ranges::drop function. For the column energies, we forgot to properly end the sequence. As a result, the end() iterator of the range did not point to the end of the column energies but to the end of the covariance values, which is now corrected. - In MF8 MT457 DiscreteSpectrum, NT=8 (which can occur for electrons, i.e. STYP=8), was explicitly disallowed by ENDFtk. This was corrected and a new constructor reflecting this usage was added as well. + - The STA variable in MF1 MT451 was interpreted incorrectly and this has now been fixed. An additional isUnstable() function has been added to the interface. A few changes were also made to remove some range-v3 code in MF1 MT451. These changes have no impact on functionality. diff --git a/python/src/section/1/451.python.cpp b/python/src/section/1/451.python.cpp index 1143b529..fb789f1a 100644 --- a/python/src/section/1/451.python.cpp +++ b/python/src/section/1/451.python.cpp @@ -70,7 +70,7 @@ void wrapSection_1_451( python::module& module, python::module& viewmodule ) { " nlib the library type\n" " nmod the modification number\n" " elis the excitation energy\n" - " sta the stability flag\n" + " sta the stability flag (whether or not the nuclide is unstable)\n" " lis the excited level number\n" " liso the isomeric state number\n" " nfor the library format version number\n" @@ -151,11 +151,17 @@ void wrapSection_1_451( python::module& module, python::module& viewmodule ) { &Section::STA, "The stability flag" ) + .def_property_readonly( + + "is_unstable", + &Section::isUnstable, + "Flag to indicate whether or not the nuclide is unstable" + ) .def_property_readonly( "is_stable", &Section::isStable, - "The stability flag" + "Flag to indicate whether or not the nuclide is stable" ) .def_property_readonly( diff --git a/python/test/MF1/Test_ENDFtk_MF1_MT451_Section.py b/python/test/MF1/Test_ENDFtk_MF1_MT451_Section.py index ab0b0048..5835b424 100644 --- a/python/test/MF1/Test_ENDFtk_MF1_MT451_Section.py +++ b/python/test/MF1/Test_ENDFtk_MF1_MT451_Section.py @@ -15,7 +15,7 @@ class Test_ENDFtk_MF1_MT451_Section( unittest.TestCase ) : # randomly set to test if the correct value is extracted instead of using # ENDF legal values chunk = ( ' 1.001000+3 9.991673-1 1 2 3 4 125 1451 \n' - ' 5.000000+0 6.000000+0 7 8 0 12 125 1451 \n' + ' 5.000000+0 0.000000+0 7 8 0 12 125 1451 \n' ' 1.300000+1 1.400000+1 15 0 17 18 125 1451 \n' ' 1.900000+1 0.000000+0 21 0 9 10 125 1451 \n' ' 1-H - 1 LANL EVAL-JUL16 G.M.Hale 125 1451 \n' @@ -139,7 +139,8 @@ def verify_chunk( self, chunk ) : self.assertEqual( 4, chunk.modification_number ) self.assertAlmostEqual( 5.0, chunk.ELIS ) self.assertAlmostEqual( 5.0, chunk.excitation_energy ) - self.assertAlmostEqual( 6.0, chunk.STA ) + self.assertAlmostEqual( 0.0, chunk.STA ) + self.assertEqual( False, chunk.is_unstable ) self.assertEqual( True, chunk.is_stable ) self.assertEqual( 7, chunk.LIS ) self.assertEqual( 7, chunk.excited_level ) @@ -175,7 +176,7 @@ def verify_chunk( self, chunk ) : # the data is given explicitly chunk = Section( zaid = 1001, awr = 0.9991673, lrp = 1, lfi = 2, nlib = 3, nmod = 4, - elis = 5., sta = 6., lis = 7, + elis = 5., sta = 0., lis = 7, liso = 8, nfor = 12, awi = 13., emax = 14., lrel = 15, nsub = 17, nver = 18, temp = 19., ldrv = 21, diff --git a/src/ENDFtk/section/1/451.hpp b/src/ENDFtk/section/1/451.hpp index 0a5b43a8..ea9f3dbf 100644 --- a/src/ENDFtk/section/1/451.hpp +++ b/src/ENDFtk/section/1/451.hpp @@ -107,9 +107,14 @@ namespace section { double STA() const { return std::get< 0 >( this->parameters_ ).C2(); } /** - * @brief Return the stability flag + * @brief Return whether or not the nuclide is unstable + */ + bool isUnstable() const { return this->STA() == 1; } + + /** + * @brief Return whether or not the nuclide is stable */ - bool isStable() const { return this->STA(); } + bool isStable() const { return ! this->isUnstable(); } /** * @brief Return the excited level number diff --git a/src/ENDFtk/section/1/451/src/ctor.hpp b/src/ENDFtk/section/1/451/src/ctor.hpp index c21ee4a6..81019f8c 100644 --- a/src/ENDFtk/section/1/451/src/ctor.hpp +++ b/src/ENDFtk/section/1/451/src/ctor.hpp @@ -32,7 +32,7 @@ Type() = default; * @param[in] nlib the library type * @param[in] nmod the modification number * @param[in] elis the excitation energy - * @param[in] sta the stability flag + * @param[in] sta the stability flag (whether or not the nuclide is unstable) * @param[in] lis the excited level number * @param[in] liso the isomeric state number * @param[in] nfor the library format version number diff --git a/src/ENDFtk/section/1/451/test/451.test.cpp b/src/ENDFtk/section/1/451/test/451.test.cpp index 82387fdf..e81a2428 100644 --- a/src/ENDFtk/section/1/451/test/451.test.cpp +++ b/src/ENDFtk/section/1/451/test/451.test.cpp @@ -39,7 +39,7 @@ SCENARIO( "section::Type< 1, 451 >" ) { int nlib = 3; int nmod = 4; double elis = 5.; - double sta = 6.; + double sta = 0.; int lis = 7; int liso = 8; int nfor = 12; @@ -178,7 +178,7 @@ std::string chunk() { // ENDF legal values return " 1.001000+3 9.991673-1 1 2 3 4 125 1451 \n" - " 5.000000+0 6.000000+0 7 8 0 12 125 1451 \n" + " 5.000000+0 0.000000+0 7 8 0 12 125 1451 \n" " 1.300000+1 1.400000+1 15 0 17 18 125 1451 \n" " 1.900000+1 0.000000+0 21 0 9 10 125 1451 \n" " 1-H - 1 LANL EVAL-JUL16 G.M.Hale 125 1451 \n" @@ -220,7 +220,8 @@ void verifyChunk( const section::Type< 1, 451 >& chunk ) { CHECK( 4 == chunk.modificationNumber() ); CHECK_THAT( 5.0, WithinRel( chunk.ELIS() ) ); CHECK_THAT( 5.0, WithinRel( chunk.excitationEnergy() ) ); - CHECK_THAT( 6.0, WithinRel( chunk.STA() ) ); + CHECK_THAT( 0.0, WithinRel( chunk.STA() ) ); + CHECK( false == chunk.isUnstable() ); CHECK( true == chunk.isStable() ); CHECK( 7 == chunk.LIS() ); CHECK( 7 == chunk.excitedLevel() );