Hi everyone!

I am new to GRAS, and I am looking for help.

First, it seems I cannot add basic /vis commands in my macro files. For example, basic commands like “/vis/open” or “/vis/scene/create” do not appear to be working, as I always get the same error message : COMMNAND NOT FOUND. Do you have an idea what causes this issue?

Next, I just wanted to ask if there is a way with GRAS to enter the /help command? When using G4 or any other G4 application (like SSAT), when I write /help on the command prompt I get a list of all the possible commands, which is VERY handy for a beginner. Unfortunately, it seems like GRAS can only execute macro file, and has no “command prompt” where I can enter anything else that the usual "gras <macro.g4mac> command.

Thank you so much for your help! There is not a lot of documentation on GRAS, so any help will be extremely appreciated.

I’m afraid we probably can’t usefully help here as GRAS is a third party application, so I would try and contact the GRAS developers here.

All I can suggest is that if it takes a macro input, you could try putting the /help command in a macro and run?

Hi bmorgan,

Thank you for your reply! I just managed to get it working. Here’s what I did:

Before building anything, you’ll find a C++ source file located at gras-XX-XX/source/executable/

All I did was to remove any ifdef G4VIS_USE or ifdef G4_USE condition. For some reason when executing gras, even if UIVIS was set to ON during the cmake building, the program couldn’t pass through these two conditions.

Now it’s working fine. When using gras I can enter the INTERACTIVE mode, and /vis commands work perfectly.

My only problem now is that I cannot keep the visualsation windows open once the simulation is completed. I’ll dig into that now.

Great, glad you got it working! Just to note that the G4UI_USE and G4VIS_USE definitions are no longer required, so you did the right thing there.

Very strange… And yet I used the latest version of GRAS. Anyway, thanks for your time!

Hello @Ospreys
I am having a similar issue.
When I launch GRAS without any command-line arguments I get the standard G4 GUI.
But in batch mode ( gras .mac ), I only get a display of the geometry that closes as soon as the run is over.
In the file I see the variable G4VIS_USE, but how can I pass that variable to GRAS?
There seems to be no way to set it in the macro file.

G4VIS_USE is either (a) always set (with old versions of Geant4), or (b) should be removed (with newer versions of Geant4).

So that is not your problem. Of course, if you run in batch mode it executes the macro and exits. That is what batch does! So it does not make sense to open a viewer in batch mode.

Is there a way to keep the UI open in batch mode for debugging?
I would like to see what the simulation is doing and if my changes to the geometry made sense.
I don’t understand what the workflow for writing macros and gdml is supposed to look like, if can’t see what is going on.

I think I found a workaround.
In the I replaced all code after the comment //get the pointer to the User Interface manager

with the following:
G4UImanager* UImanager = G4UImanager::GetUIpointer();
G4UIExecutive* ui = new G4UIExecutive(argc, argv);

if (argc!=1) { // Batch mode
G4String command = "/control/execute ";
G4String fileName = argv[1];


return 0;