jdftx icon indicating copy to clipboard operation
jdftx copied to clipboard

1.7.0 not building with recent libxc due to cam_alpha, beta, omega change

Open mmarchywka opened this issue 1 year ago • 3 comments

ExCorr.cpp is expecting this, apparently no subscripts,

`` double exxScale() const { return funcUnpolarized.cam_omega>0 ? funcUnpolarized.cam_beta : funcUnpolarized.cam_alpha; } double exxOmega() const { return funcUnpolarized.cam_omega; }

The definition in xc.h includes this,

/** Parameters for range-separated hybrids hyb_type[i]: XC_HYB_NONE, XC_HYB_FOCK, XC_HYB_ERF_SR, etc. hyb_omega[i]: the range separation constant hyb_coeff[i]: fraction of exchange, used both for usual hybrids as well as range-separated ones

 N.B. Different conventions for alpha and beta can be found in
 literature. In the convention used in libxc, at short range the
 fraction of exact exchange is cam_alpha+cam_beta, while at long
 range it is cam_alpha.

*/ int hyb_number_terms, *hyb_type; double *hyb_coeff, *hyb_omega; ``

mmarchywka avatar May 08 '23 12:05 mmarchywka

Hmm, I can't believe they changed the API again! Could you please post the version of libxc you encountered this with, and the error message you get in jdftx compilation.

If this is a beta version of libxc, I will leave this open for a bit to allow the API to stabilize before adding an ugly version ifdef. In the meantime, please use an older version of libxc.

Best, Shankar

shankar1729 avatar May 10 '23 15:05 shankar1729

Thanks. From xc_version.h, #define XC_VERSION "7.0.0" #define XC_MAJOR_VERSION 7 #define XC_MINOR_VERSION 0 #define XC_MICRO_VERSION 0 Here is what it says but if you look at the excerpt from xc.h in the original post I think that code captures the problem. I just wasn't sure how to adapt the scalars to arrays,

make [ 1%] Building CXX object CMakeFiles/jdftxlib.dir/electronic/ExCorr.cpp.o /home/ubuntu/dev/jdftx/jdftx-1.7.0/jdftx/electronic/ExCorr.cpp: In member function ‘double FunctionalLibXC::exxScale() const’: /home/ubuntu/dev/jdftx/jdftx-1.7.0/jdftx/electronic/ExCorr.cpp:207:51: error: ‘const xc_func_type {aka const struct xc_func_type}’ has no member named ‘cam_omega’ double exxScale() const { return funcUnpolarized.cam_omega>0 ? funcUnpolarized ^ /home/ubuntu/dev/jdftx/jdftx-1.7.0/jdftx/electronic/ExCorr.cpp:207:81: error: ‘const xc_func_type {aka const struct xc_func_type}’ has no member named ‘cam_beta’ cale() const { return funcUnpolarized.cam_omega>0 ? funcUnpolarized.cam_beta : ^ /home/ubuntu/dev/jdftx/jdftx-1.7.0/jdftx/electronic/ExCorr.cpp:207:108: error: ‘const xc_func_type {aka const struct xc_func_type}’ has no member named ‘cam_alpha’ npolarized.cam_omega>0 ? funcUnpolarized.cam_beta : funcUnpolarized.cam_alpha; ^ /home/ubuntu/dev/jdftx/jdftx-1.7.0/jdftx/electronic/ExCorr.cpp: In member function ‘double FunctionalLibXC::exxOmega() const’: /home/ubuntu/dev/jdftx/jdftx-1.7.0/jdftx/electronic/ExCorr.cpp:208:51: error: ‘const xc_func_type {aka const struct xc_func_type}’ has no member named ‘cam_omega’ double exxOmega() const { return funcUnpolarized.cam_omega; } ^ CMakeFiles/jdftxlib.dir/build.make:1055: recipe for target 'CMakeFiles/jdftxlib.dir/electronic/ExCorr.cpp.o' failed make[2]: *** [CMakeFiles/jdftxlib.dir/electronic/ExCorr.cpp.o] Error 1 CMakeFiles/Makefile2:173: recipe for target 'CMakeFiles/jdftxlib.dir/all' failed make[1]: *** [CMakeFiles/jdftxlib.dir/all] Error 2 Makefile:145: recipe for target 'all' failed make: *** [all] Error 2 marchywka@happy:/home/ubuntu/dev/jdftx/jdftx-1.7.0/build$

mmarchywka avatar May 10 '23 17:05 mmarchywka

Looking at this again, the comment in xc.h refers to cam_alpha and cam_beta, and does not specify how the renamed variables connect to cam_alpha and cam_beta.

As mentioned earlier, I'm going to wait on this LibXC version to stabilize before making a change to support it.

shankar1729 avatar May 25 '23 18:05 shankar1729