Nonlinear Conjugate Gradient for Orbital Free Density Functional Theory.

Purpose of Module

The program performs Orbital-Free Density Functional Theory Molecular Dynamics (OF-DFT-MD) using the Born-Oppenheimer approach. The condition that the system relaxes instantaneously to the ground state is enforced, at each time step, finding the minimum of the energy for a given nuclear configuration using a nonlinear conjugate gradient method. The results of these simulations are used as benchmarks in [BONELLA2020a] and in the simulations presented in Alessandro Coretti’s Ph.D. thesis. The computation of the electronic density is carried on in reciprocal space through a plane-waves expansion so that the electronic degrees of freedom are represented by the Fourier coefficients of the electronic density field. The evolution of the ions is performed using Velocity-Verlet algorithm.

The code is intended for condensed matter physicists and for material scientists and it can be used for various purposes related to the subject. Even though some analysis tool is included in the package, the main goal of the software is to produce particles trajectories to be analyzed in post-production by means of external software.

In computing trajectories, the orbital-free DFT is intended to stand in the middle between force-field based MD and Kohn-Sham MD in terms of efficiency and accuracy. Indeed, while the forces are computed on-the-fly at each timestep, the optimization is done on the electronic density field instead of the Kohn-Sham orbitals. This feature avoids the need for satisfying the orthonormality constraint among orbitals and allows the computational complexity of the code to scale linearly with the dimensionality of the system. On the other hand, no information on the orbitals is available. The accuracy of the simulation relies on the choice of the kinetic energy functional, which has to be provided in terms of the electronic density alone.

Background Information

The module is standalone and only relies on the libraries discussed in the next section.


The execution of the code depends on the following libraries:

  • FFTW: a library for computing the discrete Fourier transform;
  • Libxc: a library of exchange-correlation functionals for density-functional theory;
  • BLAS: a library that provides standard building blocks for performing basic vector and matrix operations;
  • Argp: an interface for parsing unix-style argument vectors;

On macOS, Homebrew is strongly recommended to install compiler and dependencies.

The installation is based on a Makefile. A few machine dependent variable must be defined in the file ‘./’ prior to invoking the make utility. Examples can be found in the ‘./configuration_files/’ folder. The structure of the ‘./’ file is as follows:

#Compiler Configuration
#Compiler command
CC     =
#Compiler options
#Includefiles linkers
#Libraries linkers
LIBS   =

#Test configuration
#Python command
TEST     =

The command make will then build the executables. The command make clean cleans the files resulting from the compilation. Detailed documentation can be build using Doxygen through the command make documentation. The whole suite of regression tests can be run through the command make tests.


Tests for the code and for regressions are launched through a python script which can be found in ‘./tests/’. Move into this folder and run python -s CG. The scripts can take other options in order to launch different suites of tests. Default is ‘all’ which can take up to 20 minutes. Run python --help for more information on regression tests script.

By default the script tests an MD simulation of solid Sodium using different parameters:

  • Pseudopotential: ‘Gaussian (Gauss)’ pseudopotential and ‘Topp and Hopfield (Topp)’ pseudopotential;
  • Jacob’s ladder rung: ‘LDA’ for Local Density Approximation and ‘GGA’ for Generalized Gradient Approximation. The approximation refers only to the kinetic functional which is ‘Thomas-Fermi (TF)’ for LDA and ‘Thomas-Fermi plus von Weiszaecker correction (TFvW)’ and ‘Perrot’ functional for GGA;
  • Kinetic functional: As above ‘Thomas-Fermi (TF)’, ‘Thomas-Fermi plus von Weiszaecker correction (TFvW)’ and ‘Perrot’ functionals;

All the simulation in the tests are run using a Slater exchange functional and no correlation functional.

The subfolders inside ‘./tests’ can also be conveniently used as examples and references for the format of the input file ‘runtime.inpt’ and of the configuration file ‘configuration.inpt’.

Source Code

The source code is available from the E-CAM Gitlab under the MaZe project.

The repository contains the following directories:

  • ./source/: contains the source code. The subfolder ‘./source/headers/’ contains the modules’ headers, while the subfolder ‘./source/obj/’ is used for compilation file outputs;
  • ./tests/: contains regression tests;
  • ./scripts/: contains useful python scripts to run simulations over different sets of parameters;
  • ./documentation/: contains the documentation generated with Doxygen together with the wiki of the project;
  • ./configuration_files/: contains examples of configuration files to generate the executable on different machines;


[BONELLA2020a]Phys. Chem. Chem. Phys., 2020, 22, 10775-10785