Which physical constructor makes the most sense for this repeated volume?


I want to fill a cube with multiple smaller cubes and a small gap between them in each direction. I wonder which constructor is useful for this?

  • First I thought Replica would make sense but the offset seems to aim at spherical elements only?
  • Division does not work as there is no gap between the single elements possible?
  • Parameterised makes no sense as I don’t want to change any geometry.

So I need to position each element manually or did I oversee something?

Thank you!

Hi Benjamin

There seem to multiple misconceptions here. But first to answer directly, why not simply place (G4PVPlacement) your small cubes inside the big cube? Look at the documentation or one of the basic examples for how to do this.

You can make a replica (G4PVReplica) and put stuff in it. The stuff must fill the mother volume but there’s nothing to stop you putting another replica in it, and another (to get three dimensions) and the final “stuff” could be a cube that fills the replica and the same material as the replica, with a small cube inside it. Again, see documentation.

I’ve not used divisions, but I’d guess you could specify a cube that fills it with the same material as the replica, with a small cube inside it.

Parameterisation is not about “changing the geometry”, it’s simply about saving space - the properties are calculated on the fly, but you pay a performance penalty, and with modern computers with hundreds of Gigabytes of memory, initialising the properties by multiple G4PVPlacements at initialisation time is more performant.

But all in all, unless you have millions of small cubes, simple G4PVPlacement sounds the best solution to me.



Hi John,

thanks for your detailed answer! Indeed, I have some dozens, maybe hundreds of cubes. I only read that those other constructors are more computer efficient so I tried to follow this route as I’m not aware of memory boundaries or the like of Geant4 and my system.
But I l actually like Replica, avoids me setting up a for loop but as described, I need some gaps so I will go with the regular Placement then.
Thank you!