<commit_before><html lang="en">
<head>
<title>XCFun DFT Library</title>
</head>
<body>
<div style="width:50em">
<h1>XCFun</h1>
<p>
XCFun is a library of DFT exchange-correlation (XC) functionals. It is
based on automatic differentiation and can therefore generate
arbitrary order derivatives of these functionals. For more information
see the website <a href="http://admol.org/xcfun">admol.org/xcfun</a>.
</p>


<h2>Installation and linking</h2> Compile the library using one of the
included makefiles (for example <tt>Makefile.gcc</tt>). This will
generate a library file <tt>lib/libxcfun.a</tt> which can be
statically linked to your application. Include files listing all
available functionals will be generated during the compilation of
XCFun. These files are <tt>include/xcfun_autogen.h</tt> (for the C
interface), and <tt>fortran/xcfun_autogen.F90</tt> for the Fortran
module. C or C++ programs that uses XCFun should include the <tt>xcfun.h</tt> header file, while Fortran programs should use the <tt>xcfun</tt> module defined in <tt>fortran/xcfun_module.F90</tt>.

<h2>Usage</h2> 

<p>To use the library you should first create
one <tt>xc_functional</tt> object for each functional and each thread
you want to use. Each functional object can only be used by one thread
at a time. After creating these objects
using <tt>xc_new_functional()</tt> you should set them up by defining
the variables to differentiate with respect to, as well as the
parameters of the functional you want to use. After having done so you
can use <tt>xc_eval()</tt> to evaluate the exchange correlation energy
and its derivatives.</p>

<p>Example C program that evaluates BLYP to order 2 using alpha/beta variables:</p>
<p>
<kbd>
#include "xcfun.h"<br/>
<br/>
int main(int argc, char *argv[])<br/>
{<br/>
&nbsp; int derivative_order = 2;<br/>
&nbsp; int nr_points = 1;<br/>
&nbsp; double density[5] = {1,2,3,5,4}; /* na nb ga.ga gb.gb ga.gb */<br/>
&nbsp; double output[21]; /* We have 21 output numbers for derivatives up to order 2 */<br/>
&nbsp; xc_functional fun = xc_new_functional();<br/>
&nbsp; xc_set_mode(fun, XC_VARS_AB);<br/>
&nbsp; xc_set_param(fun, XC_LYPC, 1.0);<br/>
&nbsp; xc_set_param(fun, XC_BECKEX, 1.0);<br/>
&nbsp; xc_eval(fun, derivative_order, nr_points, density, output);<br/>
}
</kbd></p>
<p>
Please see the complete API documentation below
</p>


<h2>Input, output and units</h2> The library uses atomic units for all
input and output variables. 

<p>The XC energy and derivatives can be
evaluated using spin-up (&alpha;) and spin-down (&beta;)
quantities. In the most general case these are
<ul>
  <li> <i> n<sub>&alpha;</sub> </i> The spin-up density.
  <li> <i> n<sub>&beta;</sub> </i> The spin-down density.
  <li> <i> &sigma;<sub>&alpha;&alpha;</sub> </i> The square magnitude of the spin-up density gradient.
  <li> <i> &sigma;<sub>&alpha;&beta;</sub> </i> The dot product between the spin-up and spin-down gradient vectors.
  <li> <i> &sigma;<sub>&beta;&beta;</sub> </i> The square magnitude of the spin-down density gradient.
  <li> <i> &tau;<sub>&alpha;</sub> </i> The spin-up Kohn-Sham kinetic energy density.
  <li> <i> &tau;<sub>&beta;</sub> </i> The spin-down Kohn-Sham kinetic energy density.
</ul>    
Alternatively you can use total density (<i>n = n<sub>&alpha;</sub> + n<sub>&beta;</sub></i>) and spin density (<i>s = n<sub>&alpha;</sub> - n<sub>&beta;</sub></i>) variables. These also have corresponding gradient and kinetic energy components. See <tt>xc_set_mode()</tt> below for more information.</p>

<p>
  The output is given in graded lexicographical order. For example a spin-polarized second order GGA functional will give 21 output elements, starting with the XC energy density. Symbolically we may write this as a list starting with the energy 
  <i>E, </i>
followed by five gradient elements 
<i>
E<sub>&alpha;</sub> E<sub>&beta;</sub>
E<sub>&sigma;<sub>&alpha;&alpha;</sub></sub><commit_msg>Polish documentation.<commit_after><html lang="en">
<head>
<title>XCFun DFT Library</title>
</head>
<body>
<div style="width:50em">
<h1>XCFun</h1>
<p>
XCFun is a library of DFT exchange-correlation (XC) functionals. It is
based on automatic differentiation and can therefore generate
arbitrary order derivatives of these functionals. For more information
see the website <a href="http://admol.org/xcfun">admol.org/xcfun</a>.
</p>


<h2>Installation and linking</h2> Compile the library using one of the
included makefiles (for example <tt>Makefile.gcc</tt>). This will
generate a library file <tt>lib/libxcfun.a</tt> which can be
statically linked to your application. Include files listing all
available functionals will be generated during the compilation of
XCFun. These files are <tt>include/xcfun_autogen.h</tt> (for the C
interface), and <tt>fortran/xcfun_autogen.F90</tt> for the Fortran
module. C or C++ programs that uses XCFun should include the <tt>xcfun.h</tt> header file, while Fortran programs should use the <tt>xcfun</tt> module defined in <tt>fortran/xcfun_module.F90</tt>.

<h2>Usage</h2> 

<p>To use the library you should first create
one <tt>xc_functional</tt> object for each functional and each thread
you want to use. Each functional object can only be used by one thread
at a time. After creating these objects
using <tt>xc_new_functional()</tt> you should set them up by defining
the variables to differentiate with respect to, as well as the
parameters of the functional you want to use. After having done so you
can use <tt>xc_eval()</tt> to evaluate the exchange correlation energy
and its derivatives.</p>

<p>Example C program that evaluates BLYP to order 2 using alpha/beta variables:</p>
<p>
<kbd>
#include "xcfun.h"<br/>
<br/>
int main(int argc, char *argv[])<br/>
{<br/>
&nbsp; int derivative_order = 2;<br/>
&nbsp; int nr_points = 1;<br/>
&nbsp; double density[5] = {1,2,3,5,4}; /* na nb ga.ga gb.gb ga.gb */<br/>
&nbsp; double output[21]; /* We have 21 output numbers for derivatives up to order 2 */<br/>
&nbsp; xc_functional fun = xc_new_functional();<br/>
&nbsp; xc_set_mode(fun, XC_VARS_AB);<br/>
&nbsp; xc_set_param(fun, XC_LYPC, 1.0);<br/>
&nbsp; xc_set_param(fun, XC_BECKEX, 1.0);<br/>
&nbsp; xc_eval(fun, derivative_order, nr_points, density, output);<br/>
}
</kbd></p>
<p>
Please see the complete API documentation below
</p>


<h2>Input, output and units</h2> The library uses atomic units for all
input and output variables. 

<p>The XC energy and derivatives can be
evaluated using spin-up (&alpha;) and spin-down (&beta;)
quantities. In the most general case these are
<ul>
  <li> <i> n<sub>&alpha;</sub> </i> The spin-up electron number density.
  <li> <i> n<sub>&beta;</sub> </i> The spin-down density.
  <li> <i> &sigma;<sub>&alpha;&alpha;</sub> = &nabla;n<sub>&alpha;</sub>&middot;&nabla;n<sub>&alpha;</sub> </i> The square magnitude of the spin-up density gradient.
  <li> <i> &sigma;<sub>&alpha;&beta;</sub>= &nabla;n<sub>&alpha;</sub>&middot;&nabla;n<sub>&beta;</sub> </i> The dot product between the spin-up and spin-down gradient vectors.
  <li> <i> &sigma;<sub>&beta;&beta;</sub>= &nabla;n<sub>&beta;</sub>&middot;&nabla;n<sub>&beta;</sub> </i> The square magnitude of the spin-down density gradient.
  <li> <i> &tau;<sub>&alpha;</sub> </i> The spin-up Kohn-Sham kinetic energy density.
  <li> <i> &tau;<sub>&beta;</sub> </i> The spin-down Kohn-Sham kinetic energy density.
</ul>    
Alternatively you can use total density (<i>n = n<sub>&alpha;</sub> + n<sub>&beta;</sub></i>) and spin density (<i>s = n<sub>&alpha;</sub> - n<sub>&beta;</sub></i>) variables. These also have corresponding gradient and kinetic energy components. See <tt>xc_set_mode()</tt> below for more information.</p>

<p>
  The output is given in graded reverse lexicographical order. For example a spin-polarized second order GGA functional will give 21 output elements, starting with the XC energy density. Symbolically we may write this as a list starting with the energy 
  <i>E, </i>
followed by five gradient elements 
<i>
E<sub>&alpha;</sub> E<sub>&beta;</sub>
E<sub>&sigma;<sub>&alpha;&alpha;</sub></sub>
{'fraction_non_alphanumeric': 0.14639583849393115, 'fraction_numerical': 0.008422095615556105, 'mean_word_length': 4.963810930576071, 'pattern_counts': {'":': 0, '<': 269, '<?xml version=': 0, '>': 269, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5129743', 'n_tokens_mistral': 2779, 'n_tokens_neox': 2650, 'n_words': 990}