Error when modifying the geometry

Hello, I have been modeling a germanium detector for gamma ray spectroscopy and its working fine. Now, I wanted to add a lead plate on top of the detector to measure the attenuation caused by it, but when I define the new geometry and cell, it now gives a random error.

This is my code up to that point, I commented with “#” the new geometry that im trying to add that is causing the error just so you can identify it. Without those lines, the code works well but as soon as I add that lead plate, it explodes :disappointed:

ge = openmc.Material()
ge.add_element('Ge',1.0)
ge.set_density('g/cm3',5.323)

mat2 = openmc.Material()
mat2.add_element('Al',1.0)
mat2.set_density('g/cm3',2.698)

mat3 = openmc.Material()
mat3.add_element('Be',1.0)
mat3.set_density('g/cm3',1.848)

pb = openmc.Material()
pb.add_element('Pb',1.0)
pb.set_density('g/cm3',11.34)

materials = openmc.Materials([ge,mat2,mat3,pb])
materials.cross_sections = "/Users/admin/Documents/antonio/mcnp_endfb71/cross_sections.xml"
materials.export_to_xml()

sphere = openmc.Sphere(r = 10, boundary_type = 'vacuum')
inside_sphere = -sphere
outside_sphere = +sphere

cyl = openmc.ZCylinder(r = 2.52)
plano1 = openmc.ZPlane(z0 = +0,boundary_type = 'transmission')
plano2 = openmc.ZPlane(z0 = +2.52,boundary_type = 'transmission')
cyl2 = openmc.ZCylinder(r = 3.0)
cyl3 = openmc.ZCylinder(r = 3.81)
plano3 = openmc.ZPlane(z0 = +3.02)
plano4 = openmc.ZPlane(z0 = +3.07)
plano5 = openmc.ZPlane(z0 = -2.0)

#plano66 = openmc.ZPlane(z0 = 4.0)
#plano77 = openmc.ZPlane(z0 = 4.5)

detector = -cyl & +plano1 & -plano2
vacio = inside_sphere & -cyl2 & ~detector & -plano3 & +plano5
capa = -cyl3 & ~vacio & -plano3 & +plano5
pantalla = +plano3 & -plano4 & -cyl3
#plate = -cyl3 & plano66 & -plano77
sphere1 = inside_sphere & ~detector & ~capa & ~pantalla & ~plate

sphere_cell = openmc.Cell()
sphere_cell.region = sphere1
det_cell = openmc.Cell()
det_cell.region = detector
det_cell.fill = ge
vacio_cell = openmc.Cell()
vacio_cell.region = vacio
capa_cell = openmc.Cell()
capa_cell.region = capa
capa_cell.fill = mat2
pantalla_cell = openmc.Cell()
pantalla_cell.region = pantalla
pantalla_cell.fill = mat3
#plate_cell = openmc.Cell()
#plate_cell.region = plate
#plate_cell.fill = pb

universe = openmc.Universe(cells=[sphere_cell,det_cell,vacio_cell,capa_cell,pantalla_cell,plate_cell])

universe.plot(width = (20.0,20.0),basis = 'xz')
geometry = openmc.Geometry(universe)
geometry.export_to_xml()

Thanks in advance for your help

Hello Tony,
I am a newbie to openmc, so they might have something more profound, but I see a mispelling in the quoted line. It should be:

#plate = -cyl3 & +plano66 & -plano77

(there is a + missing).

That was the problem. I stared at the code for hours and couldn’t figure it out.

Thank you so much