1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 2019.2 (Released June 5, 2019) -->
<HTML lang="EN">
<HEAD>
<TITLE>2.5 Libxc library</TITLE>
<META NAME="description" CONTENT="2.5 Libxc library">
<META NAME="keywords" CONTENT="user_guide">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<META NAME="viewport" CONTENT="width=device-width, initial-scale=1.0">
<META NAME="Generator" CONTENT="LaTeX2HTML v2019.2">
<LINK REL="STYLESHEET" HREF="user_guide.css">
<LINK REL="next" HREF="node13.html">
<LINK REL="previous" HREF="node11.html">
<LINK REL="next" HREF="node13.html">
</HEAD>
<BODY >
<!--Navigation Panel-->
<A
HREF="node13.html">
<IMG WIDTH="37" HEIGHT="24" ALT="next" SRC="next.png"></A>
<A
HREF="node7.html">
<IMG WIDTH="26" HEIGHT="24" ALT="up" SRC="up.png"></A>
<A
HREF="node11.html">
<IMG WIDTH="63" HEIGHT="24" ALT="previous" SRC="prev.png"></A>
<A ID="tex2html174"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALT="contents" SRC="contents.png"></A>
<BR>
<B> Next:</B> <A
HREF="node13.html">2.6 Compilation</A>
<B> Up:</B> <A
HREF="node7.html">2 Installation</A>
<B> Previous:</B> <A
HREF="node11.html">2.4 Libraries</A>
<B> <A ID="tex2html175"
HREF="node1.html">Contents</A></B>
<BR>
<BR>
<!--End of Navigation Panel-->
<!--Table of Child-Links-->
<A ID="CHILD_LINKS"><STRONG>Subsections</STRONG></A>
<UL>
<LI><A ID="tex2html176"
HREF="node12.html#SECTION00035100000000000000">2.5.1 Linking in Q<SMALL>UANTUM </SMALL>ESPRESSO</A>
<UL>
<LI><A ID="tex2html177"
HREF="node12.html#SECTION00035110000000000000">2.5.1.1 Note for version 5.0.0:</A>
</UL>
<BR>
<LI><A ID="tex2html178"
HREF="node12.html#SECTION00035200000000000000">2.5.2 Usage</A>
<LI><A ID="tex2html179"
HREF="node12.html#SECTION00035300000000000000">2.5.3 Differences between Libxc and internal functionals</A>
<LI><A ID="tex2html180"
HREF="node12.html#SECTION00035400000000000000">2.5.4 Special cases</A>
<UL>
<LI><A ID="tex2html181"
HREF="node12.html#SECTION00035410000000000000">2.5.4.1 External parameters.</A>
<LI><A ID="tex2html182"
HREF="node12.html#SECTION00035420000000000000">2.5.4.2 Hybrid functionals.</A>
<LI><A ID="tex2html183"
HREF="node12.html#SECTION00035430000000000000">2.5.4.3 Functionals with partial output.</A>
<LI><A ID="tex2html184"
HREF="node12.html#SECTION00035440000000000000">2.5.4.4 Other functionals.</A>
</UL>
<BR>
<LI><A ID="tex2html185"
HREF="node12.html#SECTION00035500000000000000">2.5.5 XC test</A>
</UL>
<!--End of Table of Child-Links-->
<HR>
<H2><A ID="SECTION00035000000000000000">
2.5 Libxc library</A>
</H2>
<P>
Q<SMALL>UANTUM </SMALL>ESPRESSO is compatible with <TT>libxc</TT> version 4.3.0 or later (compatibility with older versions is not guaranteed).
<BR>
The <TT>libxc</TT> 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 <TT>libxc</TT>. Warning messages should appear in the output when particular cases whose correct operation in Q<SMALL>UANTUM </SMALL>ESPRESSO is not guaranteed are chosen.
<P>
<H3><A ID="SECTION00035100000000000000">
2.5.1 Linking in Q<SMALL>UANTUM </SMALL>ESPRESSO</A>
</H3>
Once installed <TT>libxc</TT>, the linking with Q<SMALL>UANTUM </SMALL>ESPRESSO can be enabled directly through the configuration script by adding the two switches <TT>–with-libxc</TT> and <TT>–with-libxc-prefix</TT>, e.g.:
<PRE>
./configure --with-libxc --with-libxc-prefix='/path/to/libxc/'
</PRE>
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 <TT>–with-libxc-include='/path/to/libxc/include'</TT>, which specifies the path to the Fortran headers (usually it is not necessary).
<P>
Alternatively, the link to <TT>libxc</TT> can be activated after the configuration of Q<SMALL>UANTUM </SMALL>ESPRESSO by modifying the <TT>make.inc</TT> file in the main folder in this way:
<UL>
<LI>add <TT>-D__LIBXC</TT> to <TT>DFLAGS</TT>
</LI>
<LI>add <TT>-I/path/to/libxc/include/</TT> to <TT>IFLAGS</TT>
</LI>
<LI>set <TT>LD_LIBS=-L/path/to/libxc/lib/ -lxcf90 -lxc</TT>
</LI>
</UL>
Then Q<SMALL>UANTUM </SMALL>ESPRESSO can be compiled as usual. If the version of <TT>libxc</TT> is older than 5.0.0, the last point must be replaced by:
<UL>
<LI>set <TT>LD_LIBS=-L/path/to/libxc/lib/ -lxcf03 -lxc</TT>
</LI>
</UL>
<H4><A ID="SECTION00035110000000000000">
2.5.1.1 Note for version 5.0.0:</A>
</H4> the <TT>f03</TT> interfaces are no longer available in <TT>libxc</TT> 5.0.0. They have been reintroduced in the current develop version. Version 5.0.0 is still usable, but, before compiling Q<SMALL>UANTUM </SMALL>ESPRESSO, a string replacement is necessary, namely `<TT>xc_f03</TT>' must be repalced with `<TT>xc_f90</TT>' everywhere in the following files: <TT>funct.f90</TT>, <TT>xc_lda_lsda_drivers.f90</TT>, <TT>xc_gga_drivers.f90</TT>, <TT>xc_mgga_drivers.f90</TT>, <TT>dmxc_drivers.f90</TT> and <TT>dgcxc_drivers.f90</TT> in <TT>Modules</TT> folder and <TT>xctest_qe_libxc.f90</TT> in <TT>PP/src</TT> folder.
<P>
<H3><A ID="SECTION00035200000000000000">
2.5.2 Usage</A>
</H3>
In order to use <TT>libxc</TT> functionals, you must enforce them from input by including the <TT>input_dft</TT> string in the <TT>system</TT> namelist. For example, to use the <TT>libxc</TT> version of the PBE functionals (both exchange and correlation):
<PRE>
input_dft = `gga_x_pbe gga_c_pbe'
</PRE>
Capital or lowercase is not relevant, neither the separation between one name and the other. The complete list of <TT>libxc</TT> functionals is available at:
<PRE>
https://www.tddft.org/programs/libxc/functionals/
</PRE>
Combinations of Q<SMALL>UANTUM </SMALL>ESPRESSO and <TT>libxc</TT> functionals are allowed in <TT>PW</TT>, 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 Q<SMALL>UANTUM </SMALL>ESPRESSO together with the correlation term of PBE in <TT>libxc</TT> is obtained by putting:
<PRE>
input_dft = `sla pbe gga_c_pbe'
</PRE>
Note that when using GGA functionals of Q<SMALL>UANTUM </SMALL>ESPRESSO you must always specify the LDA term too, while it is not the case for the <TT>libxc</TT> ones.
<BR>
Outside <TT>PW</TT> (<TT>PHonon</TT>, <TT>PP</TT>, etc.), <TT>libxc</TT> functionals are still usable, but in these cases it is highly recommended to avoid combinations of QE and <TT>libxc</TT> functionals together, since, at present, they may lead to some issues in the dft detection.
<H3><A ID="SECTION00035300000000000000">
2.5.3 Differences between Libxc and internal functionals</A>
</H3>
There are some differences between Q<SMALL>UANTUM </SMALL>ESPRESSO functionals and <TT>libxc</TT> ones. In Q<SMALL>UANTUM </SMALL>ESPRESSO the LDA and the GGA terms are separated and must be specified independently. In <TT>libxc</TT> 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).
<BR>
The <TT>libxc</TT> 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.
<BR>
Some functionals in <TT>libxc</TT> incorporate the exchange part and the correlation one into one term only (e.g. the ones that include the `<TT>_xc</TT>' label in their name). In these cases the whole functional is formally treated as `exchange only' by Q<SMALL>UANTUM </SMALL>ESPRESSO. This does not imply any loss of information.
<H3><A ID="SECTION00035400000000000000">
2.5.4 Special cases</A>
</H3>
A number of <TT>libxc</TT> 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 Q<SMALL>UANTUM </SMALL>ESPRESSO source code.
<H4><A ID="SECTION00035410000000000000">
2.5.4.1 External parameters.</A>
</H4>
Several functionals in <TT>libxc</TT> depend on one or more external parameters. Some of these can be recovered inside Q<SMALL>UANTUM </SMALL>ESPRESSO, some others are not directly available. In all these cases a direct intervention on the Q<SMALL>UANTUM </SMALL>ESPRESSO source code is necessary in order to be able to properly use such functionals.
<BR>
The <TT>libxc</TT> routine <TT>xc_f03_func_set_ext_params</TT> allows to set the value of the external parameters, which are contained in a single array. A trace for the usage of this routine is present, among the comments, in the XC-drivers of Q<SMALL>UANTUM </SMALL>ESPRESSO (in <TT>Modules</TT> folder: <TT>xc_lda_lsda_drivers.f90</TT>, <TT>xc_gga_drivers.f90</TT>, etc.).
<BR>
Without setting the external parameters inside the code, their default value will be assumed. This could lead to results different from the expectations.
To get the default values, the <TT>xc_f03_func_info_get_ext_params_default_value</TT> routine is available in <TT>libxc</TT>. For more details we refer to the official documentation of <TT>libxc</TT>.
<BR>
In any case, when external parameters are needed by the chosen functionals, a warning message will appear in the output of Q<SMALL>UANTUM </SMALL>ESPRESSO.
<H4><A ID="SECTION00035420000000000000">
2.5.4.2 Hybrid functionals.</A>
</H4> The hybrid functionals of <TT>libxc</TT> are allowed, but, as in the previous case, their correct operation is not guaranteed by default. It is important to ensure that the <TT>exx_fraction</TT> in Q<SMALL>UANTUM </SMALL>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 <TT>exx_fraction</TT> in Q<SMALL>UANTUM </SMALL>ESPRESSO , which is set in the <TT>matching_libxc</TT> routine in <TT>Modules/funct.f90</TT>, is the desired one (<TT>exx_fraction</TT> may not always coincide with the <TT>exx_coef</TT> of <TT>libxc</TT>).
<H4><A ID="SECTION00035430000000000000">
2.5.4.3 Functionals with partial output.</A>
</H4>
A few <TT>libxc</TT> functional routines provides the energy and some others the potential only, but not both of them. At present, Q<SMALL>UANTUM </SMALL>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.
<H4><A ID="SECTION00035440000000000000">
2.5.4.4 Other functionals.</A>
</H4> Besides exchange (<TT>_x</TT>), correlation (<TT>_c</TT>) and exchange plus correlation (<TT>_xc</TT>), a fourth kind of functionals is available in <TT>libxc</TT>, the kinetic functionals (<TT>_k</TT>). At present, they are not usable in Q<SMALL>UANTUM </SMALL>ESPRESSO.
<H3><A ID="SECTION00035500000000000000">
2.5.5 XC test</A>
</H3>
A simple testing program, <TT>xctest_qe_libxc.f90</TT>, for the XC part of Q<SMALL>UANTUM </SMALL>ESPRESSO is available in the <TT>PP/src</TT> folder.
<BR>
The program tests the output (energies and potentials) of the XC-driver routines by comparing the results obtained with the Q<SMALL>UANTUM </SMALL>ESPRESSO internal library of XC functionals with those obtained with the <TT>libxc</TT> library.
<BR>
It also tests the XC-derivative part (mainly used in PHonon) by comparing the QE derivative of the XC potential (for LDA and GGA) with the <TT>libxc</TT> one.
<P>
<HR>
<!--Navigation Panel-->
<A
HREF="node13.html">
<IMG WIDTH="37" HEIGHT="24" ALT="next" SRC="next.png"></A>
<A
HREF="node7.html">
<IMG WIDTH="26" HEIGHT="24" ALT="up" SRC="up.png"></A>
<A
HREF="node11.html">
<IMG WIDTH="63" HEIGHT="24" ALT="previous" SRC="prev.png"></A>
<A ID="tex2html174"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALT="contents" SRC="contents.png"></A>
<BR>
<B> Next:</B> <A
HREF="node13.html">2.6 Compilation</A>
<B> Up:</B> <A
HREF="node7.html">2 Installation</A>
<B> Previous:</B> <A
HREF="node11.html">2.4 Libraries</A>
<B> <A ID="tex2html175"
HREF="node1.html">Contents</A></B>
<!--End of Navigation Panel-->
</BODY>
</HTML>
|