Geant4 problem while running

I am trying to run a code, but there appears this error message:

-------- EEEE ------- G4Exception-START -------- EEEE -------
*** G4Exception : mat035
issued by : G4Material::AddMaterial()
Attempt to add more than the declared number of components.
*** Fatal Exception *** core dump ***
**** Track information is not available at this moment
**** Step information is not available at this moment

-------- EEEE -------- G4Exception-END --------- EEEE -------

What is strange is that i can’t see any error in the lines involving AddMaterial. See, the only line involving G4MATERIAL ADDMATERIAL is:

>   double densidadenicr = 8.4*g/cm3;
>  auto Nicromo = new G4Material("Nichrome", densidadenicr, 2);
>     Nicromo->AddMaterial(Niquel,  77*perCent); 
>     Nicromo->AddMaterial(Cromo, 23*perCent);

Could you help me?

1 Like

Hello @9Lucas1Santos9,

if those are all the lines you have for your material definition you have not told G4 who/what “Niquel” and “Cromo” are.

You can see what I mean by looking at this is an old slide (page 10 to page 12).


Hello @pico , In fact, i have defined it, see, i will post here the complete code envolving the definitions of materials and etc.

auto Aluminio = G4NistManager::Instance()->FindOrBuildMaterial("G4_Al");
    auto Ouro = G4NistManager::Instance()->FindOrBuildMaterial("G4_Au");
    auto Ar = G4NistManager::Instance()->FindOrBuildMaterial("G4_AIR");
    auto Niquel = G4NistManager::Instance()->FindOrBuildMaterial("G4_Ni");
    auto Cromo = G4NistManager::Instance()->FindOrBuildMaterial("G4_Cr");
    auto Nicromo = new G4Material("Nichrome", densidadenicr, 2);
    auto Argonio = G4NistManager::Instance()->FindOrBuildMaterial("G4_Ne");
    auto Metano = G4NistManager::Instance()->FindOrBuildMaterial("G4_METHANE");
    double temperaturagas = 300*kelvin;
    double pressaogas = 1*atmosphere;
    double densidadegas = 20.17976*760/(62,3637*300)*g/L;
    auto Gas = new G4Material("Gás", 10,20,densidadegas,kStateGas,temperaturagas,pressaogas);
    auto Vacuo = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic");

As you can see, i have defined everything, but i don’t know yet why the error is happening.

I am afraid that the problem has nothing to do with the materials in fact.

I think the problem is with the “Gás”. By using the constructor with string, int, int … you are using a constructor that will try to be a z=10, A=20 (Ne-20) gas.
You want to use it as:

auto Gas = new G4Material("Gás", densidadegas, 2, kStateGas,temperaturagas,pressaogas);

Notice that I do not have 10 and 20 (what are they supposed to represent?) and I have a 2 where the number of components go.


1 Like

Very nice. It worked now. I really appreciate your help, thank you my friend.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.