diff --git a/openmc/deplete/d1s.py b/openmc/deplete/d1s.py index e9f8bfe79d6..311bc2d69cd 100644 --- a/openmc/deplete/d1s.py +++ b/openmc/deplete/d1s.py @@ -243,7 +243,7 @@ def prepare_tallies( for f in tally.filters: if isinstance(f, openmc.ParticleFilter): if list(f.bins) == ['photon']: - tally.filters.append(filter) + if not tally.contains_filter(openmc.ParentNuclideFilter): + tally.filters.append(filter) break - return nuclides diff --git a/tests/unit_tests/test_d1s.py b/tests/unit_tests/test_d1s.py index 115759489aa..9410f2da2e0 100644 --- a/tests/unit_tests/test_d1s.py +++ b/tests/unit_tests/test_d1s.py @@ -84,6 +84,11 @@ def test_prepare_tallies(model): assert tally.contains_filter(openmc.ParentNuclideFilter) assert sorted(tally.filters[-1].bins) == sorted(radionuclides) + assert len(tally.filters) == 2 + # calling prepare_tallies twice should not add another ParentNuclideFilter + d1s.prepare_tallies(model, chain_file=CHAIN_PATH) + assert len(tally.filters) == 2 + def test_apply_time_correction(run_in_tmpdir): # Make simple sphere model with elemental Ni