Skip to content

(MERGED) enh: enabled libxc 5 and using the f03 interface

Nick R. Papior requested to merge npapior/libgridxc:libxc-5 into master

Enabled usage of libxc 3, 4 or 5. It should fail with 5.0.0 where the API is broken.

I have tested the compilation using the multiconfig-build.sh with these libxc versions (with+without mpi):

  • 3.0.1
  • 4.3.4
  • 5.1.4

Some of the problems related to libxc usage is described here:

Prior to 5.X versions the np argument (number of points) was defined as c_int. In 5.X it is using c_size_t (correctly). However, my compiler, GCC 9.3.0, could not figure out to cast 1 -> 1_c_size_t (why?). So I had to re-define the argument in the pre-processor statements.

Changed the libxc.m4 to be more flexible and try both f90 and f03 with preference to the latter.

Since the f03 interface should be stable going forward, and f90 being deprecated it is vital we use this interface in the future. We could force its usage but then again, it isn't too much of a problem at the moment. I have tried to let configure handle easy-build as well (NOT TESTED).

When using the f03 interface the modules are condensed into 1 module, and with separate type definitions for the info and function types.

I have changed the ggaxc/ldaxc interfaces a bit is_libxc_in is changed to is_libxc to make it easy on callers, this abstraction was easily fixed in the code.

In the f03 interface the arguments must not be scalars, so the eps argument was changed to an array.

While I am not too fond of changing the m4 scripts, I felt it was necessary to accommodate the f03 interface.

Edited by Alberto Garcia

Merge request reports