Optical photons not being able to transport from one material to another due to Geant4 not finding RINDEX

I have two volumes created by STLs. Every time an optic photon enters the system error at the bottom of the image occurs. I would love to here advices of any sort. I can always share more information about the volumes if needed. Thanks in advance.

LG Volume is using a material defined like this:

 // Define PMMA
  G4double densityLG = 1.190 * g/cm3;//https://eljentechnology.com/images/products/data_sheets/Light_Guides_and_Acrylic_Plastic.pdf
  LG= new G4Material("LG", densityLG, 3);
  LG->AddElement(H, 0.0806);//https://eljentechnology.com/images/products/data_sheets/Light_Guides_and_Acrylic_Plastic.pdf
  LG->AddElement(C, 0.600);
  LG->AddElement(O, 0.319);



  mptLG = new G4MaterialPropertiesTable();

  const G4int nEntries_LG = 20;

  G4double photonEnergy_LG[nEntries_LG] = {2.239*eV, 2.264*eV, 2.290*eV, 2.316*eV, 2.343*eV,
   2.371*eV, 2.399*eV, 2.428*eV, 2.457*eV, 2.488*eV,
   2.519*eV, 2.551*eV, 2.584*eV, 2.618*eV, 2.651*eV,
   2.687*eV, 2.723*eV, 2.760*eV, 2.799*eV, 2.838*eV}; //source: https://refractiveindex.info/?shelf=organic&book=poly(methyl_methacrylate)&page=Sultanova
   
   
  G4double Absorption_LG[nEntries_LG] =  
  {500.*cm, 500.*cm, 500.*cm, 500.*cm, 500.*cm,
  500.*cm, 500.*cm, 500.*cm, 500.*cm, 500.*cm,
  500.*cm, 500.*cm, 500.*cm, 500.*cm, 500.*cm,
  500.*cm, 500.*cm, 500.*cm, 500.*cm, 500.*cm};
  //Buradan Absorbance'ın ne olduğu öğrenildi ve farklı PMMA değerli için olan grafiği elde edildi ve kullanıldı: https://www.researchgate.net/publication/268812499_Study_of_the_optical_properties_of_poly_methyl_methacrylate_PMMA_doped_with_a_new_diarylethen_compound
  
  
  G4double refractiveIndex_LG[nEntries_LG] = 
  {1.4923750573264, 1.4927341243093,1.4931000625685, 1.4934855013926, 1.4938786637052,
   1.4942931534457, 1.4947163429268, 1.4951629159378, 1.4956193105824, 1.4961014106014,
   1.4965946258579, 1.4971161777103, 1.4976503417391, 1.498215835395,  1.4987956800739,
   1.4994102725825, 1.5000412441879, 1.500710884023,  1.5013992786673, 1.5021308583767}; //source: https://refractiveindex.info/?shelf=organic&book=poly(methyl_methacrylate)&page=Sultanova
  mptLG->AddProperty("RINDEX", photonEnergy_LG,refractiveIndex_LG,nEntries_LG);
  mptLG->AddProperty("ABSLENGTH", photonEnergy_LG,Absorption_LG,nEntries_LG);

  LG->SetMaterialPropertiesTable(mptLG);

Geant4 Version:11.1.0
Operating System:Ubuntu 20.04
Compiler/Version:
CMake Version:4.1.1


The error seems pretty straightforward, the “LG” volume does not have a properly defined r_index value. And generally for optical simulations when it encounters undefined parameters the photon will just die/disappear there.

I suppose I should have been able to explain my problem more clearly. I indeed defined r_index for the material I used in LG volume I will add it up to question momunteraily

What is the energy of the optical photon causing the error to occur? Is it within the range of the photonEnergy_LG?

Yes they are within the range. I use a .mac like below:

```
Particle type

/gps/particle opticalphoton

/run/verbose 0
/event/verbose 0
/tracking/verbose 0

Energy

/gps/ene/type Mono
/gps/ene/mono 2.75 eV

Position

/gps/pos/type Point
/gps/pos/centre 0. 0. 9. mm

Angular distribution:

/gps/ang/type iso

/gps/ang/minphi 0. deg
/gps/ang/maxphi 360. deg
/gps/ang/mintheta 90. deg
/gps/ang/maxtheta 180. deg

/gps/source/intensity 1

/gps/source/add 1

Particle type

/gps/particle opticalphoton

Energy

/gps/ene/type Mono
/gps/ene/mono 2.26 eV

Position

/gps/pos/type Point
/gps/pos/centre 0. 0. 9. mm

Angular distribution:

/gps/ang/type iso

/gps/ang/minphi 0. deg
/gps/ang/maxphi 360. deg
/gps/ang/mintheta 90. deg
/gps/ang/maxtheta 180. deg

/gps/source/intensity 1

/process/optical/verbose 2
/process/optical/boundary/verbose 2
/tracking/verbose 2

/run/beamOn 1
```

sorry that comments are looking like \textbf{}

I also want to share a bit of extra information, forgetting about uploading geometries through stl files and just using a simpler shape like a square, error has reversed. now code cant find the RINDEX of reflector when photons i going from LG to reflector. Like in the image.

You have defined the oprical properties for the LG volume, but have you defined the optical properties for the reflector?

Yes I have, sorry for not putting anything porperly I guess. I will add the reflector part of the code in a moment.

I am not able to edit the original post anymore, so I am writing it here. sorry things are geting awkward and thanks for sparing time.

    
         
G4Material* reflectorBulkMat = new G4Material("ReflectorAluminum", 13, 26.98*g/mole, 2.7*g/cm3);

//auto transition_mesh_2 = CADMesh::TessellatedMesh::FromSTL("./Reflector_ascii.stl"); //hangi stl çağırılmak isteniyorsa buraya tanımlanmalı
G4VSolid* bigbox = new G4Box("substraction1", 0.6*cm, 0.6*cm, 0.6*cm);
auto* transition_mesh_2 = new G4SubtractionSolid("substraction2", bigbox, transition_mesh);


G4VSolid* rect = new G4Box("substraction3", 0.7*cm, 0.7*cm, 0.05*cm);

auto* transition_mesh_2_1 = new G4SubtractionSolid("substraction4", transition_mesh_2, rect, 0, G4ThreeVector(0., 0., -0.55*cm));





// 1. CREATE THE OPTICAL SURFACE
G4OpticalSurface* opreflectorSurface = new G4OpticalSurface("opReflectorSurface");
opreflectorSurface->SetType(dielectric_metal); // The most common type for a reflective coating/metal
opreflectorSurface->SetFinish(polished);       // A perfectly smooth finish. Use 'ground' for a rough, Lambertian reflector.
opreflectorSurface->SetModel(unified);         // The most comprehensive model, uses complex logic for reflection/absorption

// 2. CREATE THE MATERIAL PROPERTIES TABLE FOR THE *SURFACE*
G4MaterialPropertiesTable* reflectorSurfaceMPT = new G4MaterialPropertiesTable();


const G4int nEntries = 20;
G4double refractiveIndex_Al[nEntries] = {1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5}; 
                                                                                                    


// Your energy and reflectivity arrays are correct for the surface.
G4double photonEnergy[nEntries] = {2.239*eV, 2.264*eV, 2.290*eV, 2.316*eV, 2.343*eV,
2.371*eV, 2.399*eV, 2.428*eV, 2.457*eV, 2.488*eV,
2.519*eV, 2.551*eV, 2.584*eV, 2.618*eV, 2.651*eV,
2.687*eV, 2.723*eV, 2.760*eV, 2.799*eV, 2.838*eV};


G4double refl[nEntries] = {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}; // 100% reflectivity
                                                                                                            //
                                                                                                            //

// Add the REFLECTIVITY property to the SURFACE's MPT, not the bulk material's.
reflectorSurfaceMPT->AddProperty("REFLECTIVITY", photonEnergy, refl, nEntries);
reflectorSurfaceMPT->AddProperty("RINDEX", photonEnergy, refractiveIndex_Al, nEntries);
// 3. ASSIGN THE MPT TO THE OPTICAL SURFACE
opreflectorSurface->SetMaterialPropertiesTable(reflectorSurfaceMPT);
auto transition_logical_2 = new G4LogicalVolume(transition_mesh_2_1, reflectorBulkMat, "Alu_kaplama_Logical");
 
// 4. CREATE YOUR LOGICAL VOLUME (using the simple bulk material)
/*auto transition_logical_2 = new G4LogicalVolume( transition_mesh_2->GetSolid(), 
                                                 reflectorBulkMat, // Use the simple bulk material here
                                                 "Alu_kaplama_Logical");*/

// 5. ATTACH THE OPTICAL SURFACE TO THE LOGICAL VOLUME
// This tells Geant4 to use the surface properties for all boundaries of this volume.
new G4LogicalSkinSurface("ReflectorSurface", transition_logical_2, opreflectorSurface);
    /*G4LogicalBorderSurface* reflectorInterface = 1111
    new G4LogicalBorderSurface("ReflectorInterface",
                              fPhysi_LG,  // First physical volume
                              Alu_LG_Kaplama,   // Second physical volume
                              reflectorSurface); // Your optical surface
   */
    G4VisAttributes* ebeninami = new G4VisAttributes(G4Color(0, 15./25., 0. ,0.4));
    ebeninami->SetVisibility(true);
    transition_logical_2->SetVisAttributes(ebeninami); 
    





    auto* fPhysi_reflector = new G4PVPlacement( 0
         , G4ThreeVector(0*cm,0*cm,1*cm) //çağırılacak stl'in konumu
         , transition_logical_2
         , "Reflector"
         , fLogicWorld
         , false, 0);