# Bombard a material with neutrons?

**URL:** <https://openmc.discourse.group/t/bombard-a-material-with-neutrons/5336>\
**Category:** User Support\
**Created:** [March 17, 2025, 12:23pm UTC](https://openmc.discourse.group/t/bombard-a-material-with-neutrons/5336 "2025-03-17T12:23:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pigionski](https://avatars.discourse-cdn.com/v4/letter/p/7c8e57/32.png) [@pigionski](https://openmc.discourse.group/u/pigionski)\
**Post date:** [March 17, 2025, 12:23pm UTC](https://openmc.discourse.group/t/bombard-a-material-with-neutrons/5336/1 "2025-03-17T12:23:53Z")

</div>

I have a box with layers of different materials. Then 5 cm from said box i have a source of 14 MeV neutrons in the shape of a cone. Between the 2 i have a vacuum. For this reason the box has vacuum boundaries on its outside surfaces.  
I created a source but doesnt matter where i place it (even inside the box) i get the error More than 95% of external source sites sampled were rejected. Please check your external source’s spatial definition.  
What’s wrong?  
Thanks a lot i just started with openmc. Below is my code

import openmc  
import numpy as np

Cu = openmc.Material()  
Cu.set\_density(‘g/cm3’, 8.96)  
Cu.add\_element(‘Cu’, 1)  
Pb = openmc.Material()  
Pb.set\_density(‘g/cm3’, 11.35)  
Pb.add\_element(‘Pb’, 1)  
Cd = openmc.Material()  
Cd.set\_density(‘g/cm3’ 8.65)  
Cd.add\_element(‘Cd’, 1)  
SS = openmc.Material()  
SS.set\_density(‘g/cm3’, 7.87)  
SS.add\_element(‘Cr’, 18, ‘wo’)  
SS.add\_element(‘Ni’, 10, ‘wo’)  
SS.add\_element(‘Fe’, 66.97, wo’)  
SS.add\_element(‘C’, 0.03, ‘wo’)  
SS.add\_element(‘Mo’, 2, ‘wo’)  
SS.add\_element(‘Mn’, 2, ‘wo’)  
PP = openmc.Material()  
PP.set\_density(‘g/cm3’, 1.19)  
PP.add\_element(‘H’, 8, ‘wo’)  
PP.add\_element(‘O’, 32, ‘wo’)  
PP.add\_element(‘C’, 60, ‘wo’)  
Air = openmc.Material()  
Air.set\_density(‘g/cm3’, 0.0012)  
Air.add\_element(‘O’, 80, ‘wo’)  
Air.add\_element(‘N’, 20, ‘wo’)

materials = openmc.Materials([Cu, Pb, Cd, SS, PP, Air])  
materials.export\_to\_xml()

import openmc.geometry  
air\_front = openmc.YPlane(y0=100)  
front = openmc.YPlane(y0=80, boundary\_type=‘vacuum’)  
Cu\_back = openmc.YPlane(y0=72)  
Pb\_back = openmc.YPlane(y0=70)  
PP\_back = openmc.YPlane(y0=69)  
SS1\_back = openmc.YPlane(y0=51)  
Cd1\_back = openmc.YPlane(y0=50)  
SS2\_back = openmc.YPlane(y0=20)  
PP\_back2 = openmc.YPlane(y0=18.3)  
Cd\_back = openmc.YPlane(y0=18.29)  
back = openmc.YPlane(y0=0, boundary\_type=‘vacuum’)  
side1 = openmc.XPlane(x0=-30, boundary\_type=‘vacuum’)  
side2 = openmc.XPlane(x0=30, boundary\_type=‘vacuum’)  
top = openmc.ZPlane(z0=30, boundary\_type=‘vacuum’)  
bottom = openmc.ZPlane(z0=-30, boundary\_type=‘vacuum’)  
cavity\_front = openmc.YPlane(y0=50)  
cavity\_back = openmc.YPlane(y0=20)  
cavity\_side1 = openmc.XPlane(x0=-10)  
cavity\_side2 = openmc.XPlane(x0=10)  
cavity\_bottom = openmc.ZPlane(z0=10)  
Layer\_Cu = openmc.Cell(fill=Cu, region= -front & +Cu\_back & +side1 & -side2 & -top & +bottom)  
Layer\_Pb = openmc.Cell(fill=Pb, region= -Cu\_back & +Pb\_back & +side1 & -side2 & -top & +bottom)  
Layer\_PP = openmc.Cell(fill=PP, region= -Pb\_back & +PP\_back & +side1 & -side2 & -top & +bottom)  
Layer\_SS = openmc.Cell(fill=SS, region= -PP\_back & +SS1\_back & +side1 & -side2 & -top & +bottom)  
Layer\_Cd1 = openmc.Cell(fill=Cd, region= -SS1\_back & +Cd1\_back & +cavity\_side1 & -cavity\_side2 & -top & +cavity\_bottom)  
cavity = openmc.Cell(fill=Air, region= -Cd1\_back & +SS2\_back & +cavity\_side1 & -cavity\_side2 & -top & +cavity\_bottom)  
Layer\_SS1 = openmc.Cell(fill=SS, region= -PP\_back & +SS2\_back & +side1 & -side2 & -cavity\_bottom & +bottom)  
Layer\_SS\_lat\_1 = openmc.Cell(fill=SS, region= -SS1\_back & + SS2\_back & -top & +bottom & +side1 & -cavity\_side1)  
Layer\_SS\_lat\_2 = openmc.Cell(fill=SS, region= -SS1\_back & + SS2\_back & -top & +bottom & -side2 & +cavity\_side2)  
Layer\_PP2 = openmc.Cell(fill=PP, region= -SS2\_back & +PP\_back2 & +side1 & -side2 & -top & +bottom)  
Layer\_Cd2 = openmc.Cell(fill=Cd, region= -PP\_back2 & +Cd\_back & +side1 & -side2 & -top & +bottom)  
Layer\_SS2 = openmc.Cell(fill=Pb, region= -Cd\_back & +back & +side1 & -side2 & -top & +bottom)  
block = openmc.Universe(cells=[Layer\_Cu, Layer\_Pb, Layer\_PP, Layer\_SS, cavity, Layer\_SS1, Layer\_Cd1, Layer\_SS\_lat\_1 , Layer\_SS\_lat\_2, Layer\_PP2, Layer\_Cd2, Layer\_SS2])  
block.plot()  
geom = openmc.Geometry()  
geom.root\_universe = block  
geom.export\_to\_xml()

source = openmc.IndependentSource()  
source.space = openmc.stats.Point((70, 0, 0))  
source.angle = openmc.stats.Isotropic()  
source.energy = openmc.stats.Discrete([14.0e6], [1.0])

settings = openmc.Settings()  
settings.run\_mode = ‘fixed source’  
settings.batches = 1  
settings.inactive = 0  
settings.particles = 1  
settings.source = source  
settings.export\_to\_xml()

---

<div class="post-metadata">

**Author:** ![wahidluthfi](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/wahidluthfi/32/3375_2.png) [@wahidluthfi](https://openmc.discourse.group/u/wahidluthfi)\
**Post date:** [March 17, 2025, 2:26pm UTC](https://openmc.discourse.group/t/bombard-a-material-with-neutrons/5336/2 "2025-03-17T14:26:20Z")

</div>

Hi Pigionski, welcome to the openmc community.  
Regarding your issue, I think the problem is that you use a vacuum boundary condition at the -30 cm to 30 cm on x axis

```auto
side1 = openmc.XPlane(x0=-30, boundary_type=‘vacuum’)
side2 = openmc.XPlane(x0=30, boundary_type=‘vacuum’)

```

While your source was outside of the system being modeled, x at 70 cm

```auto
source = openmc.IndependentSource()
source.space = openmc.stats.Point((70, 0, 0))
source.angle = openmc.stats.Isotropic()
source.energy = openmc.stats.Discrete([14.0e6], [1.0])

```

Have you tried to model the whole box, including the void and source, which is then enclosed by a big spherical or other type of surface covering the model as the outermost boundary?  
I think that will solve the ‘95% of external source sites sampled were rejected’ since those errors come from the reality that your source was outside of the vacuum boundary condition.  
Make sure that the vacuum boundary condition is only for the outermost boundary of your model.

This gamma detector notebook might give you the perspective on modelling this kind of case.

> <https://github.com/openmc-dev/openmc-notebooks/blob/main/gamma-detector.ipynb>

---

<div class="post-metadata">

**Author:** ![pigionski](https://avatars.discourse-cdn.com/v4/letter/p/7c8e57/32.png) [@pigionski](https://openmc.discourse.group/u/pigionski)\
**Post date:** [March 17, 2025, 2:28pm UTC](https://openmc.discourse.group/t/bombard-a-material-with-neutrons/5336/3 "2025-03-17T14:28:26Z")

</div>

Thanks a lot for the answer, i just did a large sphere with a box sized hole in the middle, filled the hole with the box and it seems to be working.

sphere = openmc.Sphere(r=1000, boundary\_type=‘vacuum’)  
box = -front & +back & +side1 & -side2 & -top & +bottom  
bounds = openmc.Cell(region= -sphere & ~box)  
box\_cell = openmc.Cell(fill=block, region=box)  
root\_universe = openmc.Universe(cells=[bounds, box\_cell])
