<div dir="ltr">Dear CP2K users and developers,<div><br></div><div>Since we got several requests for LIBXC-4.0 support for the current release of CP2K (5.1), a patch has been prepared (Thanks to Axel Kohlmeyer).</div><div>You can fetch the patch directly from here:</div><div><br></div><div><a href="https://www.cp2k.org/static/downloads/patches/patch_cp2k-5.1_libxc-4.0.4-support.diff">https://www.cp2k.org/static/downloads/patches/patch_cp2k-5.1_libxc-4.0.4-support.diff</a><br></div><div><br></div><div>To apply the patch follow this procedure:</div><div><ul><li>Download and compile LIBXC-4.0 (see eg.: <a href="http://octopus-code.org/wiki/Libxc_4.0.4">http://octopus-code.org/wiki/Libxc_4.0.4</a>)</li><li>Checkout CP2K-5.1: <font face="courier new, monospace"><div class="prettyprint" style="background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break-word;"><code class="prettyprint"><div class="subprettyprint"><span style="color: #000;" class="styled-by-prettify">svn checkout </span><span style="color: #660;" class="styled-by-prettify">-</span><span style="color: #000;" class="styled-by-prettify">r </span><span style="background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);"><span style="color: #066;" class="styled-by-prettify">18095</span><span style="color: #000;" class="styled-by-prettify"> </span></span><span style="color: #000;" class="styled-by-prettify">http</span><span style="color: #660;" class="styled-by-prettify">:</span><span style="color: #800;" class="styled-by-prettify">//svn.code.sf.net/p/cp2k/code/branches/cp2k-5_1-branch/cp2k cp2k-5.1</span></div></code></div></font></li><li>Change directory: <font face="courier new, monospace"><div class="prettyprint" style="background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break-word;"><code class="prettyprint"><div class="subprettyprint"><span style="color: #000;" class="styled-by-prettify">cd cp2k</span><span style="color: #660;" class="styled-by-prettify">-</span><span style="color: #066;" class="styled-by-prettify">5.1</span></div></code></div></font></li><li>Get patch: <div class="prettyprint" style="background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break-word;"><code class="prettyprint"><div class="subprettyprint"><span style="color: #000;" class="styled-by-prettify">wget https</span><span style="color: #660;" class="styled-by-prettify">:</span><span style="color: #800;" class="styled-by-prettify">//www.cp2k.org/static/downloads/patches/patch_cp2k-5.1_libxc-4.0.4-support.diff</span></div></code></div></li><li style=""><font face="arial, sans-serif">Apply patch: </font><div class="prettyprint" style="font-family: "courier new", monospace; background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break-word;"><code class="prettyprint"><div class="subprettyprint"><span style="color: #000;" class="styled-by-prettify">patch </span><span style="color: #660;" class="styled-by-prettify">-</span><span style="color: #000;" class="styled-by-prettify">p </span><span style="color: #066;" class="styled-by-prettify">0</span><span style="color: #000;" class="styled-by-prettify"> </span><span style="color: #660;" class="styled-by-prettify"><</span><span style="color: #000;" class="styled-by-prettify"> patch_cp2k</span><span style="color: #660;" class="styled-by-prettify">-</span><span style="color: #066;" class="styled-by-prettify">5.1</span><span style="color: #000;" class="styled-by-prettify">_libxc</span><span style="color: #660;" class="styled-by-prettify">-</span><span style="color: #066;" class="styled-by-prettify">4.0</span><span style="color: #660;" class="styled-by-prettify">.</span><span style="color: #066;" class="styled-by-prettify">4</span><span style="color: #660;" class="styled-by-prettify">-</span><span style="color: #000;" class="styled-by-prettify">support</span><span style="color: #660;" class="styled-by-prettify">.</span><span style="color: #000;" class="styled-by-prettify">diff</span></div></code></div></li><li>Adapt your ARCH-file:</li><ul><li>Change the <font face="courier new, monospace">DFLAGS</font>, eg. <font face="courier new, monospace"><div class="prettyprint" style="background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break-word;"><code class="prettyprint"><div class="subprettyprint"><span style="color: #000;" class="styled-by-prettify">DFLAGS </span><span style="color: #660;" class="styled-by-prettify">+=</span><span style="color: #000;" class="styled-by-prettify"> </span><span style="color: #660;" class="styled-by-prettify">-</span><span style="color: #000;" class="styled-by-prettify">D__LIBXC</span><span style="background-color: white; font-family: Arial, Helvetica, sans-serif;"><span style="color: #000;" class="styled-by-prettify"> </span></span></div></code></div></font></li><li>Change LIBXCs include directory in <font face="courier new, monospace">CFLAGS</font> and <font face="courier new, monospace">FCFLAGS</font>, eg. <font face="courier new, monospace"><div class="prettyprint" style="background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break-word;"><code class="prettyprint"><div class="subprettyprint"><span style="color: #000;" class="styled-by-prettify">CFLAGS </span><span style="color: #660;" class="styled-by-prettify">+=</span><span style="color: #000;" class="styled-by-prettify"> </span><span style="color: #660;" class="styled-by-prettify">-</span><span style="color: #000;" class="styled-by-prettify">I</span><span style="color: #080;" class="styled-by-prettify">'/my_local_libxc4_installation/include'</span></div></code></div></font></li><li>Change LIBXCs library directory in <font face="courier new, monospace">LDFLAGS</font>, eg. <font face="courier new, monospace"><div class="prettyprint" style="background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break-word;"><code class="prettyprint"><div class="subprettyprint"><span style="color: #000;" class="styled-by-prettify">LDFLAGS </span><span style="color: #660;" class="styled-by-prettify">+=</span><span style="color: #000;" class="styled-by-prettify"> </span><span style="color: #660;" class="styled-by-prettify">-</span><span style="color: #000;" class="styled-by-prettify">L</span><span style="color: #080;" class="styled-by-prettify">'/my_local_libxc4_installation/lib'</span></div></code></div></font>Note, on some architectures this directory is called <font face="courier new, monospace">lib64</font>.</li><li>Change LIBXCs interface in <font face="courier new, monospace">LIBS</font>, eg. <font face="courier new, monospace"><div class="prettyprint" style="background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break-word;"><code class="prettyprint"><div class="subprettyprint"><span style="color: #000;" class="styled-by-prettify">LIBS </span><span style="color: #660;" class="styled-by-prettify">+=</span><span style="color: #000;" class="styled-by-prettify"> </span><span style="color: #660;" class="styled-by-prettify">-</span><span style="color: #000;" class="styled-by-prettify">lxcf03 </span><span style="color: #660;" class="styled-by-prettify">-</span><span style="color: #000;" class="styled-by-prettify">lxc</span></div></code></div><br></font></li></ul><li>Compile as usual ...</li></ul>Please note that this patch comes with some features and drawbacks listed below.</div><div><br></div><div>Features:</div><div><ul><li><font face="courier new, monospace">&LIBXC</font> section is repeatable.</li><li>Only one functional per &<font face="courier new, monospace">LIBXC</font> section.</li><li>Optional <font face="courier new, monospace">PARAMETERS</font> and <font face="courier new, monospace">SCALE</font> keywords are private to the functional - formerly they could have been mixed.</li><li>A lot of bug-fixes and new functionals.</li></ul>Drawbacks:</div><div><ul><li>New input is not backward compatible.</li></ul><br></div><div>To visualize the input changes, here is one example (first old, followed by new syntax):</div><div><br></div><div class="prettyprint" style="background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break-word;"><code class="prettyprint"><div class="subprettyprint"><span style="color: #660;" class="styled-by-prettify">&</span><span style="color: #000;" class="styled-by-prettify">XC_FUNCTIONAL<br>  </span><span style="color: #660;" class="styled-by-prettify">&</span><span style="color: #000;" class="styled-by-prettify">LIBXC<br>    FUNCTIONAL XC_GGA_X_PBE XC_GGA_C_PBE<br>  </span><span style="color: #660;" class="styled-by-prettify">&</span><span style="color: #008;" class="styled-by-prettify">END</span><span style="color: #000;" class="styled-by-prettify"> LIBXC<br></span><span style="color: #660;" class="styled-by-prettify">&</span><span style="color: #008;" class="styled-by-prettify">END</span><span style="color: #000;" class="styled-by-prettify"> XC_FUNCTIONAL</span></div></code></div><div><br></div><div class="prettyprint" style="background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break-word;"><code class="prettyprint"><div class="subprettyprint"><span style="color: #660;" class="styled-by-prettify">&</span><span style="color: #000;" class="styled-by-prettify">XC_FUNCTIONAL<br>  </span><span style="color: #660;" class="styled-by-prettify">&</span><span style="color: #000;" class="styled-by-prettify">LIBXC<br>    FUNCTIONAL XC_GGA_X_PBE<br>  </span><span style="color: #660;" class="styled-by-prettify">&</span><span style="color: #008;" class="styled-by-prettify">END</span><span style="color: #000;" class="styled-by-prettify"> LIBXC<br>  </span><span style="color: #660;" class="styled-by-prettify">&</span><span style="color: #000;" class="styled-by-prettify">LIBXC<br>    FUNCTIONAL XC_GGA_C_PBE<br>  </span><span style="color: #660;" class="styled-by-prettify">&</span><span style="color: #008;" class="styled-by-prettify">END</span><span style="color: #000;" class="styled-by-prettify"> LIBXC<br></span><span style="color: #660;" class="styled-by-prettify">&</span><span style="color: #008;" class="styled-by-prettify">END</span><span style="color: #000;" class="styled-by-prettify"> XC_FUNCTIONAL <br></span></div></code></div><div><br><br></div><div>Best regards and hope this is useful to others,</div><div>Andreas</div></div>