Hi all,
I’ve spent quite a time trying to install Planetocosmics v2 (http://cosray.unibe.ch/~laurent/planetocosmics/). So I’ve made brief an installation guide for Almalinux 9 that worked for me.
For now I will just leave it here:
Installation of planetocosmics 2.0 on Alamlinux 9 (64-bit) from (bash) terminal (with root)
Almalinux 9 config. for install:
(Probably none of these is important, but I used these configs.)
Software selection: workstation
(+ internet applications)
(+ remote desktop clients)
(+ container management)
+ development tools
(+ graphical administration tools)
+ scientific support
KDUMP disabled (for memory save)
Install root (the version was 6.26.10, it seems to work fine with planetocosmics):
sudo dnf install epel-release
sudo dnf install root
sudo dnf install root-cli
Install cshell, gfortran
sudo dnf update
sudo dnf install tcsh
sudo dnf install gcc-gfortran
Create software directory in the $HOME directory:
cd
mkdir software
Save the current bash_profile, just in case…
cp .bash_profile bash_profile_copy
Install clhep in software directory (2.0.2.3 seems to work fine with geant4 8.1.2):
cd
cd software/
wget https://proj-clhep.web.cern.ch/proj-clhep/dist1/clhep-2.0.2.3.tgz
tar -zxvf clhep-2.0.2.3.tgz
wget https://geant4-forum.web.cern.ch/uploads/short-url/aDsk4ChOgPy5c5sI0psHLHpVwFr.txt -O clhep.patch
cd 2.0.2.3
patch -p1 < ../clhep.patch
cd ../
mv 2.0.2.3 clhep_2.0.2.3_src
mkdir clhep_2.0.2.3_install
cd clhep_2.0.2.3_src/CLHEP
./configure --prefix=$HOME/software/clhep_2.0.2.3_install/
make
make check
make install
cd
echo "" >> .bash_profile
echo "# Add CLHEP to library path" >> .bash_profile
echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$HOME/software/clhep_2.0.2.3_install/lib/" >> .bash_profile
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/software/clhep_2.0.2.3_install/lib/
Install geant4 8.1.2
cd
cd software/
wget https://gitlab.cern.ch/geant4/geant4/-/archive/v8.1.2/geant4.8.1.2.tar.gz
tar -zxvf geant4.8.1.2.tar.gz
wget https://geant4-forum.web.cern.ch/uploads/short-url/8URDH7Saa2cJQvmb2KuB5dI8Lxh.txt -O geant4.patch
cd geant4-v8.1.2-3193069717bb38ae4049146a49d7f9ef17715e0b/
patch -p1 < ../geant4.patch
sed -i "s|g77|gfortran|" ./config/sys/Linux-g++.gmk
cd ../
mkdir geant4.8.1.2_install
mv geant4-v8.1.2-3193069717bb38ae4049146a49d7f9ef17715e0b/ geant4.8.1.2_src
cd geant4.8.1.2_src/
mkdir data
cd data
wget http://geant4-data.web.cern.ch/geant4-data/datasets/RadiativeDecay.3.0.tar.gz
wget http://geant4-data.web.cern.ch/geant4-data/datasets/G4EMLOW.4.0.tar.gz
wget http://geant4-data.web.cern.ch/geant4-data/datasets/G4NDL.3.9.tar.gz
wget http://geant4-data.web.cern.ch/geant4-data/datasets/G4ELASTIC.1.1.tar.gz
wget http://geant4-data.web.cern.ch/geant4-data/datasets/PhotonEvaporation.2.0.tar.gz
tar -xzvf RadiativeDecay.3.0.tar.gz
tar -xzvf G4EMLOW.4.0.tar.gz
tar -xzvf G4NDL.3.9.tar.gz
tar -xzvf G4ELASTIC.1.1.tar.gz
tar -xzvf PhotonEvaporation.2.0.tar.gzcd
cd ../
./Configure -build
#Use default parameters (press Enter) for almost every thing, except:
#- Specify the path where Geant4 libraries and source files should be
#installed.
#[path/to/src] $HOME/software/geant4.8.1.2_install
#- CLHEP_BASE_DIR: $HOME/software/clhep_2.0.2.3_install
#- install shared (.so), static (.a) and global libraries without “granular”
#(you should explicitely write “n” when asked about granular libraries)
./Configure -install
cd ../geant4.8.1.2_install/src/geant4/
./Configure
source env.sh
cd
echo "" >> .bash_profile
echo "# Set env. vars for Geant4" >> .bash_profile
echo "cd \$HOME/software/geant4.8.1.2_install/src/geant4/" >> .bash_profile
echo "source env.sh" >> .bash_profile
echo "cd" >> .bash_profile
Compile Packaging
cd
cd software/geant4.8.1.2_install/src/geant4/physics_lists/hadronic/Packaging
make
#if there is an error, than probably the env.sh was not sourced
echo "" >> .bash_profile
echo "# Add Packaging to library path" >> .bash_profile
echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$HOME/software/geant4.8.1.2_install/lib/geant4/plists/Linux-g++/" >> .bash_profile
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/software/geant4.8.1.2_install/lib/geant4/plists/Linux-g++/
Install a new 64-bit version of SPICE (at the moment the version was N0067):
cd
cd software
wget https://naif.jpl.nasa.gov/pub/naif/toolkit//C/PC_Linux_GCC_64bit/packages/cspice.tar.Z
wget https://naif.jpl.nasa.gov/pub/naif/toolkit//C/PC_Linux_GCC_64bit/packages/importCSpice.csh
csh importCSpice.csh
Install planetocosmics 2.0
#Download the source files (planetocosmics_v2.0.tar.gz) and move it to the folder $HOME/software
cd
cd software
tar -xzvf planetocosmics_v2.0.tar.gz
cd planetocosmics
sed -i "s|g77 -O|gfortran -O -std=legacy -fdec -fsecond-underscore|" fortran/earth/*/GNUmakefile
sed -i "s| HepRandom| CLHEP::HepRandom|" src/PLANETOCOSApplicationScenario.cc
sed -i "s|HepRandom|CLHEP::HepRandom|" src/ROOTPartSourceGenerator.cc
sed -i "s|SV(1),SAV(25),SVV(1)|SV(25),SAV(25),SVV(25)|" fortran/earth/atmosphere/msise90_mod.f
sed -i "s|SV(1),SAV(25),SVV(1)|SV(25),SAV(25),SVV(25)|" fortran/earth/atmosphere/nrlmsise00_mod.f
#changes todo in the makefile (‘planetocosmics/makefile_root’) at lines:
#62: “CPPFLAGS += -DUSE_SPICE -I./lib/spice/include” → “CPPFLAGS += -DUSE_SPICE -I…/cspice/include”
#63: “EXTRALIBS += -L./lib/spice/ -lcspice -lcsupport” → “EXTRALIBS += -L…/cspice/lib -l:cspice.a -l:csupport.a”
#65: “EXTRALIBS += -lg2c” → “#EXTRALIBS += -lg2c”
#70: “” → “CPPFLAGS+=-lgfortran”
#70: (optionally) add an empty line after it
#changes to do in src/PlanetAtmosphereModel.cc at lines:
#923: ‘G4cout<<“The flux detection at this altitude will be set”<<’ → ‘G4cout<<“The flux detection at this altitude will be set”<<std::endl;’
#changes to do in src/PLANETOCOSAnalysisManager.cc:
#- insert #include"TROOT.h" after the other includes
#changes to do in src/EarthMagneticField.cc:
#insert a new line after line 340 (astream>>year;
) with the code:
#if (year==0.) {break;} // the "SV" at the end should give 0
./configure root
make
source setupPLANETOCOSMICS.sh
cd
echo "" >> .bash_profile
echo "# Setup planetocosmics" >> .bash_profile
echo "cd \$HOME/software/planetocosmics/" >> .bash_profile
echo "source setupPLANETOCOSMICS.sh" >> .bash_profile
echo "cd" >> .bash_profile
cd geant4
mkdir lib
mkdir lib/Linux-g++
cp tmp/Linux-g++/PLANETOCOSMICS_ROOT/libPLANETOCOSMICS_ROOT.* lib/Linux-g++
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/geant4/lib/Linux-g++/
cd
echo "" >> .bash_profile
echo "# Add planetocosmics shared library to lib path" >> .bash_profile
echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$HOME/geant4/lib/Linux-g++/" >> .bash_profile