Skip to content

Fixing finite temperature XC functionals from LibXC.

Tom Yates requested to merge yatest/q-e:my-new-branch into develop

This is a naive fix for finite T XC functionals that assumes the XC temperature is equal to degauss. xc_func_f03_set_ext_params call must occur after xc_f03_func_init call, but before xc_f03_lda_exc_vxc (or the like) call.

Fix applies to xc_lda_lsda_drivers.f90 which calculates the XC energy etc., however dmxc_drivers.f90, that calculates the derivatives that are used in the DFPT module ph.x, also requires the fix.

Due to my limited knowledge on how ph.x works with finite temperature (i.e. how it gets the input variable "degauss" from the pw.x scf run), I am not sure how to get "degauss" into dmxc_drivers.f90. Someone with better understanding of the modules would need to work out how to do this, and then by simply copying the changes in xc_lda_lsda_driver.f90 to dmxc_drivers.f90, ph.x should also work properly with finite T XC functionals.

It may be possible to adapt funct.f90 to check if a finite T XC functional has been used without defining a temperature, and throw a warning message like it does for other functionals that require extra parameters.

Due to only using pw.x and ph.x, I can only speak for the missing function calls in these programs. There may be more files missing these function calls, however from a cursory glance it doesn't seem to be so. This is because the only other files that use xc_f03_func_init calls are GGA modules, and there are currently no finite T GGAs.

The variable temp is declared as a rank-1 size-1 array as this is the data type now needed when setting external parameters in LibXC, however there is almost certainly a cleaner way of doing this.

Likewise, it is currently using an IF statement to check if the XC selected is one of the two finite T XC functionals (KSDT and GDSMFB) before the call to set the XC temperature; however, there is likely a better (or more general) way of doing this.

Since both of the finite T XC functionals are XC combined (rather than separate functions for X and C), the fix only needs to be applied to the exchange component, as icorr is set to 0.

Tested with libxc-4.3.4, however doesn't work with libxc-5.0.0 due to changing module files.

Merge request reports