Installing Quantum ESPRESSO (total energy module)
Prerequisites
To build and run the total energy module, you need a full Quantum ESPRESSO
installation, for which to install the Python bindings. This module has been
tested with version 7.2., the most recent version at the time of this
release of MALA. Newer versions may work (untested), but installation
instructions may vary.
Note
The build_total_energy_module.sh script uses meson and ninja
as a build system, which may cause problems with older python versions
(i.e., 3.10.* and 3.11.*). If you encounter problems, please use
build_total_energy_module_legacy.sh located in the same folder.
Make sure you have an (MPI-aware) F90 compiler such as mpif90 (e.g.
Debian-ish machine: apt install openmpi-bin, on an HPC cluster something
like module load openmpi gcc). Make sure to use the same compiler
for QE and the extension. This should be the default case, but if problems
arise you can manually select the compiler via
--f90exec= in build_total_energy_module.sh
We assume that QE’s configure script will find your system libs, e.g. use
-lblas, -llapack and -lfftw3. We use those by default in
build_total_energy_module.sh. If you have, say, the MKL library,
you may see configure use something like -lmkl_intel_lp64 -lmkl_sequential -lmkl_core
when building QE. In this case you have to modify
build_total_energy_module.sh to use the same libraries!
Build Quantum ESPRESSO
Download QE 7.2:
https://gitlab.com/QEF/q-e/-/releases/qe-7.2Change to the main QE directory (default:
q-e-qe-7.2, you can rename this directory as you wish)Run
./configure CFLAGS="-fPIC" CPPFLAGS="-fPIC" FFLAGS="-fPIC"Run
make all(usemake -j<your number of cores> allfor a faster compilation process).Change to the
external_modules/total_energy_moduledirectory of the MALA repository
Note
At the moment, building QE using cmake doesn’t work together with the
build_total_energy_module.sh script. Please use the
configure + make build workflow.
Installing the Python extension
Run
build_total_energy_module.sh /path/to/your/q-e.If the build is successful, a file named something like
total_energy.cpython-39m-x86_64-linux-gnu.sowill be generated. This is the Python extension module.
Add the
external_modules/total_energy_moduledirectory to your Python path, e.g. viaexport PYTHONPATH=/path/to/mala/external_modules/total_energy_module:$PYTHONPATHNow you can use
import total_energyto access the total energy moduleThe MALA test suite will test the total energy module