Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing the STA issue #205

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
10 changes: 8 additions & 2 deletions python/src/section/1/451.python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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(

Expand Down
7 changes: 4 additions & 3 deletions python/test/MF1/Test_ENDFtk_MF1_MT451_Section.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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,
Expand Down
9 changes: 7 additions & 2 deletions src/ENDFtk/section/1/451.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/ENDFtk/section/1/451/src/ctor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions src/ENDFtk/section/1/451/test/451.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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() );
Expand Down