Geometry, craeting

Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!

_Geant4 Version:11_2.1
Operating System:
_CMake Version:3.29.3

I want to design a cube in geant4 with dimensions of 100nm, 100nm, 100nm and fill it with smaller cubes, for example, with dimensions of 20nm, how should I write the code?

Maybe start with exampleB1?

Hi my friend.
Iran into a problem with how to calculate the location of the small cubes inside the big cube inside G4ThreeVector

For example, suppose we have the following code

For ( Int i =0; i <5 ; i++){

For(Int j =0; j < 5 ; j ++){

For (Int k=0 ; k < 5 ; k++){ 

G4VPhysicalVolume * physcube = new G4PVPlacement (0,G4ThreeVector ( ? ), logiccube, “cube” , logicworld, false , ???, true)

The large cube has a coordinate system with (0,0,0) at the center. You should be able to figure out where each little cube should have it’s own center. Draw the picture in two dimensions on a piece of paper.

That means I have to define each smaller cube one by one and give it the coordinates. Does that mean you can’t use (for)?

Is it not possible to repeat the small cubes and make the big cube?

Make one small cube (logical volume). Then place it N times using your nested loops. After you have read the documentation, and worked through some of the examples, you should have enough experience to do something more efficient like use a replica or parameterized placement.