G4ENSDFSTATEDATA environment variable must be set

I managed to install Geant4 and I am able to run some example. Despite this, when trying to execute a program of mine, I am facing this output error



          ################################
          !!! G4Backtrace is activated !!!
          ################################


-------- EEEE ------- G4Exception-START -------- EEEE -------
*** G4Exception : PART70000
      issued by : G4NuclideTable
G4ENSDFSTATEDATA environment variable must be set
*** Fatal Exception *** core dump ***

### CAUGHT SIGNAL: 11 ### address: 0x10,  signal =  SIGSEGV, value =   11, description = segmentation violation. Address not mapped to object.

Backtrace:
[PID=22415, TID=-1][ 0/14]> 0   ???                                 0x00000000b955e020 0x0 + 3109412896
[PID=22415, TID=-1][ 1/14]> 1   libG4run.dylib                      0x00000001079c5f22 _ZN18G4ExceptionHandler6NotifyEPKcS1_19G4ExceptionSeverityS1_ + 1202
[PID=22415, TID=-1][ 2/14]> 2   libG4global.dylib                   0x0000000108f3bc30 _Z11G4ExceptionPKcS0_19G4ExceptionSeverityS0_ + 64
[PID=22415, TID=-1][ 3/14]> 3   libG4particles.dylib                0x000000010842d6a9 _ZN14G4NuclideTableC2Ev + 217
[PID=22415, TID=-1][ 4/14]> 4   libG4particles.dylib                0x000000010842d58a _ZN14G4NuclideTable15GetNuclideTableEv + 58
[PID=22415, TID=-1][ 5/14]> 5   libG4particles.dylib                0x0000000108416944 _ZN10G4IonTableC1Ev + 164
[PID=22415, TID=-1][ 6/14]> 6   libG4particles.dylib                0x000000010843850b _ZN15G4ParticleTableC2Ev + 283
[PID=22415, TID=-1][ 7/14]> 7   libG4particles.dylib                0x0000000108437eff _ZN15G4ParticleTable16GetParticleTableEv + 127
[PID=22415, TID=-1][ 8/14]> 8   libG4run.dylib                      0x00000001079e1814 _ZN18G4RunManagerKernelC2Ev + 388
[PID=22415, TID=-1][ 9/14]> 9   libG4run.dylib                      0x00000001079d205f _ZN12G4RunManagerC2Ev + 351
[PID=22415, TID=-1][10/14]> 10  sim                                 0x00000001069b035a main + 42
[PID=22415, TID=-1][11/14]> 11  dyld                                0x000000010a79d4fe start + 462
[PID=22415, TID=-1][12/14]> 12  ???                                 0x0000000000000000 0x0 + 0
[PID=22415, TID=-1][13/14]> 13  sim                                 0x00000001069a1000 __dso_handle + 0

zsh: abort      ./sim

I saw this post Problems running on server and did what it says but after redirecting everything I got stuck in



          ################################
          !!! G4Backtrace is activated !!!
          ################################


**************************************************************
 Geant4 version Name: geant4-11-00 [MT]   (10-December-2021)
                       Copyright : Geant4 Collaboration
                      References : NIM A 506 (2003), 250-303
                                 : IEEE-TNS 53 (2006), 270-278
                                 : NIM A 835 (2016), 186-225
                             WWW : http://geant4.org/
**************************************************************


-------- EEEE ------- G4Exception-START -------- EEEE -------
*** G4Exception : Run0034
      issued by : G4RunManager::InitializePhysics()
G4VUserPhysicsList is not defined!
*** Fatal Exception *** core dump ***
 **** Track information is not available at this moment
 **** Step information is not available at this moment

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


*** G4Exception: Aborting execution ***

### CAUGHT SIGNAL: 6 ### address: 0x7ff810f1e112,  signal =  SIGABRT, value =    6, description = abort program (formerly SIGIOT). 

Backtrace:
[PID=23508, TID=-1][0/8]> 0   ???                                 0x3fb999999999999a 0x0 + 4591870180066957722
[PID=23508, TID=-1][1/8]> 1   libsystem_c.dylib                   0x00007ff810ea0d10 abort + 123
[PID=23508, TID=-1][2/8]> 2   libG4global.dylib                   0x000000010b12d73a _Z11G4ExceptionPKcS0_19G4ExceptionSeverityS0_.cold.1 + 42
[PID=23508, TID=-1][3/8]> 3   libG4global.dylib                   0x000000010b1015fb _Z11G4ExceptionPKcS0_19G4ExceptionSeverityS0_ + 2571
[PID=23508, TID=-1][4/8]> 4   libG4run.dylib                      0x0000000109b9a382 _ZN12G4RunManager17InitializePhysicsEv + 114
[PID=23508, TID=-1][5/8]> 5   libG4run.dylib                      0x0000000109b9a143 _ZN12G4RunManager10InitializeEv + 275
[PID=23508, TID=-1][6/8]> 6   sim                                 0x0000000108b75387 main + 87
[PID=23508, TID=-1][7/8]> 7   dyld                                0x00000001151a74fe start + 462

zsh: abort      ./sim

I really do not know what to do. Any help would be extremely appreciated.

The post that you referenced ( Problems running on server ) is from June 2019. It assumed Geant4 10.5.1 was installed, which used data directory G4NDL4.5. Hence the fix for that problem was:
export G4NEUTRONHPDATA=/usr/local/share/Geant4-10.5.1/data/G4NDL4.5

You are using Geant4 11.0.0 which uses G4NDL4.6 data directory. So your command should have been something like:
export G4NEUTRONHPDATA=/pathtodatadirectory/data/G4NDL4.6

Is that what you did?

I did the exports to the updated directories yes.

I did not export G4NEUTRONHPDATA as It did not ask me. It keeps stuck in G4VUserPysicsList not defined.

Thanks for the quick answer!

If the physics list is undefined, then you didn’t register a physics list in your main(). Take a look at any of the examples.

Thanks! It worked. Is this maybe something from G4-v11? I am running a program that I made in G4-v10.07 and there it worked.

You were able to run a Geant4 application without a physics list registered? So far as I know, that’s never been true (going back to at least 9.4).

I was following this tutorial

In the very first steps, it has no physics list, I think.

I can say: if you go to unofficial tutorials, you are on your own. The canonical installation and development recommendations are on - and only on - the Geant4 web site.

Youtube videos can be very helpful - I have have used them to mend my old iPhone and my washing machine. But it’s not how Geant4 does this. It is impossible to validate them and keep them up to date. Please, consult the official documentation.

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