27–31 Mar 2023
CERN
Europe/Zurich timezone

Geant4 Virtual Machine

Installing the Geant4 virtual machine

The Geant4 Virtual Machine provides a recent version of the Geant4 source code, examples and libraries; it includes a compiler and extra software such as a large set of visualisation libraries and analysis tools.  It provides a fully working Geant4 system.

It avoids the effort to find and install the key pieces needed to create an installation on your own system, which varies depending on the OS, its version and many other factors.

This is the only method that we will support for this course.

The following information is a summary of the key steps. Further guidance can be found at the CENBG home of the Geant4 Virtual Machine.

Step 1: Ensure that your machine can run the Geant4 Virtual Machine

Make sure that your computer meets the minimum requirements:

  • Windows or Linux users : desktop or laptop PC running Windows (preferably 10)
  • Linux: desktop or laptop PC with a recent Linux release (able to run VMware workstation for Linux)
  • Mac users : Mac with a recent version of macOS (capable of running the virtualization software below)
  • at least 30 GB of free disk space available
  • at least   4 GB of RAM available for the virtual machine on the PC or Mac - so likely a total of at least 6 or 8 GB installed.

Step 2: Obtain a Virtual Machine 'player'

There is a choice of Virtual machine host software. The following is what we recommend:

  • On Windows you can choose between VMware Player (free for non-commercial, personal and home use) or VMWare Workstation Pro.
  • On Linux the VM Workstation Player can be obtained for use and evaluation.
  • On macOS VMware Fusion has a download for evaluation, but is a commercial product (after the evaluation period of 30 days, a license must be purchased to keep using it).  Note that the versions we found to work are:
    • Fusion 13.0.1, the latest, supports macOS versions 12 Monterey and later (i.e. 13 Ventura);
    • Fusion 12.2.5, supports macOS versions 11 Big Sur and later (i.e. 12 Monterey and 13 Ventura);
    • Fusion 12.1.2, supports macOS versions 10.15 (Catalina) and later (i.e. 11 Big Sur and 12 Monterey);
    • Fusion 11.5.7 for macOS 10.14 (Mojave) or 10.15 (Catalina) download
  • On macOS (Macs with Apple M1/M2 chip) Parallels Desktop has a download for evaluation; it is a commercial product (after the evaluation period of 14 days, a license must be purchased to keep using it).  The versions we found to work is:
  • If you identify issues with the recommended software or versions, please inform us.

Step 3: Obtain the Geant4 virtual machine

Obtain the Virtual machine file which corresponds to your player, and uncompress it:

  • Download the  Geant4 Virtual Machine.  Note that the VM file is quite large (>18 GBytes), and may take a long time to download (will depend greatly on your network bandwidth). 
  • The file to download is located at: 
  • We recommend to start to download it few days before the course, to ensure that you can obtain it, and to familiarize yourself with it.
  • For more information about the Geant4 VM see https://geant4.cenbg.in2p3.fr
  • Note: The current VM is in a single configuration with the AZERTY (French) keyboard layout as default. It can be changed simply to use a QWERTY (US) keyboard layout.  See below.

Step 4: Uncompressing

You need software which can un-compress '7z' files. There are many other choices, such as the popular (de-)compressor WinZip

For Windows such software is available at http://www.7-zip.org/

On macOS you can use the built-in Archive Utility, or either The Unarchiver (free) or the command-line p7zip (installable from brew),  Rar-7zExtractor (paid) and Keka (paid)

On Linux there are several archivers available, as was documented in a article on Geek Stuff and on 7-zip.org 

Step 5: Opening the Virtual Machine

Use the files you downloaded to start a Virtual Machine with Geant4:

For the VMware client, uncompress the archive G4.11.1.1_RockyLinux8.7z choosing a location you remember, e.g. Downloads or /Users/my-username/VirtualMachines

  • You should find a new directory G4.11.1_RockyLinux8 at this location.
  • Check that you can find the following uncompressed files in this directory
G4-11.1.1_Rocky8-Home.vmdk
G4-11.1.1_Rocky8-Softs.vmdk
G4-11.1.1_Rocky8-src-flat.vmdk
G4-11.1.1_Rocky8-src.vmdk
G4-11.1.1_Rocky8.nvram
G4-11.1.1_Rocky8.vmdk
G4-11.1.1_Rocky8.vmx         <----- the key file
G4-11.1.1_Rocky8.vmxf 
  • Open that file using the corresponding program - i.e. use VMware Workstation, VMware Player, or VMware Fusion.
    • G4-11.1.1_Rocky8.vmx
  • Note that you may encounter issues on opening this file:
    • on PC, including Windows and some Linux systems you will likely need to enable features needed for virtualisation in the BIOS.  This is needed if you encounter a message such as "Intel Vtx is disabled..."
    • on earlier versions of macOS, you may get a message like: "Could not open /dev/vmmon: No such file or directory. Please make sure that the kernel module 'vmmon' is loaded." This can be fixed by Opening the "Security and Privacy" dialog of "System Preferences", and from "General" tab looking for the message "System software from developer "VMware, Inc." was blocked from loading." If you click the Allow button, it should resolve the issue (for further details about this topic, please see the item on stackexchange).

For Parallels Desktop, uncompress the archive G4.11.1.1_Rocky9.vpm.zip

  • Load with Parallels Desktop the file G4.11.1.1_Rocky9.pvm.

Note: On macOS you may need to grant access to some resources to Fusion or Parallels -- this may require a reboot.

Step 6: Locate the Geant4 installation and check it

  • The virtual machine will boot.  It will take a few minutes,
  • You should now obtain a (Linux) desktop, which is mostly empty.
    • Its menus can be found in the top left corner (icon and 'Activities').
    • It's keyboard is configured as French 'AZERTY'.  You can change this to 'QWERTY' by using the menu 'Fr' in the top right corner.
    • You can make it full screen using the icon with a rectangle inside a partial four corners.
  • Open a Terminal window using the icon/"Activities":
    • Look for the rectangle with a silver border around a prompt (in this menu) and you use it to obtain a Terminal.
    • You should see a new window, ready to accept your commands
    • It is running the command shell 'tcsh'
  • Locate Geant4
    • The Geant4 installation is located under this path: 
      • /usr/local/geant4.11.1.1
      • echo $G4EXAMPLES
        • /usr/local/geant4.11.1.1/share/Geant4/examples
      • ls $G4EXAMPLES
        • advanced/  basic/  CMakeLists.txt  extended/ .....
  • Build and run an example as an extra check
    • Please try to build the B1 example using the following commands:
cd
mkdir -p geant4/work/buildB1
cd       geant4/work/buildB1
cmake $G4EXAMPLES/basic/B1
make -j4
./exampleB1 exampleB1.in
./exampleB1   
  • DONE

We thank CENBG and CNRS for providing the Geant4 Virtual Machine, which is described in the article Int. J. Model. Simul. Sci. Comput. 1 (2010) 157–178, for updating it regularly and promptly with each production release and patch, and for their helpful collaboration.