Makefile.include: Difference between revisions

From VASP Wiki
Tag: Manual revert
 
(44 intermediate revisions by 9 users not shown)
Line 8: Line 8:


=== Intel Composer suite and [https://software.intel.com/content/www/us/en/develop/tools/oneapi/all-toolkits.html oneAPI Base + HPC toolkits] for CPUs===
=== Intel Composer suite and [https://software.intel.com/content/www/us/en/develop/tools/oneapi/all-toolkits.html oneAPI Base + HPC toolkits] for CPUs===
* [[makefile.include.oneapi]]
* [[makefile.include.oneapi_omp]]
* [[makefile.include.intel|makefile.include.intel]]: Parallelized using MPI, combined with MKL.
* [[makefile.include.intel|makefile.include.intel]]: Parallelized using MPI, combined with MKL.
* [[makefile.include.intel_omp|makefile.include.intel_omp]]: Parallelized using MPI + OpenMP, combined with MKL.  
* [[makefile.include.intel_omp|makefile.include.intel_omp]]: Parallelized using MPI + OpenMP, combined with MKL.  
Line 32: Line 34:


* [[makefile.include.fujitsu_a64fx|makefile.include.fujitsu_a64fx]]       
* [[makefile.include.fujitsu_a64fx|makefile.include.fujitsu_a64fx]]       
* [[makefile.include.fujitsu_a64fx_omp|makefile.include.fujitsu_a64fx_omp]]
* [[makefile.include.fujitsu_a64fx_omp|makefile.include.fujitsu_a64fx_omp]]  
* [[makefile.include.aocc_ompi_aocl]]
* [[makefile.include.aocc_ompi_aocl_omp]]


An advanced system administrator might benefit from a more detailed discussion about the [[Precompiler options|precompiler options]], [[Compiler options|compiler options]], and [[Linking to libraries|how to link libraries]].
An advanced system administrator might benefit from a more detailed discussion about the [[Precompiler options|precompiler options]], [[Compiler options|compiler options]], and [[Linking to libraries|how to link libraries]].
Line 41: Line 45:
Then, add any optional feature as listed below. For more details see the [[Precompiler options|list of precompiler options]].
Then, add any optional feature as listed below. For more details see the [[Precompiler options|list of precompiler options]].


=== HDF5 support (strongly recommended) ===
=== HDF5 support (strongly recommended, and mandatory for some features) ===
----
----
This is essential for reading and writing HDF5 files, such as {{FILE|vaspout.h5}}.
The HDF5 library is is needed for reading and writing HDF5 files such as {{FILE|vaspin.h5}}, {{FILE|vaspout.h5}} and {{FILE|vaspwave.h5}}.
The HDF5 library is available for download on the [https://www.hdfgroup.org/solutions/hdf5/ HDF5 official website].
The library is available for download on the [https://www.hdfgroup.org/solutions/hdf5/ HDF5 official website].
To activate this feature set the following:
To activate [[:Category:HDF5 support|HDF5 support]] add the following in the VASP <code>makefile.include</code>


  CPP_OPTIONS+= -DVASP_HDF5
  CPP_OPTIONS+= [[Precompiler_options#-DVASP_HDF5|-DVASP_HDF5]]
  HDF5_ROOT  ?= /path/to/your/hdf5/installation
  HDF5_ROOT  ?= /path/to/your/hdf5/installation
  LLIBS      += -L$(HDF5_ROOT)/lib -lhdf5_fortran
  LLIBS      += -L$(HDF5_ROOT)/lib -lhdf5_fortran
Line 53: Line 57:


Available for VASP >{{=}} 6.2.0.
Available for VASP >{{=}} 6.2.0.
{{NB|warning|This is required to perform some features of VASP, e.g. [[:Category:Electron-phonon interactions|electron-phonon coupling]], and is required for py4vasp.}}


=== fftlib (recommended when using OpenMP) ===
=== fftlib (recommended when using OpenMP) ===
----
----
When you plan to [[Hybrid_MPI/OpenMP_parallelization|run VASP on multiple OpenMP threads]] and you are not using the FFTs from the Intel-MKL library, you should link against <tt>fftlib</tt> (included in the VASP distribution).
When you plan to [[Combining MPI and OpenMP|run VASP on multiple OpenMP threads]] and you are not using the FFTs from the Intel-MKL library, you should link against <tt>fftlib</tt> (included in the VASP distribution).
To do so, uncomment the corresponding sections in the makefile.include.*_omp files, ''e.g.'' in makefile.include.gnu_omp:
To do so, uncomment the corresponding sections in the [[#Archetypical files|makefile.include.*_omp files]]. In [[makefile.include.gnu_omp]], for instance, that would be:


  # For the fftlib library (recommended)
  # For the fftlib library (recommended)
Line 69: Line 74:
=== Wannier90 (optional) ===
=== Wannier90 (optional) ===
----
----
Download [http://www.wannier.org Wannier90] and compile <code>libwannier.a</code>.
To include the Wannier90 program, download the library from [http://www.wannier.org the source] and compile <code>libwannier.a</code>.
{{NB|important|In case of Wannier90 3.x, you should compile a serial version by removing <code>COMMS{{=}}mpi</code> in the <code>make.inc</code> of Wannier90.}} Then, execute <code>make lib</code> to build the Wannier90 library. To activate this feature set the following:
{{NB|important|In case of Wannier90 3.x, you should compile a serial version by removing <code>COMMS{{=}}mpi</code> in the <code>make.inc</code> of Wannier90.}} Then, execute <code>make lib</code> to build the Wannier90 library. To activate this feature set the following:


Line 76: Line 81:
  LLIBS          += -L$(WANNIER90_ROOT)/lib -lwannier
  LLIBS          += -L$(WANNIER90_ROOT)/lib -lwannier
{{NB|mind| VASP version <{{=}} 6.1.x are compatible with Wannier90 <{{=}} 1.2. To interface VASP 6.1.x with Wannier90 2.x, set [[Precompiler_options#-DVASP2WANNIER90_and_-DVASP2WANNIER90v2|-DVASP2WANNIER90v2]] instead. As of VASP 6.2.x only Wannier90 2.x and 3.x are supported.}}
{{NB|mind| VASP version <{{=}} 6.1.x are compatible with Wannier90 <{{=}} 1.2. To interface VASP 6.1.x with Wannier90 2.x, set [[Precompiler_options#-DVASP2WANNIER90_and_-DVASP2WANNIER90v2|-DVASP2WANNIER90v2]] instead. As of VASP 6.2.x only Wannier90 2.x and 3.x are supported.}}
=== Libbeef (optional) ===
----
The library of BEEF Van-der-Waals functionals is available for [https://github.com/vossjo/libbeef download on github].
Then, set the following:
CPP_OPTIONS  += [[Precompiler_options#-Dlibbeef|-Dlibbeef]]
LIBBEEF_ROOT ?= /path/to/your/libbeef/installation
LLIBS        += -L$(LIBBEEF_ROOT)/lib -lbeef


=== Libxc (optional) ===
=== Libxc (optional) ===
----
----
You need to download Libxc from [https://www.tddft.org/programs/libxc/download/ the source] and install it. Note that to get correct results with meta-GGA functionals (see discussion at {{TAG|LTBOUNDLIBXC}}), it is necessary to use Libxc from version 5.2.0 onwards (or the master version from [https://gitlab.com/libxc/libxc gitlab] for the latest implemented functionals) and to compile it with the option <code>--disable-fhc</code>. For instance, with GNU Autotools the steps to compile Libxc are
To include the Libxc library of exchange-correlation functionals, install the library from [https://libxc.gitlab.io/download/ the source] and install it. Note that to get correct results with meta-GGA functionals (see discussion at {{TAG|LTBOUNDLIBXC}}), it is necessary to use Libxc from version 5.2.0 onwards (or the master version from [https://gitlab.com/libxc/libxc gitlab] for the latest implemented functionals) and to compile it with the option <code>--disable-fhc</code>. For instance, with GNU Autotools the steps to compile Libxc are
  autoreconf -i (necessary only if Libxc was downloaded from gitlab)
  autoreconf -i (necessary is the executable configure is not already present)
  ./configure --prefix=PATH/TO/LIBXC --disable-fhc
  ./configure --prefix=PATH/TO/LIBXC --disable-fhc
  make
  make
Line 101: Line 97:
  INCS        += -I$(LIBXC_ROOT)/include
  INCS        += -I$(LIBXC_ROOT)/include


=== DFTD4 (optional)===
=== Libbeef (optional) ===
----
----
To include the BEEF van der Waals functionals, install the library from [https://github.com/vossjo/libbeef the source on GitHub] and add the following in the VASP <code>makefile.include</code>


To include the DFTD4 van-der-Waals functional, install the DFTD4 library from [https://github.com/dftd4/dftd4 the source on github].
CPP_OPTIONS  += [[Precompiler_options#-Dlibbeef|-Dlibbeef]]
Then, add the following
LIBBEEF_ROOT ?= /path/to/your/libbeef/installation
LLIBS        += -L$(LIBBEEF_ROOT)/lib -lbeef
 
=== DFT-D4 (optional)===
----
 
To include the [[DFT-D4]] van der Waals method, install the library from [https://github.com/dftd4/dftd4 the source on GitHub] and add the following in the VASP <code>makefile.include</code>


  CPP_OPTIONS += [[Precompiler options#-DDFTD4|-DDFTD4]]  
  CPP_OPTIONS += [[Precompiler options#-DDFTD4|-DDFTD4]]  
  DFTD4_ROOT  ?= /path/to/your/dft4/installation
  DFTD4_ROOT  ?= /path/to/your/dft4/installation
  LLIBS      += -L$(DFTD4_ROOT)/build -ldftd4
  # version 3.6.0 built and installed with meson
  INCS        += -I$(DFTD4_ROOT)/libdftd4.a.p
LLIBS      += $(shell pkg-config --with-path=$(DFTD4_ROOT)/lib64/pkgconfig --libs dftd4)                                                                                                                                                 
INCS        += $(shell pkg-config --with-path=$(DFTD4_ROOT)/lib64/pkgconfig --cflags dftd4)   
# version 3.6.0 and loaded dftd4 module, i.e. PKG_CONFIG_PATH environment variable set correctly
#LLIBS      += $(shell pkg-config --libs dftd4)
#INCS        += $(shell pkg-config --cflags dftd4)
# for dft4-2.3.2 and older
#LLIBS      += -L$(DFTD4_ROOT)/build -ldftd4
  #INCS        += -I$(DFTD4_ROOT)/libdftd4.a.p
{{NB|mind| The compilation of the DFTD4 source code requires a Fortran compiler supporting Fortran 2018 features.}}
 
=== ELPA (optional)===
----
 
To include the ELPA eigenvalue solvers, install the library from [https://gitlab.mpcdf.mpg.de/elpa/elpa the source on GitLab] and add the following in the VASP <code>makefile.include</code>
 
CPP_OPTIONS += -DELPA
ELPA_ROOT  ?= /path/to/your/elpa/installation
LLIBS      += -L$(ELPA_ROOT)/lib -lelpa
INCS        += -I$(ELPA_ROOT)/include/elpa-<version>/elpa
INCS        += -I$(ELPA_ROOT)/include/elpa-<version>/modules
{{NB|mind| In the above you need to replace <code><version></code> by the correct designation of your ELPA version.}}
 
=== libMBD (optional)===
----
 
To include the library libMBD of many-body dispersion methods, install the library from [https://github.com/libmbd/libmbd the source on GitHub] and add the following in the VASP <code>makefile.include</code>
 
CPP_OPTIONS += [[Precompiler options#-DLIBMBD|-DLIBMBD]]
LIBMBD_ROOT ?= /path/to/your/libMBD/installation
LLIBS      += -L$(LIBMBD_ROOT)/build/src -lmbd
INCS        += -I$(LIBMBD_ROOT)/build/src/modules/
{{NB|mind| To run a calculation the path to libmbd.so has to be added (either in .bashrc or in the terminal): LD_LIBRARY_PATH{{=}}$LD_LIBRARY_PATH:/path/to/your/libMBD/installation/build/src}}
 
=== Plugins (optional) ===
Create a new [https://conda.io/projects/conda/en/latest/user-guide/getting-started.html conda] environment. Alternative environment creation packages should work, but we have not tested them.
    conda create -n vasp_plugin python=3.10
Enter the create <code>vasp_plugin</code> conda environment
    conda activate vasp_plugin
Navigate to the <code>plugins</code> directory within VASP source code,
    cd </path/to/vasp/source/code>/src/plugins
Install the VASP Python package through [https://pip.pypa.io/en/stable/installation pip]
    pip install .
{{NB|mind|Make sure to be within the conda environment when you compile VASP.}}
Add the following lines to your <code>makefile.include</code>
    CPP_OPTIONS+= -DPLUGINS
    LLIBS      += $(shell python3-config --ldflags --embed) -lstdc++
    CXX_FLAGS  = $(shell python3 -m pybind11 --includes) -std=c++11
{{NB|mind|When running VASP with the Python interface you will need to add the lib directory of your Python to LD_LIBRARY_PATH. You can do this by running <code>export LD_LIBRARY_PATH{{=}}$LD_LIBRARY_PATH:$(python3-config --prefix)/lib</code>}}


== Related articles ==
== Related articles ==
Line 123: Line 173:


----
----
[[The_VASP_Manual|Contents]]


[[Category:VASP]][[Category:Installation]][[Category:Performance]][[Category:GPU]][[Category:VASP6]]
[[Category:VASP]][[Category:Installation]][[Category:Performance]][[Category:GPU]]

Latest revision as of 13:17, 18 December 2024


Writing a makefile.include file from scratch is not easy, so we suggest taking one of archetypical files that closely resembles your system as a starting point. It is necessary to customize it anyways to set appropriate paths etc. Optionally, you can enable additional features by setting precompiler flags or linking VASP to other libraries. For instance, we strongly recommend enabling HDF5 support.

Archetypical files

The templates contain information such as precompiler options, compiler options, and how to link libraries. Choose the template based on the compiler, parallelization etc. from the list below and mind the description:

Intel Composer suite and oneAPI Base + HPC toolkits for CPUs

GNU compilers for CPUs

NVIDIA HPC-SDK for CPU and GPU

Others

An advanced system administrator might benefit from a more detailed discussion about the precompiler options, compiler options, and how to link libraries.

Customize

Open the selected template of the archetypical files and add the required information as explained in the comments towards the end of the file. Then, add any optional feature as listed below. For more details see the list of precompiler options.

HDF5 support (strongly recommended, and mandatory for some features)


The HDF5 library is is needed for reading and writing HDF5 files such as vaspin.h5, vaspout.h5 and vaspwave.h5. The library is available for download on the HDF5 official website. To activate HDF5 support add the following in the VASP makefile.include

CPP_OPTIONS+= -DVASP_HDF5
HDF5_ROOT  ?= /path/to/your/hdf5/installation
LLIBS      += -L$(HDF5_ROOT)/lib -lhdf5_fortran
INCS       += -I$(HDF5_ROOT)/include

Available for VASP >= 6.2.0.

Warning: This is required to perform some features of VASP, e.g. electron-phonon coupling, and is required for py4vasp.

fftlib (recommended when using OpenMP)


When you plan to run VASP on multiple OpenMP threads and you are not using the FFTs from the Intel-MKL library, you should link against fftlib (included in the VASP distribution). To do so, uncomment the corresponding sections in the makefile.include.*_omp files. In makefile.include.gnu_omp, for instance, that would be:

# For the fftlib library (recommended)
CPP_OPTIONS+= -Dsysv
FCL        += fftlib.o
CXX_FFTLIB  = g++ -fopenmp -std=c++11 -DFFTLIB_THREADSAFE
INCS_FFTLIB = -I./include -I$(FFTW_ROOT)/include
LIBS       += fftlib
LLIBS      += -ldl

Wannier90 (optional)


To include the Wannier90 program, download the library from the source and compile libwannier.a.

Important: In case of Wannier90 3.x, you should compile a serial version by removing COMMS=mpi in the make.inc of Wannier90.

Then, execute make lib to build the Wannier90 library. To activate this feature set the following:

CPP_OPTIONS    += -DVASP2WANNIER90
WANNIER90_ROOT ?= /path/to/your/wannier90/installation
LLIBS          += -L$(WANNIER90_ROOT)/lib -lwannier
Mind: VASP version <= 6.1.x are compatible with Wannier90 <= 1.2. To interface VASP 6.1.x with Wannier90 2.x, set -DVASP2WANNIER90v2 instead. As of VASP 6.2.x only Wannier90 2.x and 3.x are supported.

Libxc (optional)


To include the Libxc library of exchange-correlation functionals, install the library from the source and install it. Note that to get correct results with meta-GGA functionals (see discussion at LTBOUNDLIBXC), it is necessary to use Libxc from version 5.2.0 onwards (or the master version from gitlab for the latest implemented functionals) and to compile it with the option --disable-fhc. For instance, with GNU Autotools the steps to compile Libxc are

autoreconf -i (necessary is the executable configure is not already present)
./configure --prefix=PATH/TO/LIBXC --disable-fhc
make
make install

Then, add the following in the VASP makefile.include

CPP_OPTIONS += -DUSELIBXC
LIBXC_ROOT  ?= /path/to/your/libxc/installation
LLIBS       += -L$(LIBXC_ROOT)/lib -lxcf03 -lxc
INCS        += -I$(LIBXC_ROOT)/include

Libbeef (optional)


To include the BEEF van der Waals functionals, install the library from the source on GitHub and add the following in the VASP makefile.include

CPP_OPTIONS  += -Dlibbeef
LIBBEEF_ROOT ?= /path/to/your/libbeef/installation
LLIBS        += -L$(LIBBEEF_ROOT)/lib -lbeef

DFT-D4 (optional)


To include the DFT-D4 van der Waals method, install the library from the source on GitHub and add the following in the VASP makefile.include

CPP_OPTIONS += -DDFTD4 
DFTD4_ROOT  ?= /path/to/your/dft4/installation
# version 3.6.0 built and installed with meson
LLIBS       += $(shell pkg-config --with-path=$(DFTD4_ROOT)/lib64/pkgconfig --libs dftd4)                                                                                                                                                  
INCS        += $(shell pkg-config --with-path=$(DFTD4_ROOT)/lib64/pkgconfig --cflags dftd4)    
# version 3.6.0 and loaded dftd4 module, i.e. PKG_CONFIG_PATH environment variable set correctly
#LLIBS       += $(shell pkg-config --libs dftd4)
#INCS        += $(shell pkg-config --cflags dftd4)
# for dft4-2.3.2 and older 
#LLIBS       += -L$(DFTD4_ROOT)/build -ldftd4
#INCS        += -I$(DFTD4_ROOT)/libdftd4.a.p
Mind: The compilation of the DFTD4 source code requires a Fortran compiler supporting Fortran 2018 features.

ELPA (optional)


To include the ELPA eigenvalue solvers, install the library from the source on GitLab and add the following in the VASP makefile.include

CPP_OPTIONS += -DELPA
ELPA_ROOT   ?= /path/to/your/elpa/installation
LLIBS       += -L$(ELPA_ROOT)/lib -lelpa
INCS        += -I$(ELPA_ROOT)/include/elpa-<version>/elpa
INCS        += -I$(ELPA_ROOT)/include/elpa-<version>/modules
Mind: In the above you need to replace <version> by the correct designation of your ELPA version.

libMBD (optional)


To include the library libMBD of many-body dispersion methods, install the library from the source on GitHub and add the following in the VASP makefile.include

CPP_OPTIONS += -DLIBMBD 
LIBMBD_ROOT ?= /path/to/your/libMBD/installation
LLIBS       += -L$(LIBMBD_ROOT)/build/src -lmbd
INCS        += -I$(LIBMBD_ROOT)/build/src/modules/
Mind: To run a calculation the path to libmbd.so has to be added (either in .bashrc or in the terminal): LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/your/libMBD/installation/build/src

Plugins (optional)

Create a new conda environment. Alternative environment creation packages should work, but we have not tested them.

   conda create -n vasp_plugin python=3.10

Enter the create vasp_plugin conda environment

   conda activate vasp_plugin

Navigate to the plugins directory within VASP source code,

   cd </path/to/vasp/source/code>/src/plugins

Install the VASP Python package through pip

   pip install .
Mind: Make sure to be within the conda environment when you compile VASP.

Add the following lines to your makefile.include

   CPP_OPTIONS+= -DPLUGINS
   LLIBS      += $(shell python3-config --ldflags --embed) -lstdc++
   CXX_FLAGS   = $(shell python3 -m pybind11 --includes) -std=c++11
Mind: When running VASP with the Python interface you will need to add the lib directory of your Python to LD_LIBRARY_PATH. You can do this by running export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(python3-config --prefix)/lib

Related articles

Installing VASP.6.X.X, Compiler options, Precompiler options, Linking to libraries, OpenACC GPU port of VASP, Toolchains, Validation tests, Known issues