next up previous contents
Next: 2.7 Compilation Up: 2 Installation Previous: 2.5 Libraries Contents

Subsections

2.6 Libxc library

QUANTUM ESPRESSO is compatible with libxc version 4.3.0 or later (compatibility with older versions is not guaranteed).
The libxc functionals are available for LDA, GGA and metaGGA, however, not all of them are straightforwardly usable. Some of them may depend on specific external parameters and some others may provide as output the energy or the potential, but not both. Therefore some attention has to be paid when using libxc. Warning messages should appear in the output when particular cases whose correct operation in QUANTUM ESPRESSO is not guaranteed are chosen.

2.6.1 Linking in QUANTUM ESPRESSO

Once installed libxc, the linking with QUANTUM ESPRESSO can be enabled directly through the configuration script by adding the two switches –with-libxc and –with-libxc-prefix, e.g.:
./configure --with-libxc --with-libxc-prefix='/path/to/libxc/'
By adding the first switch only an automatic search for the libxc folder will be attempted, but its success is not guaranteed. It is always preferable to specify the second switch too. Optionally, a third switch can be added, namely –with-libxc-include='/path/to/libxc/include', which specifies the path to the Fortran headers (usually it is not necessary).

Alternatively, the link to libxc can be activated after the configuration of QUANTUM ESPRESSO by modifying the make.inc file in the main folder in this way:

Then QUANTUM ESPRESSO can be compiled as usual.

2.6.1.1 Note for version 5.0.0:

if the version of libxc is 5.0.0, the last point must be replaced by: since the f03 interfaces are no longer available. They have been restored in following releases. Version 5.0.0 is still usable, but, before compiling QUANTUM ESPRESSO, a string replacement is necessary, namely `xc_f03' must be replaced with `xc_f90' everywhere in the XClib folder.

2.6.2 Usage

In order to use libxc functionals, you must enforce them from input by including the input_dft string in the system namelist. For example, to use the libxc version of the PBE functionals (both exchange and correlation):
input_dft = `gga_x_pbe gga_c_pbe'
Capital or lowercase is not relevant, neither the separation between one name and the other. The complete list of libxc functionals is available at:
https://www.tddft.org/programs/libxc/functionals/
Combinations of QUANTUM ESPRESSO and libxc functionals are allowed in PW, but some attention has to be paid to their reciprocal compatibility (see section below). In these cases, again, the functionals must be enforced from input. For example, the exchange term of PBE in QUANTUM ESPRESSO together with the correlation term of PBE in libxc is obtained by putting:
input_dft = `sla pbe gga_c_pbe'
Note that when using GGA functionals of QUANTUM ESPRESSO you must always specify the LDA term too, while it is not the case for the libxc ones.

2.6.3 Differences between Libxc and internal functionals

There are some differences between QUANTUM ESPRESSO functionals and libxc ones. In QUANTUM ESPRESSO the LDA and the GGA terms are separated and must be specified independently. In libxc the GGA functionals already include the LDA part (Slater exchange and Perdew&Wang correlation in most of the cases with the exception, for example, of Lee Yang Parr functionals).
The libxc metaGGA functionals may or may not need the LDA and GGA terms, depending on the cases, therefore a good check of the chosen functionals is recommended before doing expensive runs.
Some functionals in libxc incorporate the exchange part and the correlation one into one term only (e.g. the ones that include the `_xc' kind label in their name). In these cases the whole functional is formally treated as `exchange only' by QUANTUM ESPRESSO. This does not imply any loss of information.

2.6.4 Special cases

A number of libxc functional routines need extra information on input and/or provide only partial information on output (e.g. the energy or the potential only). In these cases the use of such functionals may not be straightforward and, depending on the cases, may require some work on the QUANTUM ESPRESSO source code.

2.6.4.1 External parameters.

Several functionals in libxc depend on one or more external parameters. Some of these can be recovered inside QUANTUM ESPRESSO, some others are not directly available. In all these cases a direct intervention on the QUANTUM ESPRESSO source code might be necessary in order to be able to properly use such functionals. However two routines have been defined in the XC library of QUANTUM ESPRESSO that ease the task of setting and recovering the external parameters in libxc: In order to see the available parameters for a given libxc functional and their corresponding indexes, the dft_info test is available as an option of the xclib_test.x program in XClib folder. For more details see Sec. 2.6.5.
The two routines can be called almost anywhere in QUANTUM ESPRESSO, however, as any other XClib setting routine, they must be declared through the xc_lib module.
Without setting the external parameters inside the code, their default value will be assumed. This could lead to results different from the expectations.
In any case, when external parameters are needed by the chosen functionals, a warning message will appear in the output of QUANTUM ESPRESSO.

2.6.4.2 Hybrid functionals.

The hybrid functionals of libxc are allowed, but, as in the previous case, their correct operation is not guaranteed by default. It is important to ensure that the exx_fraction in QUANTUM ESPRESSO assumes the desired value when the XC routines are called. To do this you need to act on the external parameters of the functionals, as explained previously. Moreover it is important to ensure that the starting value of the variable exx_fraction in QUANTUM ESPRESSO , which is set in the matching_libxc routine in Modules/funct.f90, is the desired one (exx_fraction may not always coincide with the exx_coef of libxc).

2.6.4.3 Functionals with partial output.

A few libxc functional routines provides the energy and some others the potential only, but not both of them. At present, QUANTUM ESPRESSO, assumes that both the energy and the potential are provided when a XC-functional routine is called, therefore, in order to use these functionals, some modifications on the code will be necessary.

2.6.4.4 Other functionals.

Besides exchange (_x), correlation (_c) and exchange plus correlation (_xc), a fourth kind of functionals is available in libxc, the kinetic functionals (_k). At present, they are not usable in QUANTUM ESPRESSO.


2.6.5 XC test

A testing program, xclib_test.x, for the XClib library of QUANTUM ESPRESSO is available. Three options: The testing program is available for LDA, GGA and MGGA functionals. It also tests the potential derivatives for LDA (dmxc) and GGA (dgcxc).


next up previous contents
Next: 2.7 Compilation Up: 2 Installation Previous: 2.5 Libraries Contents