Skip to content

Commit 0b9e1ee

Browse files
committed
Merge branch 'feature/resonances-part11' into 'develop'
Feature/resonances part11 See merge request njoy/dryad!87
2 parents b819db0 + b8542d7 commit 0b9e1ee

28 files changed

+4458
-57
lines changed

cmake/unit_testing.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ add_cpp_test( resonances.TabulatedWaveFunction resonan
6969
add_cpp_test( resonances.Channel resonances/Channel.test.cpp )
7070
add_cpp_test( resonances.ResonanceTable resonances/ResonanceTable.test.cpp )
7171
add_cpp_test( resonances.SpinGroup resonances/SpinGroup.test.cpp )
72+
add_cpp_test( resonances.CompoundSystem resonances/CompoundSystem.test.cpp )
7273

7374
add_cpp_test( Documentation Documentation.test.cpp )
7475

@@ -137,6 +138,7 @@ add_cpp_test( format.endf.resonances.lrf7.createReactionIdentifiers format/
137138
add_cpp_test( format.endf.resonances.lrf7.createParticlePairs format/endf/resonances/lrf7/createParticlePairs.test.cpp )
138139
add_cpp_test( format.endf.resonances.lrf7.createChannels format/endf/resonances/lrf7/createChannels.test.cpp )
139140
add_cpp_test( format.endf.resonances.lrf7.createSpinGroups format/endf/resonances/lrf7/createSpinGroups.test.cpp )
141+
add_cpp_test( format.endf.resonances.lrf7.createCompoundSystem format/endf/resonances/lrf7/createCompoundSystem.test.cpp )
140142
add_cpp_test( format.endf.atomic.createElectronSubshellID format/endf/atomic/createElectronSubshellID.test.cpp )
141143
add_cpp_test( format.endf.atomic.createElectronSubshellConfiguration format/endf/atomic/createElectronSubshellConfiguration.test.cpp )
142144
add_cpp_test( format.endf.covariance.createMatrix format/endf/covariance/createMatrix.test.cpp )

cmake/unit_testing_python.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ add_python_test( resonances.CoulombPhaseShiftDifference resonances/Test_dryad_r
6262
add_python_test( resonances.TabulatedWaveFunction resonances/Test_dryad_resonances_TabulatedWaveFunction.py )
6363
add_python_test( resonances.Channel resonances/Test_dryad_resonances_Channel.py )
6464
add_python_test( resonances.ResonanceTable resonances/Test_dryad_resonances_ResonanceTable.py )
65+
add_python_test( resonances.SpinGroup resonances/Test_dryad_resonances_SpinGroup.py )
66+
add_python_test( resonances.CompoundSystem resonances/Test_dryad_resonances_CompoundSystem.py )
6567

6668
add_python_test( Documentation Test_dryad_Documentation.py )
6769

python/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ if(dryad.python)
3838
${CMAKE_CURRENT_SOURCE_DIR}/src/resonances/TabulatedWaveFunction.python.cpp
3939
${CMAKE_CURRENT_SOURCE_DIR}/src/resonances/Channel.python.cpp
4040
${CMAKE_CURRENT_SOURCE_DIR}/src/resonances/ResonanceTable.python.cpp
41+
${CMAKE_CURRENT_SOURCE_DIR}/src/resonances/SpinGroup.python.cpp
42+
${CMAKE_CURRENT_SOURCE_DIR}/src/resonances/CompoundSystem.python.cpp
4143
${CMAKE_CURRENT_SOURCE_DIR}/src/covariance.python.cpp
4244
${CMAKE_CURRENT_SOURCE_DIR}/src/covariance/ScalingType.python.cpp
4345
${CMAKE_CURRENT_SOURCE_DIR}/src/covariance/VarianceScaling.python.cpp

python/src/resonances.python.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ namespace resonances {
2929
void wrapTabulatedWaveFunction( python::module& );
3030
void wrapChannel( python::module& );
3131
void wrapResonanceTable( python::module& );
32+
void wrapSpinGroup( python::module& );
33+
void wrapCompoundSystem( python::module& );
3234

3335
void wrapResonanceParameters( python::module& );
3436
}
@@ -62,6 +64,8 @@ void wrapResonances( python::module& module ) {
6264
resonances::wrapTabulatedWaveFunction( submodule );
6365
resonances::wrapChannel( submodule );
6466
resonances::wrapResonanceTable( submodule );
67+
resonances::wrapSpinGroup( submodule );
68+
resonances::wrapCompoundSystem( submodule );
6569

6670
resonances::wrapResonanceParameters( submodule );
6771
}

python/src/resonances/BoundaryCondition.python.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void wrapBoundaryCondition( python::module& module ) {
2828

2929
// wrap the component
3030
component
31-
.value( "EliminateShift", Component::EliminateShift )
31+
.value( "ShiftFactor", Component::ShiftFactor )
3232
.value( "Constant", Component::Constant );
3333
}
3434

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// system includes
2+
#include <pybind11/pybind11.h>
3+
#include <pybind11/stl.h>
4+
5+
// local includes
6+
#include "definitions.hpp"
7+
#include "dryad/resonances/CompoundSystem.hpp"
8+
9+
// namespace aliases
10+
namespace python = pybind11;
11+
12+
namespace resonances {
13+
14+
void wrapCompoundSystem( python::module& module ) {
15+
16+
// type aliases
17+
using Component = njoy::dryad::resonances::CompoundSystem;
18+
using SpinGroup = njoy::dryad::resonances::SpinGroup;
19+
20+
// wrap views created by this component
21+
22+
// create the component
23+
python::class_< Component > component(
24+
25+
module,
26+
"CompoundSystem",
27+
"The compound nucleus system"
28+
);
29+
30+
// wrap the component
31+
component
32+
.def(
33+
34+
python::init< std::vector< SpinGroup > >(),
35+
python::arg( "spin_groups" ),
36+
"Initialise the spin group\n\n"
37+
"Arguments:\n"
38+
" self the compound system\n"
39+
" spin_groups the spin groups that make up the compound system"
40+
)
41+
.def(
42+
43+
python::init< const Component& >(),
44+
python::arg( "instance" ),
45+
"Initialise a copy\n\n"
46+
"Arguments:\n"
47+
" instance the instance to be copied\n"
48+
)
49+
.def_property(
50+
51+
"spin_groups",
52+
python::overload_cast<>( &Component::spinGroups, python::const_ ),
53+
python::overload_cast< std::vector< SpinGroup > >( &Component::spinGroups ),
54+
"The spin groups that make up the compound system"
55+
);
56+
57+
// add standard comparison definitions
58+
addStandardEqualityComparisonDefinitions< Component >( component );
59+
}
60+
61+
} // resonances namespace
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
// system includes
2+
#include <pybind11/pybind11.h>
3+
#include <pybind11/stl.h>
4+
5+
// local includes
6+
#include "definitions.hpp"
7+
#include "dryad/resonances/SpinGroup.hpp"
8+
9+
// namespace aliases
10+
namespace python = pybind11;
11+
12+
namespace resonances {
13+
14+
void wrapSpinGroup( python::module& module ) {
15+
16+
// type aliases
17+
using Component = njoy::dryad::resonances::SpinGroup;
18+
using ChannelData = njoy::dryad::resonances::SpinGroup::ChannelData;
19+
using Channel = njoy::dryad::resonances::Channel;
20+
using ResonanceTable = njoy::dryad::resonances::ResonanceTable;
21+
22+
// wrap views created by this component
23+
24+
// create the component
25+
python::class_< Component > component(
26+
27+
module,
28+
"SpinGroup",
29+
"A spin group corresponding to a Jpi quantum number set"
30+
);
31+
32+
// wrap the component
33+
component
34+
.def(
35+
36+
python::init< std::vector< Channel >, ResonanceTable >(),
37+
python::arg( "channels" ), python::arg( "resonances" ),
38+
"Initialise the spin group\n\n"
39+
"Arguments:\n"
40+
" self the spin group\n"
41+
" channels the channels in the spingroup\n"
42+
" resonances the resonance table of the spingroup"
43+
)
44+
.def(
45+
46+
python::init< std::vector< ChannelData > >(),
47+
python::arg( "channels" ),
48+
"Initialise the spin group\n\n"
49+
"Arguments:\n"
50+
" self the spin group\n"
51+
" channels the channel data in the spingroup"
52+
)
53+
.def(
54+
55+
python::init< const Component& >(),
56+
python::arg( "instance" ),
57+
"Initialise a copy\n\n"
58+
"Arguments:\n"
59+
" instance the instance to be copied\n"
60+
)
61+
.def_property(
62+
63+
"channels",
64+
python::overload_cast<>( &Component::channels, python::const_ ),
65+
python::overload_cast< std::vector< Channel > >( &Component::channels ),
66+
"The channels in the spin group"
67+
)
68+
.def_property(
69+
70+
"resonance_table",
71+
python::overload_cast<>( &Component::resonanceTable, python::const_ ),
72+
python::overload_cast< ResonanceTable >( &Component::resonanceTable ),
73+
"The resonance table of the spin group"
74+
)
75+
.def_property_readonly(
76+
77+
"total_angular_momentum",
78+
&Component::totalAngularMomentum,
79+
"The total angular momentum J of the channels"
80+
)
81+
.def_property_readonly(
82+
83+
"parity",
84+
&Component::parity,
85+
"The parity"
86+
)
87+
.def_property_readonly(
88+
89+
"reactions",
90+
python::overload_cast<>( &Component::reactions, python::const_ ),
91+
"The reactions to which this spin group contributes"
92+
);
93+
94+
// add standard comparison definitions
95+
addStandardEqualityComparisonDefinitions< Component >( component );
96+
}
97+
98+
} // resonances namespace

python/stubs/dryad/resonances.pyi

Lines changed: 105 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ from __future__ import annotations
55
import dryad
66
import dryad.id
77
import typing
8-
__all__ = ['BoundaryCondition', 'Channel', 'ChannelQuantumNumbers', 'ChannelRadii', 'CoulombPenetrability', 'CoulombPhaseShift', 'CoulombPhaseShiftDifference', 'CoulombShiftFactor', 'Formalism', 'HardSpherePenetrability', 'HardSpherePhaseShift', 'HardSphereShiftFactor', 'Particle', 'ParticlePair', 'ResonanceParameters', 'ResonanceTable', 'TabulatedRadius', 'TabulatedWaveFunction']
8+
__all__ = ['BoundaryCondition', 'Channel', 'ChannelQuantumNumbers', 'ChannelRadii', 'CompoundSystem', 'CoulombPenetrability', 'CoulombPhaseShift', 'CoulombPhaseShiftDifference', 'CoulombShiftFactor', 'Formalism', 'HardSpherePenetrability', 'HardSpherePhaseShift', 'HardSphereShiftFactor', 'Particle', 'ParticlePair', 'ResonanceParameters', 'ResonanceTable', 'SpinGroup', 'TabulatedRadius', 'TabulatedWaveFunction']
99
class BoundaryCondition:
1010
"""
1111
The boundary condition options
1212
1313
Members:
1414
15-
EliminateShift
15+
ShiftFactor
1616
1717
Constant
1818
"""
1919
Constant: typing.ClassVar[BoundaryCondition] # value = <BoundaryCondition.Constant: 2>
20-
EliminateShift: typing.ClassVar[BoundaryCondition] # value = <BoundaryCondition.EliminateShift: 1>
21-
__members__: typing.ClassVar[dict[str, BoundaryCondition]] # value = {'EliminateShift': <BoundaryCondition.EliminateShift: 1>, 'Constant': <BoundaryCondition.Constant: 2>}
20+
ShiftFactor: typing.ClassVar[BoundaryCondition] # value = <BoundaryCondition.ShiftFactor: 1>
21+
__members__: typing.ClassVar[dict[str, BoundaryCondition]] # value = {'ShiftFactor': <BoundaryCondition.ShiftFactor: 1>, 'Constant': <BoundaryCondition.Constant: 2>}
2222
def __eq__(self, other: typing.Any) -> bool:
2323
...
2424
def __ge__(self, other: typing.Any) -> bool:
@@ -467,6 +467,40 @@ class ChannelRadii:
467467
@shift_factor_radius.setter
468468
def shift_factor_radius(self, arg1: float | TabulatedRadius | None) -> None:
469469
...
470+
class CompoundSystem:
471+
"""
472+
The compound nucleus system
473+
"""
474+
__hash__: typing.ClassVar[None] = None
475+
def __eq__(self, arg0: CompoundSystem) -> bool:
476+
...
477+
@typing.overload
478+
def __init__(self, spin_groups: list[SpinGroup]) -> None:
479+
"""
480+
Initialise the spin group
481+
482+
Arguments:
483+
self the compound system
484+
spin_groups the spin groups that make up the compound system
485+
"""
486+
@typing.overload
487+
def __init__(self, instance: CompoundSystem) -> None:
488+
"""
489+
Initialise a copy
490+
491+
Arguments:
492+
instance the instance to be copied
493+
"""
494+
def __ne__(self, arg0: CompoundSystem) -> bool:
495+
...
496+
@property
497+
def spin_groups(self) -> list[SpinGroup]:
498+
"""
499+
The spin groups that make up the compound system
500+
"""
501+
@spin_groups.setter
502+
def spin_groups(self, arg1: list[SpinGroup]) -> None:
503+
...
470504
class CoulombPenetrability:
471505
"""
472506
Coulomb penetrability functions
@@ -1018,6 +1052,73 @@ class ResonanceTable:
10181052
"""
10191053
The reduced width amplitudes
10201054
"""
1055+
class SpinGroup:
1056+
"""
1057+
A spin group corresponding to a Jpi quantum number set
1058+
"""
1059+
__hash__: typing.ClassVar[None] = None
1060+
def __eq__(self, arg0: SpinGroup) -> bool:
1061+
...
1062+
@typing.overload
1063+
def __init__(self, channels: list[Channel], resonances: ResonanceTable) -> None:
1064+
"""
1065+
Initialise the spin group
1066+
1067+
Arguments:
1068+
self the spin group
1069+
channels the channels in the spingroup
1070+
resonances the resonance table of the spingroup
1071+
"""
1072+
@typing.overload
1073+
def __init__(self, channels: list[tuple[Channel, ResonanceTable]]) -> None:
1074+
"""
1075+
Initialise the spin group
1076+
1077+
Arguments:
1078+
self the spin group
1079+
channels the channel data in the spingroup
1080+
"""
1081+
@typing.overload
1082+
def __init__(self, instance: SpinGroup) -> None:
1083+
"""
1084+
Initialise a copy
1085+
1086+
Arguments:
1087+
instance the instance to be copied
1088+
"""
1089+
def __ne__(self, arg0: SpinGroup) -> bool:
1090+
...
1091+
@property
1092+
def channels(self) -> list[Channel]:
1093+
"""
1094+
The channels in the spin group
1095+
"""
1096+
@channels.setter
1097+
def channels(self, arg1: list[Channel]) -> None:
1098+
...
1099+
@property
1100+
def parity(self) -> int:
1101+
"""
1102+
The parity
1103+
"""
1104+
@property
1105+
def reactions(self) -> list[dryad.id.ReactionID]:
1106+
"""
1107+
The reactions to which this spin group contributes
1108+
"""
1109+
@property
1110+
def resonance_table(self) -> ResonanceTable:
1111+
"""
1112+
The resonance table of the spin group
1113+
"""
1114+
@resonance_table.setter
1115+
def resonance_table(self, arg1: ResonanceTable) -> None:
1116+
...
1117+
@property
1118+
def total_angular_momentum(self) -> float:
1119+
"""
1120+
The total angular momentum J of the channels
1121+
"""
10211122
class TabulatedRadius:
10221123
"""
10231124
A radius table

0 commit comments

Comments
 (0)