How to Create a Named Collection of Modules?

I have multiple projects I’m working on and realize that hard-coded lists of modules in my .bashrc file does not work well across those projects. I’d like a better solution. What can be done about this?

(Originally posted by mhanby, I moved it to a reply)

Instead of hard coding a list of modules to load in your ~/.bashrc file, which isn’t portable across different workflows, consider using Lmod Modules User Collections.

To create a User Collection, use the module load and module unload commands to configre the module environment that you would like to save.

Verify the configuration with the module list command.

Create the user collection as follows (replace <collection_name> with the desired name):

$ module save <collection_name>

If you omit the collection name and simply run module save it will create one named default. The user collections are stored in ~/.lmod.d/<collection_name>.

To load a collection (restore):

$ module restore <collection_name>

And to view the contents of a collection:

$ module describe <collection_name>

To list your user collections:

$ module savelist