I’m installing Gromacs 2022.2 on an HPC cluster, where we use lmod-style modules for managing most software. Lmod is a scheme where, when you “load” a module, it changes the environment variables (PATH, LD_LIBRARY_PATH, etc.) so that the software you want to access is reachable, and it has a nice thing where when you “unload” a module, it reverts the paths back to their prior state.
Gromacs has the GMXRC scheme, which looks very cool – is it also reversible?
To use the lmod scheme, I could just call GMXRC from the module file at load-time, and then call its inverse (if it has one?) at unload-time.
Or maybe someone already has an lmod-style module file for gromacs?
GMXRC is not fully reversible. However, it correctly clears the old variables when a new GMXRC is loaded so that you can replace one version of GROMACS with the other. This is what makes up most of the code in GMXRC.bash 😁.
On our cluster, we extract (manually) the necessary variables from GMXRC and set them with prepend-path. The rest depends on how your module system is set up and how you want to manage different GROMACS versions (different modulefiles, symlinks, variants).
Actually I was wondering about the same, so it was good to know what is being done on the cluster used by the GROMACS core team. Manually replicating the GMXRC variables is tedious but helps also customizing the module beyond what GMXRC provides, e.g. to handle different builds, patched versions, etc.
A simpler alternative for a sysadmin (who needs to maintain modules for many packages these days!) could also be to define a “sticky” module like this:
Thanks, this looks like a good option! I’ll also explore the variables “manually” – it’s easy enough to diff the environment before and after. Bash-completion is harder, but also less important in a batch/queuing context, and less important to reverse.