Energy distribution in OPENMC fixed source

Hi all:
I am new to OPENMC and am trying to learn how to write fixed sources for OPENMC. I’m in about learning energy distribution and a little confused. I am attaching my MCNP source card, how should the energy distribution in MCNP be written in OPENMC? Is it with openmc.stats.Tabular?
I would greatly appreciate any help in this regard. Thanks! :smiley:

MCNP source card:

sdef  pos=  0.00000000  0.00000000 15.00000000
      vec=  0.00000000  0.00000000  -1.00000000
      axs=  0.00000000  0.00000000  -1.00000000
      ara=  78.53982
      dir=1.0 rad=d1 erg=d2
si1  0  5
si2  S   5         6       7  
sp2     0.1      0.89    0.01                                                
#            si5
        0.000000001
        1.06412E-09
        1.13235E-09
        1.20495E-09
        1.28221E-09
        1.36442E-09
        1.4519E-09
        1.545E-09
        1.64406E-09
        1.74947E-09
        1.86165E-09
        1.98101E-09
        2.10803E-09
        2.24319E-09
        2.38702E-09
        2.54007E-09
        2.70293E-09
        2.87624E-09
        3.06066E-09
        3.2569E-09
        3.46572E-09
        3.68794E-09
        3.9244E-09
        4.17603E-09
        4.44378E-09
        4.72871E-09
        5.0319E-09
        5.35454E-09
        5.69786E-09
        6.06319E-09
        6.45195E-09
        6.86563E-09
        7.30584E-09
        7.77428E-09
        8.27275E-09
        8.80318E-09
        9.36762E-09
        9.96825E-09
        1.06074E-08
        1.12875E-08
        1.20112E-08
        1.27814E-08
        1.36009E-08
        1.4473E-08
        1.54009E-08
        1.63884E-08
        1.74392E-08
        1.85573E-08
        1.97472E-08
        2.10134E-08
        2.23607E-08
        2.37944E-08
        2.532E-08
        2.69435E-08
        2.86711E-08
        3.05094E-08
        3.24656E-08
        3.45472E-08
        3.67623E-08
        3.91194E-08
        4.16277E-08
        4.42967E-08
        4.71369E-08
        5.01593E-08
        5.33754E-08
        5.67977E-08
        6.04394E-08
        6.43146E-08
        6.84384E-08
        7.28265E-08
        7.74959E-08
        8.24648E-08
        8.77523E-08
        9.33788E-08
        9.9366E-08
        1.05737E-07
        1.12517E-07
        1.19731E-07
        1.27408E-07
        1.35577E-07
        1.4427E-07
        1.5352E-07
        1.63364E-07
        1.73838E-07
        1.84984E-07
        1.96845E-07
        2.09466E-07
        2.22897E-07
        2.37188E-07
        2.52396E-07
        2.6858E-07
        2.858E-07
        3.04125E-07
        3.23625E-07
        3.44375E-07
        3.66456E-07
        3.89952E-07
        4.14955E-07
        4.41561E-07
        4.69873E-07
        5E-07
sp5 D 0 1 99r
c
#           si6 
        5.0000000E-07
        5.5205240E-07
        6.0952371E-07
        6.7297806E-07
        7.4303831E-07
        8.2039217E-07
        9.0579893E-07
        1.0000970E-06
        1.1042119E-06
        1.2191656E-06
        1.3460866E-06
        1.4862207E-06
        1.6409434E-06
        1.8117735E-06
        2.0003878E-06
        2.2086378E-06
        2.4385676E-06
        2.6924342E-06
        2.9727296E-06
        3.2822050E-06
        3.6238983E-06
        4.0011636E-06
        4.4177039E-06
        4.8776081E-06
        5.3853906E-06
        5.9460356E-06
        6.5650465E-06
        7.2484994E-06
        8.0031030E-06
        8.8362645E-06
        9.7561621E-06
        1.0771825E-05
        1.1893224E-05
        1.3131366E-05
        1.4498404E-05
        1.6007758E-05
        1.7674242E-05
        1.9514216E-05
        2.1545740E-05
        2.3788755E-05
        2.6265278E-05
        2.8999620E-05
        3.2018620E-05
        3.5351912E-05
        3.9032216E-05
        4.3095657E-05
        4.7582122E-05
        5.2535650E-05
        5.8004864E-05
        6.4043449E-05
        7.0710679E-05
        7.8072001E-05
        8.6199671E-05
        9.5173471E-05
        1.0508149E-04
        1.1602097E-04
        1.2809932E-04
        1.4143507E-04
        1.5615914E-04
        1.7241606E-04
        1.9036540E-04
        2.1018335E-04
        2.3206445E-04
        2.5622347E-04
        2.8289757E-04
        3.1234856E-04
        3.4486555E-04
        3.8076771E-04
        4.2040746E-04
        4.6417389E-04
        5.1249663E-04
        5.6584999E-04
        6.2475769E-04
        6.8979797E-04
        7.6160925E-04
        8.4089644E-04
        9.2843780E-04
        1.0250926E-03
        1.1318097E-03
        1.2496365E-03
        1.3797297E-03
        1.5233662E-03
        1.6819559E-03
        1.8570556E-03
        2.0503840E-03
        2.2638389E-03
        2.4995154E-03
        2.7597269E-03
        3.0470278E-03
        3.3642380E-03
        3.7144714E-03
        4.1011657E-03
        4.5281167E-03
        4.9995154E-03
        5.5199890E-03
        6.0946464E-03
        6.7291284E-03
        7.4296630E-03
        8.2031266E-03
        9.0571115E-03
        1.0000000E-02
sp6 D 0 1 99r
#           si7 
        1.00E-02
        1.0544119E-02
        1.1117845E-02
        1.1722788E-02
        1.2360647E-02
        1.3033213E-02
        1.3742375E-02
        1.4490124E-02
        1.5278559E-02
        1.6109895E-02
        1.6986465E-02
        1.7910730E-02
        1.8885287E-02
        1.9912872E-02
        2.0996369E-02
        2.2138822E-02
        2.3343437E-02
        2.4613598E-02
        2.5952870E-02
        2.7365016E-02
        2.8853998E-02
        3.0423999E-02
        3.2079427E-02
        3.3824929E-02
        3.5665408E-02
        3.7606031E-02
        3.9652247E-02
        4.1809801E-02
        4.4084752E-02
        4.6483487E-02
        4.9012742E-02
        5.1679618E-02
        5.4491605E-02
        5.7456597E-02
        6.0582919E-02
        6.3879351E-02
        6.7355148E-02
        7.1020070E-02
        7.4884407E-02
        7.8959010E-02
        8.3255320E-02
        8.7785401E-02
        9.2561972E-02
        9.7598445E-02
        1.0290896E-01
        1.0850843E-01
        1.1441258E-01
        1.2063799E-01
        1.2720213E-01
        1.3412344E-01
        1.4142136E-01
        1.4911636E-01
        1.5723007E-01
        1.6578525E-01
        1.7480594E-01
        1.8431747E-01
        1.9434653E-01
        2.0492130E-01
        2.1607145E-01
        2.2782831E-01
        2.4022489E-01
        2.5329598E-01
        2.6707830E-01
        2.8161053E-01
        2.9693350E-01
        3.1309022E-01
        3.3012605E-01
        3.4808884E-01
        3.6702901E-01
        3.8699976E-01
        4.0805715E-01
        4.3026032E-01
        4.5367160E-01
        4.7835674E-01
        5.0438504E-01
        5.3182959E-01
        5.6076745E-01
        5.9127987E-01
        6.2345253E-01
        6.5737577E-01
        6.9314484E-01
        7.3086017E-01
        7.7062766E-01
        8.1255898E-01
        8.5677186E-01
        9.0339045E-01
        9.5254564E-01
        1.0043755E+00
        1.0590254E+00
        1.1166490E+00
        1.1774080E+00
        1.2414730E+00
        1.3090240E+00
        1.3802504E+00
        1.4553525E+00
        1.5345410E+00
        1.6180383E+00
        1.7060788E+00
        1.7989098E+00
        1.8967919E+00
        2.0000000E+00
sp7 D 0 1 99r

Hi @SunAK. In this SDEF, energy is specified as distribution 2 which is given as:

The OpenMC equivalent of this would be:

dist = openmc.stats.Mixture([0.1, 0.89, 0.01], [dist5, dist6, dist7])

where each of the subdistributions would be given as:

dist5 = openmc.stats.Tabular(energies1, probs1)
dist6 = openmc.stats.Tabular(energies2, probs2)
dist7 = openmc.stats.Tabular(energies3, probs3)

The si cards in that MCNP snippet don’t appear to be complete to me, so I’m not sure how to interpret the values on the sp cards, but depending on what they represent, you can specify the interpolation on the Tabular distribution with an argument interpolation="histogram" or interpolation="linear-linear".

Thank you very much for your advice :smiley: :smiley: :smiley: