Skip to content

Commit ea7ff92

Browse files
authored
Merge pull request #205 from njoy/fix/mf1mt451-sta
Fixing the STA issue
2 parents ae6a077 + f993b13 commit ea7ff92

File tree

6 files changed

+25
-11
lines changed

6 files changed

+25
-11
lines changed

ReleaseNotes.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This update removes the regions() and pairs() interface functions on the TAB1 re
77
In addition, the following issues were corrected:
88
- 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.
99
- 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.
10+
- 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.
1011

1112
A few changes were also made to remove some range-v3 code in MF1 MT451. These changes have no impact on functionality.
1213

python/src/section/1/451.python.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ void wrapSection_1_451( python::module& module, python::module& viewmodule ) {
7070
" nlib the library type\n"
7171
" nmod the modification number\n"
7272
" elis the excitation energy\n"
73-
" sta the stability flag\n"
73+
" sta the stability flag (whether or not the nuclide is unstable)\n"
7474
" lis the excited level number\n"
7575
" liso the isomeric state number\n"
7676
" nfor the library format version number\n"
@@ -151,11 +151,17 @@ void wrapSection_1_451( python::module& module, python::module& viewmodule ) {
151151
&Section::STA,
152152
"The stability flag"
153153
)
154+
.def_property_readonly(
155+
156+
"is_unstable",
157+
&Section::isUnstable,
158+
"Flag to indicate whether or not the nuclide is unstable"
159+
)
154160
.def_property_readonly(
155161

156162
"is_stable",
157163
&Section::isStable,
158-
"The stability flag"
164+
"Flag to indicate whether or not the nuclide is stable"
159165
)
160166
.def_property_readonly(
161167

python/test/MF1/Test_ENDFtk_MF1_MT451_Section.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Test_ENDFtk_MF1_MT451_Section( unittest.TestCase ) :
1515
# randomly set to test if the correct value is extracted instead of using
1616
# ENDF legal values
1717
chunk = ( ' 1.001000+3 9.991673-1 1 2 3 4 125 1451 \n'
18-
' 5.000000+0 6.000000+0 7 8 0 12 125 1451 \n'
18+
' 5.000000+0 0.000000+0 7 8 0 12 125 1451 \n'
1919
' 1.300000+1 1.400000+1 15 0 17 18 125 1451 \n'
2020
' 1.900000+1 0.000000+0 21 0 9 10 125 1451 \n'
2121
' 1-H - 1 LANL EVAL-JUL16 G.M.Hale 125 1451 \n'
@@ -139,7 +139,8 @@ def verify_chunk( self, chunk ) :
139139
self.assertEqual( 4, chunk.modification_number )
140140
self.assertAlmostEqual( 5.0, chunk.ELIS )
141141
self.assertAlmostEqual( 5.0, chunk.excitation_energy )
142-
self.assertAlmostEqual( 6.0, chunk.STA )
142+
self.assertAlmostEqual( 0.0, chunk.STA )
143+
self.assertEqual( False, chunk.is_unstable )
143144
self.assertEqual( True, chunk.is_stable )
144145
self.assertEqual( 7, chunk.LIS )
145146
self.assertEqual( 7, chunk.excited_level )
@@ -175,7 +176,7 @@ def verify_chunk( self, chunk ) :
175176
# the data is given explicitly
176177
chunk = Section( zaid = 1001, awr = 0.9991673, lrp = 1,
177178
lfi = 2, nlib = 3, nmod = 4,
178-
elis = 5., sta = 6., lis = 7,
179+
elis = 5., sta = 0., lis = 7,
179180
liso = 8, nfor = 12, awi = 13.,
180181
emax = 14., lrel = 15, nsub = 17,
181182
nver = 18, temp = 19., ldrv = 21,

src/ENDFtk/section/1/451.hpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,14 @@ namespace section {
107107
double STA() const { return std::get< 0 >( this->parameters_ ).C2(); }
108108

109109
/**
110-
* @brief Return the stability flag
110+
* @brief Return whether or not the nuclide is unstable
111+
*/
112+
bool isUnstable() const { return this->STA() == 1; }
113+
114+
/**
115+
* @brief Return whether or not the nuclide is stable
111116
*/
112-
bool isStable() const { return this->STA(); }
117+
bool isStable() const { return ! this->isUnstable(); }
113118

114119
/**
115120
* @brief Return the excited level number

src/ENDFtk/section/1/451/src/ctor.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Type() = default;
3232
* @param[in] nlib the library type
3333
* @param[in] nmod the modification number
3434
* @param[in] elis the excitation energy
35-
* @param[in] sta the stability flag
35+
* @param[in] sta the stability flag (whether or not the nuclide is unstable)
3636
* @param[in] lis the excited level number
3737
* @param[in] liso the isomeric state number
3838
* @param[in] nfor the library format version number

src/ENDFtk/section/1/451/test/451.test.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ SCENARIO( "section::Type< 1, 451 >" ) {
3939
int nlib = 3;
4040
int nmod = 4;
4141
double elis = 5.;
42-
double sta = 6.;
42+
double sta = 0.;
4343
int lis = 7;
4444
int liso = 8;
4545
int nfor = 12;
@@ -178,7 +178,7 @@ std::string chunk() {
178178
// ENDF legal values
179179
return
180180
" 1.001000+3 9.991673-1 1 2 3 4 125 1451 \n"
181-
" 5.000000+0 6.000000+0 7 8 0 12 125 1451 \n"
181+
" 5.000000+0 0.000000+0 7 8 0 12 125 1451 \n"
182182
" 1.300000+1 1.400000+1 15 0 17 18 125 1451 \n"
183183
" 1.900000+1 0.000000+0 21 0 9 10 125 1451 \n"
184184
" 1-H - 1 LANL EVAL-JUL16 G.M.Hale 125 1451 \n"
@@ -220,7 +220,8 @@ void verifyChunk( const section::Type< 1, 451 >& chunk ) {
220220
CHECK( 4 == chunk.modificationNumber() );
221221
CHECK_THAT( 5.0, WithinRel( chunk.ELIS() ) );
222222
CHECK_THAT( 5.0, WithinRel( chunk.excitationEnergy() ) );
223-
CHECK_THAT( 6.0, WithinRel( chunk.STA() ) );
223+
CHECK_THAT( 0.0, WithinRel( chunk.STA() ) );
224+
CHECK( false == chunk.isUnstable() );
224225
CHECK( true == chunk.isStable() );
225226
CHECK( 7 == chunk.LIS() );
226227
CHECK( 7 == chunk.excitedLevel() );

0 commit comments

Comments
 (0)