I am having trouble creating new materials in Geant4. Below is an example of code causing me issues: when I try to run the code, I am met with a segmentation error. If I change the number of elements to 3 (although there are only 2 in the compound) it does not have this error immediately, but when I try to /run/beamOn it crashes with long fallback errors. I can’t identify any problems here so advice would be appreciated!
Both elements are defined without error with the NIST manager. The code works fine when this part is commented out - is there an error somewhere else this would usually indicate? I cannot understand why including this would crash the code
Can you check in your code whether those “C” and “H” pointers are null? Just because you didn’t get a printed error message doesn’t me everyone is happy
I think @weller identified the problem, but checking for null pointers is generally good practice.