abinit / abinit

The official github mirror of the Abinit repository. We welcome bug fixes and improvements. Note that most of the active developments are hosted on our https://gitlab.abinit.org/ server. Before embarking on making significant changes, please contact the Abinit group.

Home Page:https://www.abinit.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compilation error in libxc_tools.c with libXC 6.0.0

thierry-FreeBSD opened this issue · comments

Many undefined variables cause a compilation error in libxc_tools.c:

gfortran11 -DHAVE_CONFIG_H -I. -I../../../..  -I../../../../shared/common/src/10_defs -I../../../../shared/common/src/10_defs -I../../../../shared/common/src/14_hidewrite -I../../../../shared/common/src/14_hidewrite -I../../../../shared/common/src/16_hideleave -I../../../../shared/common/src/16_hideleave -I../../../../shared/common/src/28_numeric_noabirule -I../../../../shared/common/src/28_numeric_noabirule -I../../../../shared/common/src/33_xc_lowlevel -I../../../../shared/common/src/33_xc_lowlevel -I../../../../shared/common/src/incs -I../../../../shared/common/src/incs -I../../../../shared/common/src/mods -I../../../../shared/common/src/mods -I../../../../src/incs -I../../../../src/incs -I../../../../src/mods -I../../../../src/mods -I../../../../shared/libpaw/incs -I../../../../shared/libpaw/incs -I../../../../shared/libpaw/mods -I../../../../shared/libpaw/mods   -ffree-form -J../mods   -ffree-line-length-none -I/usr/local/include -Wl,-rpath=/usr/local/lib/gcc11 -fallow-argument-mismatch   -I/usr/local/include -I/usr/local/include   -c -o m_xcpositron.o m_xcpositron.F90
libxc_tools.c:142:30: error: use of undeclared identifier 'XC_HYB_NONE'
 *xc_cst_hyb_none          = XC_HYB_NONE;
                             ^
libxc_tools.c:143:30: error: use of undeclared identifier 'XC_HYB_FOCK'
 *xc_cst_hyb_fock          = XC_HYB_FOCK;
                             ^
libxc_tools.c:144:30: error: use of undeclared identifier 'XC_HYB_PT2'
 *xc_cst_hyb_pt2           = XC_HYB_PT2;
                             ^
libxc_tools.c:145:30: error: use of undeclared identifier 'XC_HYB_ERF_SR'
 *xc_cst_hyb_erf_sr        = XC_HYB_ERF_SR;
                             ^
libxc_tools.c:146:30: error: use of undeclared identifier 'XC_HYB_YUKAWA_SR'
 *xc_cst_hyb_yukawa_sr     = XC_HYB_YUKAWA_SR;
                             ^
libxc_tools.c:147:30: error: use of undeclared identifier 'XC_HYB_GAUSSIAN_SR'
 *xc_cst_hyb_gaussian_sr   = XC_HYB_GAUSSIAN_SR;
                             ^
libxc_tools.c:148:30: error: use of undeclared identifier 'XC_HYB_SEMILOCAL'
 *xc_cst_hyb_semilocal     = XC_HYB_SEMILOCAL;
                             ^
libxc_tools.c:149:30: error: use of undeclared identifier 'XC_HYB_HYBRID'
 *xc_cst_hyb_hybrid        = XC_HYB_HYBRID;
                             ^
libxc_tools.c:150:30: error: use of undeclared identifier 'XC_HYB_CAM'
 *xc_cst_hyb_cam           = XC_HYB_CAM;
                             ^
libxc_tools.c:151:30: error: use of undeclared identifier 'XC_HYB_CAMY'
 *xc_cst_hyb_camy          = XC_HYB_CAMY;
                             ^
libxc_tools.c:152:30: error: use of undeclared identifier 'XC_HYB_CAMG'
 *xc_cst_hyb_camg          = XC_HYB_CAMG;
                             ^
libxc_tools.c:153:30: error: use of undeclared identifier 'XC_HYB_DOUBLE_HYBRID'
 *xc_cst_hyb_double_hybrid = XC_HYB_DOUBLE_HYBRID;
                             ^
libxc_tools.c:154:30: error: use of undeclared identifier 'XC_HYB_MIXTURE'
 *xc_cst_hyb_mixture       = XC_HYB_MIXTURE;
                             ^
libxc_tools.c:355:15: error: no member named 'hyb_number_terms' in 'struct xc_func_type'
    {if (func.hyb_number_terms>0)
         ~~~~ ^
libxc_tools.c:356:17: error: no member named 'hyb_type' in 'struct xc_func_type'
      {if (func.hyb_type[0] != XC_HYB_NONE){result=1;}}}
           ~~~~ ^
libxc_tools.c:356:32: error: use of undeclared identifier 'XC_HYB_NONE'
      {if (func.hyb_type[0] != XC_HYB_NONE){result=1;}}}
                               ^
16 errors generated.
gmake[6]: *** [Makefile:1237: libxc_tools.o] Error 1

Hi,

This is fixed in soon-to-come ABINITv9.8 ...

In the meantime ( fixed by @mtorrent )

`Comment useless function to avoid problems

shared/common/src/33_xc_lowlevel/libxc_tools.c

@@ -127,7 +127,7 @@ void xc_get_kind_constants(int *xc_cst_exchange,

  • It is kept here for historical reasons
  • ===============================================================
    */
    /*void xc_get_hybrid_constants(int *xc_cst_hyb_none,
    int *xc_cst_hyb_fock,
    int *xc_cst_hyb_pt2,
    int *xc_cst_hyb_erf_sr,
    @@ -140,11 +140,10 @@ void xc_get_hybrid_constants(int *xc_cst_hyb_none,
    int *xc_cst_hyb_camg,
    int xc_cst_hyb_double_hybrid,
    int xc_cst_hyb_mixture)
    {
    /
    //#if ( XC_MAJOR_VERSION > 7 )
    /
    ==== libXC v6.0 and later ==== /
    /
    *xc_cst_hyb_none = XC_HYB_NONE;
    *xc_cst_hyb_fock = XC_HYB_FOCK;
    *xc_cst_hyb_pt2 = XC_HYB_PT2;
    *xc_cst_hyb_erf_sr = XC_HYB_ERF_SR;
    @@ -156,10 +155,10 @@ void xc_get_hybrid_constants(int *xc_cst_hyb_none,
    *xc_cst_hyb_camy = XC_HYB_CAMY;
    *xc_cst_hyb_camg = XC_HYB_CAMG;
    xc_cst_hyb_double_hybrid = XC_HYB_DOUBLE_HYBRID;
    xc_cst_hyb_mixture = XC_HYB_MIXTURE;/
    //#else
    /
    ==== Before libXC v6.0 ==== /
    /
    *xc_cst_hyb_none = -11; *xc_cst_hyb_fock = -11;
    *xc_cst_hyb_pt2 = -11; *xc_cst_hyb_erf_sr = -11;
    *xc_cst_hyb_yukawa_sr = -11; *xc_cst_hyb_gaussian_sr = -11;
    *xc_cst_hyb_semilocal = -11; *xc_cst_hyb_hybrid = -11;
    @@ -167,7 +166,7 @@ void xc_get_hybrid_constants(int *xc_cst_hyb_none,
    *xc_cst_hyb_camg = -11; *xc_cst_hyb_double_hybrid = -11;
    xc_cst_hyb_mixture = -11;
    #endif
    }
    /

/* ===============================================================

  • Allocate/free xc_func_type pointer`

Thanks, but your patch has been eaten by markdown, so I rewrite it.

See the attached
patch-shared_common_src_33__xc__lowlevel_libxc__tools.c.txt

And another one is needed for shared/libpaw/src/libpaw_libxc.c: see
patch-shared_libpaw_src_libpaw__libxc.c.txt

Thanks Thierry !

I didn't have the courage to format the patches

Thanks for the other developers...