From b3c07acb4de85f529730b29cdd469a05233541a8 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Fri, 19 Jan 2024 16:56:39 +0000 Subject: [PATCH] using existing import --- openmc/deplete/chain.py | 169 ++++++++++++++++++++-------------------- openmc/plotter.py | 5 +- 2 files changed, 86 insertions(+), 88 deletions(-) diff --git a/openmc/deplete/chain.py b/openmc/deplete/chain.py index 7bfac5925a2..e98cf690630 100644 --- a/openmc/deplete/chain.py +++ b/openmc/deplete/chain.py @@ -25,97 +25,96 @@ import openmc.data from openmc._xml import clean_indentation from .nuclide import Nuclide, DecayTuple, ReactionTuple -from openmc.data import DADZ # tuple of (possible MT values, (dA, dZ), secondaries) where dA is the change in # the mass number and dZ is the change in the atomic number ReactionInfo = namedtuple('ReactionInfo', ('mts', 'dadz', 'secondaries')) REACTIONS = { - '(n,2nd)': ReactionInfo({11}, DADZ('(n,2nd)'), ('H2',)), - '(n,2n)': ReactionInfo(set(chain([16], range(875, 892))), (-1, 0), ()), - '(n,3n)': ReactionInfo({17}, DADZ('(n,3n)'), ()), - '(n,na)': ReactionInfo({22}, DADZ('(n,na)'), ('He4',)), - '(n,n3a)': ReactionInfo({23}, DADZ('(n,n3a)'), ('He4', 'He4', 'He4')), - '(n,2na)': ReactionInfo({24}, DADZ('(n,2na)'), ('He4',)), - '(n,3na)': ReactionInfo({25}, DADZ('(n,3na)'), ('He4',)), - '(n,np)': ReactionInfo({28}, DADZ('(n,np)'), ('H1',)), - '(n,n2a)': ReactionInfo({29}, DADZ('(n,n2a)'), ('He4', 'He4')), - '(n,2n2a)': ReactionInfo({30}, DADZ('(n,2n2a)'), ('He4', 'He4')), - '(n,nd)': ReactionInfo({32}, DADZ('(n,nd)'), ('H2',)), - '(n,nt)': ReactionInfo({33}, DADZ('(n,nt)'), ('H3',)), - '(n,n3He)': ReactionInfo({34}, DADZ('(n,n3He)'), ('He3',)), - '(n,nd2a)': ReactionInfo({35}, DADZ('(n,nd2a)'), ('H2', 'He4', 'He4')), - '(n,nt2a)': ReactionInfo({36}, DADZ('(n,nt2a)'), ('H3', 'He4', 'He4')), - '(n,4n)': ReactionInfo({37}, DADZ('(n,4n)'), ()), - '(n,2np)': ReactionInfo({41}, DADZ('(n,2np)'), ('H1',)), - '(n,3np)': ReactionInfo({42}, DADZ('(n,3np)'), ('H1',)), - '(n,n2p)': ReactionInfo({44}, DADZ('(n,n2p)'), ('H1', 'H1')), - '(n,npa)': ReactionInfo({45}, DADZ('(n,npa)'), ('H1', 'He4')), - '(n,gamma)': ReactionInfo({102}, DADZ('(n,gamma)')()), - '(n,p)': ReactionInfo(set(chain([103], range(600, 650))), (0, -1), ('H1',)), - '(n,d)': ReactionInfo(set(chain([104], range(650, 700))), (-1, -1), ('H2',)), - '(n,t)': ReactionInfo(set(chain([105], range(700, 750))), (-2, -1), ('H3',)), - '(n,3He)': ReactionInfo(set(chain([106], range(750, 800))), (-2, -2), ('He3',)), - '(n,a)': ReactionInfo(set(chain([107], range(800, 850))), (-3, -2), ('He4',)), - '(n,2a)': ReactionInfo({108}, DADZ('(n,2a)'), ('He4', 'He4')), - '(n,3a)': ReactionInfo({109}, DADZ('(n,3a)'), ('He4', 'He4', 'He4')), - '(n,2p)': ReactionInfo({111}, DADZ('(n,2p)'), ('H1', 'H1')), - '(n,pa)': ReactionInfo({112}, DADZ('(n,pa)'), ('H1', 'He4')), - '(n,t2a)': ReactionInfo({113}, DADZ('(n,t2a)'), ('H3', 'He4', 'He4')), - '(n,d2a)': ReactionInfo({114}, DADZ('(n,d2a)'), ('H2', 'He4', 'He4')), - '(n,pd)': ReactionInfo({115}, DADZ('(n,pd)'), ('H1', 'H2')), - '(n,pt)': ReactionInfo({116}, DADZ('(n,pt)'), ('H1', 'H3')), - '(n,da)': ReactionInfo({117}, DADZ('(n,da)'), ('H2', 'He4')), - '(n,5n)': ReactionInfo({152}, DADZ('(n,5n)'), ()), - '(n,6n)': ReactionInfo({153}, DADZ('(n,6n)'), ()), - '(n,2nt)': ReactionInfo({154}, DADZ('(n,2nt)'), ('H3',)), - '(n,ta)': ReactionInfo({155}, DADZ('(n,ta)'), ('H3', 'He4')), - '(n,4np)': ReactionInfo({156}, DADZ('(n,4np)'), ('H1',)), - '(n,3nd)': ReactionInfo({157}, DADZ('(n,3nd)'), ('H2',)), - '(n,nda)': ReactionInfo({158}, DADZ('(n,nda)'), ('H2', 'He4')), - '(n,2npa)': ReactionInfo({159}, DADZ('(n,2npa)'), ('H1', 'He4')), - '(n,7n)': ReactionInfo({160}, DADZ('(n,7n)'), ()), - '(n,8n)': ReactionInfo({161}, DADZ('(n,8n)'), ()), - '(n,5np)': ReactionInfo({162}, DADZ('(n,5np)'), ('H1',)), - '(n,6np)': ReactionInfo({163}, DADZ('(n,6np)'), ('H1',)), - '(n,7np)': ReactionInfo({164}, DADZ('(n,7np)'), ('H1',)), - '(n,4na)': ReactionInfo({165}, DADZ('(n,4na)'), ('He4',)), - '(n,5na)': ReactionInfo({166}, DADZ('(n,5na)'), ('He4',)), - '(n,6na)': ReactionInfo({167}, DADZ('(n,6na)'), ('He4',)), - '(n,7na)': ReactionInfo({168}, DADZ('(n,7na)'), ('He4',)), - '(n,4nd)': ReactionInfo({169}, DADZ('(n,4nd)'), ('H2',)), - '(n,5nd)': ReactionInfo({170}, DADZ('(n,5nd)'), ('H2',)), - '(n,6nd)': ReactionInfo({171}, DADZ('(n,6nd)'), ('H2',)), - '(n,3nt)': ReactionInfo({172}, DADZ('(n,3nt)'), ('H3',)), - '(n,4nt)': ReactionInfo({173}, DADZ('(n,4nt)'), ('H3',)), - '(n,5nt)': ReactionInfo({174}, DADZ('(n,5nt)'), ('H3',)), - '(n,6nt)': ReactionInfo({175}, DADZ('(n,6nt)'), ('H3',)), - '(n,2n3He)': ReactionInfo({176}, DADZ('(n,2n3He)'), ('He3',)), - '(n,3n3He)': ReactionInfo({177}, DADZ('(n,3n3He)'), ('He3',)), - '(n,4n3He)': ReactionInfo({178}, DADZ('(n,4n3He)'), ('He3',)), - '(n,3n2p)': ReactionInfo({179}, DADZ('(n,3n2p)'), ('H1', 'H1')), - '(n,3n2a)': ReactionInfo({180}, DADZ('(n,3n2a)'), ('He4', 'He4')), - '(n,3npa)': ReactionInfo({181}, DADZ('(n,3npa)'), ('H1', 'He4')), - '(n,dt)': ReactionInfo({182}, DADZ('(n,dt)'), ('H2', 'H3')), - '(n,npd)': ReactionInfo({183}, DADZ('(n,npd)'), ('H1', 'H2')), - '(n,npt)': ReactionInfo({184}, DADZ('(n,npt)'), ('H1', 'H3')), - '(n,ndt)': ReactionInfo({185}, DADZ('(n,ndt)'), ('H2', 'H3')), - '(n,np3He)': ReactionInfo({186}, DADZ('(n,np3He)'), ('H1', 'He3')), - '(n,nd3He)': ReactionInfo({187}, DADZ('(n,nd3He)'), ('H2', 'He3')), - '(n,nt3He)': ReactionInfo({188}, DADZ('(n,nt3He)'), ('H3', 'He3')), - '(n,nta)': ReactionInfo({189}, DADZ('(n,nta)'), ('H3', 'He4')), - '(n,2n2p)': ReactionInfo({190}, DADZ('(n,2n2p)'), ('H1', 'H1')), - '(n,p3He)': ReactionInfo({191}, DADZ('(n,p3He)'), ('H1', 'He3')), - '(n,d3He)': ReactionInfo({192}, DADZ('(n,d3He)'), ('H2', 'He3')), - '(n,3Hea)': ReactionInfo({193}, DADZ('(n,3Hea)'), ('He3', 'He4')), - '(n,4n2p)': ReactionInfo({194}, DADZ('(n,4n2p)'), ('H1', 'H1')), - '(n,4n2a)': ReactionInfo({195}, DADZ('(n,4n2a)'), ('He4', 'He4')), - '(n,4npa)': ReactionInfo({196}, DADZ('(n,4npa)'), ('H1', 'He4')), - '(n,3p)': ReactionInfo({197}, DADZ('(n,3p)'), ('H1', 'H1', 'H1')), - '(n,n3p)': ReactionInfo({198}, DADZ('(n,n3p)'), ('H1', 'H1', 'H1')), - '(n,3n2pa)': ReactionInfo({199}, DADZ('(n,3n2pa)'), ('H1', 'H1', 'He4')), - '(n,5n2p)': ReactionInfo({200}, DADZ('(n,5n2p)'), ('H1', 'H1')), + '(n,2nd)': ReactionInfo({11}, openmc.data.DADZ('(n,2nd)'), ('H2',)), + '(n,2n)': ReactionInfo(set(chain([16], range(875, 892))), openmc.data.DADZ('(n,2n)'), ()), + '(n,3n)': ReactionInfo({17}, openmc.data.DADZ('(n,3n)'), ()), + '(n,na)': ReactionInfo({22}, openmc.data.DADZ('(n,na)'), ('He4',)), + '(n,n3a)': ReactionInfo({23}, openmc.data.DADZ('(n,n3a)'), ('He4', 'He4', 'He4')), + '(n,2na)': ReactionInfo({24}, openmc.data.DADZ('(n,2na)'), ('He4',)), + '(n,3na)': ReactionInfo({25}, openmc.data.DADZ('(n,3na)'), ('He4',)), + '(n,np)': ReactionInfo({28}, openmc.data.DADZ('(n,np)'), ('H1',)), + '(n,n2a)': ReactionInfo({29}, openmc.data.DADZ('(n,n2a)'), ('He4', 'He4')), + '(n,2n2a)': ReactionInfo({30}, openmc.data.DADZ('(n,2n2a)'), ('He4', 'He4')), + '(n,nd)': ReactionInfo({32}, openmc.data.DADZ('(n,nd)'), ('H2',)), + '(n,nt)': ReactionInfo({33}, openmc.data.DADZ('(n,nt)'), ('H3',)), + '(n,n3He)': ReactionInfo({34}, openmc.data.DADZ('(n,n3He)'), ('He3',)), + '(n,nd2a)': ReactionInfo({35}, openmc.data.DADZ('(n,nd2a)'), ('H2', 'He4', 'He4')), + '(n,nt2a)': ReactionInfo({36}, openmc.data.DADZ('(n,nt2a)'), ('H3', 'He4', 'He4')), + '(n,4n)': ReactionInfo({37}, openmc.data.DADZ('(n,4n)'), ()), + '(n,2np)': ReactionInfo({41}, openmc.data.DADZ('(n,2np)'), ('H1',)), + '(n,3np)': ReactionInfo({42}, openmc.data.DADZ('(n,3np)'), ('H1',)), + '(n,n2p)': ReactionInfo({44}, openmc.data.DADZ('(n,n2p)'), ('H1', 'H1')), + '(n,npa)': ReactionInfo({45}, openmc.data.DADZ('(n,npa)'), ('H1', 'He4')), + '(n,gamma)': ReactionInfo({102}, openmc.data.DADZ('(n,gamma)')()), + '(n,p)': ReactionInfo(set(chain([103], range(600, 650))), openmc.data.DADZ('(n,p)'), ('H1',)), + '(n,d)': ReactionInfo(set(chain([104], range(650, 700))), openmc.data.DADZ('(n,d)'), ('H2',)), + '(n,t)': ReactionInfo(set(chain([105], range(700, 750))), openmc.data.DADZ('(n,t)'), ('H3',)), + '(n,3He)': ReactionInfo(set(chain([106], range(750, 800))), openmc.data.DADZ('(n,3He)'), ('He3',)), + '(n,a)': ReactionInfo(set(chain([107], range(800, 850))), openmc.data.DADZ('(n,a)'), ('He4',)), + '(n,2a)': ReactionInfo({108}, openmc.data.DADZ('(n,2a)'), ('He4', 'He4')), + '(n,3a)': ReactionInfo({109}, openmc.data.DADZ('(n,3a)'), ('He4', 'He4', 'He4')), + '(n,2p)': ReactionInfo({111}, openmc.data.DADZ('(n,2p)'), ('H1', 'H1')), + '(n,pa)': ReactionInfo({112}, openmc.data.DADZ('(n,pa)'), ('H1', 'He4')), + '(n,t2a)': ReactionInfo({113}, openmc.data.DADZ('(n,t2a)'), ('H3', 'He4', 'He4')), + '(n,d2a)': ReactionInfo({114}, openmc.data.DADZ('(n,d2a)'), ('H2', 'He4', 'He4')), + '(n,pd)': ReactionInfo({115}, openmc.data.DADZ('(n,pd)'), ('H1', 'H2')), + '(n,pt)': ReactionInfo({116}, openmc.data.DADZ('(n,pt)'), ('H1', 'H3')), + '(n,da)': ReactionInfo({117}, openmc.data.DADZ('(n,da)'), ('H2', 'He4')), + '(n,5n)': ReactionInfo({152}, openmc.data.DADZ('(n,5n)'), ()), + '(n,6n)': ReactionInfo({153}, openmc.data.DADZ('(n,6n)'), ()), + '(n,2nt)': ReactionInfo({154}, openmc.data.DADZ('(n,2nt)'), ('H3',)), + '(n,ta)': ReactionInfo({155}, openmc.data.DADZ('(n,ta)'), ('H3', 'He4')), + '(n,4np)': ReactionInfo({156}, openmc.data.DADZ('(n,4np)'), ('H1',)), + '(n,3nd)': ReactionInfo({157}, openmc.data.DADZ('(n,3nd)'), ('H2',)), + '(n,nda)': ReactionInfo({158}, openmc.data.DADZ('(n,nda)'), ('H2', 'He4')), + '(n,2npa)': ReactionInfo({159}, openmc.data.DADZ('(n,2npa)'), ('H1', 'He4')), + '(n,7n)': ReactionInfo({160}, openmc.data.DADZ('(n,7n)'), ()), + '(n,8n)': ReactionInfo({161}, openmc.data.DADZ('(n,8n)'), ()), + '(n,5np)': ReactionInfo({162}, openmc.data.DADZ('(n,5np)'), ('H1',)), + '(n,6np)': ReactionInfo({163}, openmc.data.DADZ('(n,6np)'), ('H1',)), + '(n,7np)': ReactionInfo({164}, openmc.data.DADZ('(n,7np)'), ('H1',)), + '(n,4na)': ReactionInfo({165}, openmc.data.DADZ('(n,4na)'), ('He4',)), + '(n,5na)': ReactionInfo({166}, openmc.data.DADZ('(n,5na)'), ('He4',)), + '(n,6na)': ReactionInfo({167}, openmc.data.DADZ('(n,6na)'), ('He4',)), + '(n,7na)': ReactionInfo({168}, openmc.data.DADZ('(n,7na)'), ('He4',)), + '(n,4nd)': ReactionInfo({169}, openmc.data.DADZ('(n,4nd)'), ('H2',)), + '(n,5nd)': ReactionInfo({170}, openmc.data.DADZ('(n,5nd)'), ('H2',)), + '(n,6nd)': ReactionInfo({171}, openmc.data.DADZ('(n,6nd)'), ('H2',)), + '(n,3nt)': ReactionInfo({172}, openmc.data.DADZ('(n,3nt)'), ('H3',)), + '(n,4nt)': ReactionInfo({173}, openmc.data.DADZ('(n,4nt)'), ('H3',)), + '(n,5nt)': ReactionInfo({174}, openmc.data.DADZ('(n,5nt)'), ('H3',)), + '(n,6nt)': ReactionInfo({175}, openmc.data.DADZ('(n,6nt)'), ('H3',)), + '(n,2n3He)': ReactionInfo({176}, openmc.data.DADZ('(n,2n3He)'), ('He3',)), + '(n,3n3He)': ReactionInfo({177}, openmc.data.DADZ('(n,3n3He)'), ('He3',)), + '(n,4n3He)': ReactionInfo({178}, openmc.data.DADZ('(n,4n3He)'), ('He3',)), + '(n,3n2p)': ReactionInfo({179}, openmc.data.DADZ('(n,3n2p)'), ('H1', 'H1')), + '(n,3n2a)': ReactionInfo({180}, openmc.data.DADZ('(n,3n2a)'), ('He4', 'He4')), + '(n,3npa)': ReactionInfo({181}, openmc.data.DADZ('(n,3npa)'), ('H1', 'He4')), + '(n,dt)': ReactionInfo({182}, openmc.data.DADZ('(n,dt)'), ('H2', 'H3')), + '(n,npd)': ReactionInfo({183}, openmc.data.DADZ('(n,npd)'), ('H1', 'H2')), + '(n,npt)': ReactionInfo({184}, openmc.data.DADZ('(n,npt)'), ('H1', 'H3')), + '(n,ndt)': ReactionInfo({185}, openmc.data.DADZ('(n,ndt)'), ('H2', 'H3')), + '(n,np3He)': ReactionInfo({186}, openmc.data.DADZ('(n,np3He)'), ('H1', 'He3')), + '(n,nd3He)': ReactionInfo({187}, openmc.data.DADZ('(n,nd3He)'), ('H2', 'He3')), + '(n,nt3He)': ReactionInfo({188}, openmc.data.DADZ('(n,nt3He)'), ('H3', 'He3')), + '(n,nta)': ReactionInfo({189}, openmc.data.DADZ('(n,nta)'), ('H3', 'He4')), + '(n,2n2p)': ReactionInfo({190}, openmc.data.DADZ('(n,2n2p)'), ('H1', 'H1')), + '(n,p3He)': ReactionInfo({191}, openmc.data.DADZ('(n,p3He)'), ('H1', 'He3')), + '(n,d3He)': ReactionInfo({192}, openmc.data.DADZ('(n,d3He)'), ('H2', 'He3')), + '(n,3Hea)': ReactionInfo({193}, openmc.data.DADZ('(n,3Hea)'), ('He3', 'He4')), + '(n,4n2p)': ReactionInfo({194}, openmc.data.DADZ('(n,4n2p)'), ('H1', 'H1')), + '(n,4n2a)': ReactionInfo({195}, openmc.data.DADZ('(n,4n2a)'), ('He4', 'He4')), + '(n,4npa)': ReactionInfo({196}, openmc.data.DADZ('(n,4npa)'), ('H1', 'He4')), + '(n,3p)': ReactionInfo({197}, openmc.data.DADZ('(n,3p)'), ('H1', 'H1', 'H1')), + '(n,n3p)': ReactionInfo({198}, openmc.data.DADZ('(n,n3p)'), ('H1', 'H1', 'H1')), + '(n,3n2pa)': ReactionInfo({199}, openmc.data.DADZ('(n,3n2pa)'), ('H1', 'H1', 'He4')), + '(n,5n2p)': ReactionInfo({200}, openmc.data.DADZ('(n,5n2p)'), ('H1', 'H1')), } __all__ = ["Chain", "REACTIONS"] diff --git a/openmc/plotter.py b/openmc/plotter.py index 3d0635df869..b88af87d36c 100644 --- a/openmc/plotter.py +++ b/openmc/plotter.py @@ -5,7 +5,6 @@ import openmc.checkvalue as cv import openmc.data -from openmc.data import DADZ # Supported keywords for continuous-energy cross section plotting PLOT_TYPES = ['total', 'scatter', 'elastic', 'inelastic', 'fission', @@ -59,9 +58,9 @@ def _get_legend_label(this, type): """Gets a label for the element or nuclide or material and reaction plotted""" if isinstance(this, str): - if type in DADZ.keys(): + if type in openmc.data.DADZ.keys(): z, a, m = openmc.data.zam(this) - da, dz = DADZ[type] + da, dz = openmc.data.DADZ[type] gnds_name = openmc.data.gnds_name(z-dz, a-da, m) return f'{this} {type} {gnds_name}' return f'{this} {type}'