diff --git a/src/pyg4ometry/geant4/LogicalVolume.py b/src/pyg4ometry/geant4/LogicalVolume.py index 9b9c72ec1..df229a2fc 100644 --- a/src/pyg4ometry/geant4/LogicalVolume.py +++ b/src/pyg4ometry/geant4/LogicalVolume.py @@ -79,7 +79,8 @@ def __init__(self, solid, material, name, registry=None, addRegistry=True, **kwa if isinstance(material, _mat.Material): self.material = material - self.material.set_registry(registry, dontWarnIfAlreadyAdded=True) + if registry and addRegistry: + self.material.set_registry(registry, dontWarnIfAlreadyAdded=True) elif isinstance(material, str): # If the material is registered already, use it if registry and material in registry.materialDict: