View on GitHub


A code for lattice simulations of scalar and gauge field dynamics in an expanding universe


What is CosmoLattice?

CosmoLattice is a modern package for lattice simulations of field dynamics in an expanding universe. We have developed CosmoLattice to provide a new up-to-date, relevant numerical tool for the scientific community working in the physics of the early universe.

The current version of CosmoLattice (version 1.0) can simulate the dynamics of i) interacting scalar field theories, ii) Abelian U(1) gauge theories, and iii) non-Abelian SU(2) gauge theories, either in flat spacetime or an expanding FLRW background, including the case of self-consistent expansion sourced by the fields themselves. CosmoLattice is ready to simulate the dynamics of field theories described by an action and a background metric of the type:

We have conceived CosmoLattice as an evolving package that we plan to upgrade successively, by further developing modules for new tasks. To mention just a few, we plan to add e.g. the computation of gravitational waves (now in development), new initialization routines, and different evolution algorithms. CosmoLattice is in fact a platform to implement any system of dynamical equations suitable for discretization on a lattice, as it introduces its own language describing fields and operations between them, and hence it is a natural platform to implement new libraries to solve arbitrary field problems (related or not to cosmology).

Some features:

CosmoLattice incorporates a series of features that makes it very versatile and powerful. We list some of them:


Basic installation

Minimal requirements: CMake version 3 or above, g++ version 5 or above, fftw3.

git clone
cd cosmolattice   
mkdir build                     
cd build                        
cmake -DMODEL=lphi4 ../
make cosmolattice

This will compile the lphi4 model. To run it with the default input file, you can do

./lphi4 input=../src/models/parameter-files/

The above commands just represent a very brief guide for the installation and execution of CosmoLattice. For further information, see Appendix A of the user-manual. All options of CosmoLattice, as well as how to activate them and how to install the optional external libraries are explained at length there.

If you use CosmoLattice


CosmoLattice can be downloaded from the GitHub repository: cosmolattice/cosmolattice

Mailing list

We have created a mailing list in order to share information on new updates, report bugs, inform about events, etc. In order to subscribe, send a blank e-mail to:



If you have any questions or comments about CosmoLattice, please send us an e-mail to:,,