diff --git a/src/input_xml.F90 b/src/input_xml.F90
index b0831bd903..e7662041b7 100644
--- a/src/input_xml.F90
+++ b/src/input_xml.F90
@@ -3641,7 +3641,9 @@ contains
allocate(nuclides(n_nuclides))
allocate(elements(n_elements))
allocate(sab_tables(n_sab_tables))
- if (electron_treatment == ELECTRON_TTB) allocate(ttb(n_materials))
+ if (photon_transport .and. electron_treatment == ELECTRON_TTB) then
+ allocate(ttb(n_materials))
+ end if
! Read cross sections
do i = 1, size(materials)
diff --git a/src/physics.F90 b/src/physics.F90
index 25a076bc1f..c0a813ba25 100644
--- a/src/physics.F90
+++ b/src/physics.F90
@@ -1724,7 +1724,7 @@ contains
integer :: i
! Sample the number of photons produced
- nu_t = p % wgt / keff * micro_xs(i_nuclide) % photon_prod / &
+ nu_t = p % wgt * micro_xs(i_nuclide) % photon_prod / &
micro_xs(i_nuclide) % total
if (prn() > nu_t - int(nu_t)) then
nu = int(nu_t)
diff --git a/tests/regression_tests/photon_production/inputs_true.dat b/tests/regression_tests/photon_production/inputs_true.dat
new file mode 100644
index 0000000000..58617b1dc9
--- /dev/null
+++ b/tests/regression_tests/photon_production/inputs_true.dat
@@ -0,0 +1,50 @@
+
+
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ fixed source
+ 10000
+ 1
+
+
+ 0 0 0
+
+
+
+ 14.0 1.0
+
+
+ ttb
+ true
+
+ 1000.0
+
+
+
+
+
+ 14
+
+
+ 2
+
+
+ 1 2
+ flux
+
+
diff --git a/tests/regression_tests/photon_production/results_true.dat b/tests/regression_tests/photon_production/results_true.dat
new file mode 100644
index 0000000000..84204f9b80
--- /dev/null
+++ b/tests/regression_tests/photon_production/results_true.dat
@@ -0,0 +1,3 @@
+tally 1:
+sum = 1.371553E-08
+sum_sq = 1.881158E-16
diff --git a/tests/regression_tests/photon_production/test.py b/tests/regression_tests/photon_production/test.py
new file mode 100644
index 0000000000..14c321c43c
--- /dev/null
+++ b/tests/regression_tests/photon_production/test.py
@@ -0,0 +1,70 @@
+from math import pi
+
+import numpy as np
+import openmc
+
+from tests.testing_harness import PyAPITestHarness
+
+
+class SourceTestHarness(PyAPITestHarness):
+ def _build_inputs(self):
+ mat = openmc.Material()
+ mat.set_density('g/cm3', 2.6989)
+ mat.add_nuclide('Al27', 1.0)
+ materials = openmc.Materials([mat])
+ materials.export_to_xml()
+
+ cyl = openmc.XCylinder(boundary_type='vacuum', R=1.0e-6)
+ x_plane_left = openmc.XPlane(boundary_type='vacuum', x0=-1.0)
+ x_plane_center = openmc.XPlane(boundary_type='transmission', x0=1.0)
+ x_plane_right = openmc.XPlane(boundary_type='vacuum', x0=11.0)
+
+ inner_cyl_left = openmc.Cell()
+ inner_cyl_right = openmc.Cell()
+ outer_cyl = openmc.Cell()
+
+ inner_cyl_left.region = -cyl & +x_plane_left & -x_plane_center
+ inner_cyl_right.region = -cyl & +x_plane_center & -x_plane_right
+ outer_cyl.region = ~(-cyl & +x_plane_left & -x_plane_right)
+ inner_cyl_right.fill = mat
+ geometry = openmc.Geometry([inner_cyl_left, inner_cyl_right, outer_cyl])
+ geometry.export_to_xml()
+
+ source = openmc.Source()
+ source.space = openmc.stats.Point((0,0,0))
+ source.angle = openmc.stats.Monodirectional()
+ source.energy = openmc.stats.Discrete([14.0], [1.0])
+ source.particle = 'neutron'
+
+ settings = openmc.Settings()
+ settings.particles = 10000
+ settings.run_mode = 'fixed source'
+ settings.batches = 1
+ settings.photon_transport = True
+ settings.electron_treatment = 'ttb'
+ settings.cutoff = {'energy_photon' : 1000.0}
+ settings.source = source
+ settings.export_to_xml()
+
+ cell_filter = openmc.CellFilter(inner_cyl_right)
+ particle_filter = openmc.ParticleFilter('photon')
+ tally = openmc.Tally()
+ tally.filters = [cell_filter, particle_filter]
+ tally.scores = ['flux']
+ tallies = openmc.Tallies([tally])
+ tallies.export_to_xml()
+
+ def _get_results(self):
+ with openmc.StatePoint(self._sp_name) as sp:
+ outstr = ''
+ t = sp.get_tally()
+ outstr += 'tally {}:\n'.format(t.id)
+ outstr += 'sum = {:12.6E}\n'.format(t.sum[0, 0, 0])
+ outstr += 'sum_sq = {:12.6E}\n'.format(t.sum_sq[0, 0, 0])
+
+ return outstr
+
+
+def test_source():
+ harness = SourceTestHarness('statepoint.1.h5')
+ harness.main()