Adapting Microsoft MatterGen to Run on Google Colab
A Gentle Introduction to Material Design with Generative AI

MatterGen, a new paradigm for materials design with generative AI, has recently been released by Microsoft. This exciting project, as described in a recent Nature article, utilizes generative AI to streamline the materials discovery process. However, running the code requires access to powerful GPUs, which can be a significant barrier for many researchers.
In this article, I present my work on adapting the MatterGen code to run on Google Colab, a free Jupyter notebook environment with built-in GPU support. Colab provides access to powerful GPUs, essential for running MatterGen’s computationally intensive tasks. This adaptation allows researchers to explore MatterGen without the need for expensive hardware or software licenses.
Adapting the MatterGen Code
To enable MatterGen to run on Colab, I forked the original Microsoft repository and made a few changes. These changes primarily involve modifying the project.toml file to ensure compatibility with the PyTorch whl files available for Nvidia GPUs with CUDA as provided on Colab.
If you’re interested in exploring MatterGen, you can leverage my work as a starting point. The steps followed are identical to what is provided in the MatterGen ReadMe, only adapted for the Colab platform. I also include some ways to download the results files. The results of the crystal structures are cif files which can be viewed on any good crystallography viewer. I like VESTA and Xcrysden, but any other should work just fine.
Below shows one of the returned crystals after prompting MatterGen to generate conditional samples with a target magnetic density of 0.15.

You can also clone my fork of the MatterGen repository on Github at https://github.com/JoshDumo/mattergen.git.
Conclusion
By adapting MatterGen to run on Google Colab, I hope to make this powerful tool more accessible to a wider range of researchers. Feel free to explore and adapt the code in my repository as a launchpad for your own materials discovery endeavors with MatterGen!