How to use the KSDT XC free-energy in LibXC

This page provides usage notes for the KSDT XC free-energy implementation in LibXC.

Download the original plain-text HOWTO file

(last revised, LC, VVK & SBT: 07 Dec 2016; 23 Mar 2017)

How to use the KSDT XC free-energy implemented in the LibXC library -
L. Calderin, V.V. Karasiev, and S.B. Trickey, Univ. Florida
======================================================================

I. BACKGROUND -

This HOWTO file provides instructions for use of the KSDT LSDA XC 
free-energy functional (Karasiev, Sjostrom, Dufty, Trickey, Phys. Rev. 
Lett. 112, 076403 (2014)) as implemented in the LibXC 3.0 library. 

BEWARE: Failure to follow this procedure will result in the electron 
temperature (T) being left at 0 K (zero).  

We assume that users have the LibXC library installed and know how to 
call standard ground-state LSDA XC functionals.

In addition to the standard LibXC LSDA interface (see the LibXC manual: 
http://www.tddft.org/programs/octopus/wiki/index.php/Libxc:manual#LDA), KSDT
REQUIRES an additional call to a subroutine which sets the value 
of the electron temperature (T) in Hartree atomic units. 

II. FORTRAN implementation
==========================
FORTRAN declarations and calls in the calling program should appear 
as follows (see below regarding C code):

  USE XC_F90_TYPES
  USE XC_f90_LIB
...
  TYPE(xc_f90_pointer_t) :: x_func,c_func,ksdt_func
  TYPE(xc_f90_pointer_t) :: x_info,c_info,ksdt_info
...
   call xc_f90_func_init(ksdt_func,ksdt_info,XC_LDA_XC_KSDT,XC_UNPOLARIZED)
...
   call xc_f90_lda_xc_ksdt_set_par(ksdt_func,T) !!! This call sets up the temperature T
...
   call xc_f90_lda_exc_vxc(ksdt_func,size,rho,fxc,vxc)
...
   call xc_f90_func_end(ksdt_func)
... 
  
III. C code implementation -
============================
A C version of the test code also is provided. 
C declarations and calls in the calling program shold appear as follows:

#include <xc.h> /*This is the header file that comes with LibXC*/     

main()
{
  xc_func_type func;

....
   xc_func_init(&func,XC_LDA_XC_KSDT,XC_UNPOLARIZED);
...
   xc_lda_xc_ksdt_set_params(&func,T);  /* This call sets up the temperature T */
...
   xc_lda_exc_vxc(&func,size,&rho,&fxc,&vxc);
...
   xc_func_end(&func);
... 

}
  
 
IV. How to test the KSDT subroutine -
=====================================

We also provide Fortran and  C test codes (lxc-ksdt-test-f90.f90, 
lxc-ksdt-test-c.c) which, if the call to KSDT is correct, will reproduce the 
data in Table S1 of the Supplemental Material for the above-cited Phys. Rev. Lett.

To use the test code, proceed as follows:

1. Install the LibXC 3.0 library in $LIBXCDIR

2. Compile the lxc-ksdt-test-f90_v6.f90 file:

ifort lxc-ksdt-test-f90_v6.f90 -I $LIBXCDIR/include -L $LIBXCDIR/lib -lxcf90 -lxc -o lxc-ksdt-test-f90_v6.x

Or the C code using:

icc lxc-ksdt-test-c_v2.c -I $LIBXCDIR/include -L $LIBXCDIR/lib -lxc -o lxc-ksdt-test-c_v2.x


3. Execute: 

./lxc-ksdt-test-f90_v6.x > lxc-ksdt-test-f90_v6.dat

or

./lxc-ksdt-test-c_v2.x > lxc-ksdt-test-c_v2.dat

4. Accordingly, compare with the reference data in lxc-ksdt-test-f90_ref_v6.dat or
lxc-ksdt-test-c_ref_v2.dat.

--end--