Whenever I created the material I have named Mold my simulation outputs a segment fault. I am confused as to why this is happening and any help is appreciated.
Not enough information in that code snippet. Which line has the segfault?
Have you checked that all five of the materials you make use of were defined before this point in your code?
I am unsure of which line has the segment fault, whenever I run the code the output is “C:\dev\Geant4\geant4-v11.3.0-install\share\Geant4\geant4make\shielding\build\Release\shielding.exe (process 6400) exited with code -1073741819 (0xc0000005).” I am running the code through visual studio 2022.
I have attached my definition of the materials here:
I solved the problem by converting all of my arguments in the second position of the FindOrBuildElement function to percentages. This made my program run without a 0xC0000005 error, the only question left on this thread is why did I need to make a conversion from a number argument to a percentage argument.
A quick example of what I mean:
SiO2 -> AddElement(nist -> FindOrBuildElement("C"), 1);
//convert to this form:
SiO2 -> AddElement(nist -> FindOrBuildElement("C"), 33.33*perCent);