dftlibs / xcfun

XCFun: A library of exchange-correlation functionals with arbitrary-order derivatives
https://dftlibs.org/xcfun/
Mozilla Public License 2.0
57 stars 32 forks source link

‘const struct functional_data’ has no member named ‘fp2’ #28

Closed mariavd closed 6 years ago

mariavd commented 6 years ago

Hello,

What can cause the error in the title?

I ran setup on 4.10.0-37-generic #41-Ubuntu SMP Fri Oct 6 20:20:37 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux as

./setup -DXC_MAX_ORDER=1
 cmake -DCMAKE_BUILD_TYPE=Release -DXC_MAX_ORDER=1 /home/USERNAME/xcfun/

-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The Fortran compiler identification is GNU 6.3.0
-- Check for working Fortran compiler: /usr/bin/gfortran
-- Check for working Fortran compiler: /usr/bin/gfortran  -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/bin/gfortran supports Fortran 90
-- Checking whether /usr/bin/gfortran supports Fortran 90 -- yes
-- Configuring done
-- Generating done
-- Build files have been written to: /home/USERNAME/xcfun/build

   configure step is done
   now you need to compile the sources

   to compile with configured parameters (recommended):
   $ cd /home/USERNAME/xcfun/build/
   $ make

   to modify configured parameters and then compile:
   $ cd /home/USERNAME/xcfun/build/
   $ ccmake /home/USERNAME/xcfun/
   $ make

Then from the build directory:

$ make
Scanning dependencies of target xcfun
[  1%] Building CXX object CMakeFiles/xcfun.dir/src/xcint.cpp.o
[  2%] Building CXX object CMakeFiles/xcfun.dir/src/xcfun.cpp.o
/home/USERNAME/xcfun/src/xcfun.cpp: In function ‘void xc_eval(xc_functional_obj*, const double*, double*)’:
**/home/USERNAME/xcfun/src/xcfun.cpp:223:35: error: ‘const struct functional_data’ has no member named ‘fp2’; did you mean ‘fp0’?**
       * f->active_functionals[i]->fp2(d);
                                   ^~~
/home/USERNAME/xcfun/src/xcfun.cpp:399:35: error: ‘const struct functional_data’ has no member named ‘fp2’; did you mean ‘fp0’?
       * f->active_functionals[i]->fp2(d);
                                   ^~~
/home/USERNAME/xcfun/src/xcfun.cpp:412:35: error: ‘const struct functional_data’ has no member named ‘fp2’; did you mean ‘fp0’?
       * f->active_functionals[i]->fp2(d);
                                   ^~~
/home/USERNAME/xcfun/src/xcfun.cpp:424:35: error: ‘const struct functional_data’ has no member named ‘fp2’; did you mean ‘fp0’?
       * f->active_functionals[i]->fp2(d);
                                   ^~~
/home/USERNAME/xcfun/src/xcfun.cpp:459:45: error: ‘const struct functional_data’ has no member named ‘fp2’; did you mean ‘fp0’?
                 * f->active_functionals[i]->fp2(d);
                                             ^~~
/home/USERNAME/xcfun/src/xcfun.cpp:475:45: error: ‘const struct functional_data’ has no member named ‘fp2’; did you mean ‘fp0’?
                 * f->active_functionals[i]->fp2(d);
                                             ^~~
/home/USERNAME/xcfun/src/xcfun.cpp:491:45: error: ‘const struct functional_data’ has no member named ‘fp2’; did you mean ‘fp0’?
                 * f->active_functionals[i]->fp2(d);
                                             ^~~
CMakeFiles/xcfun.dir/build.make:86: recipe for target 'CMakeFiles/xcfun.dir/src/xcfun.cpp.o' failed
make[2]: *** [CMakeFiles/xcfun.dir/src/xcfun.cpp.o] Error 1
CMakeFiles/Makefile2:323: recipe for target 'CMakeFiles/xcfun.dir/all' failed
make[1]: *** [CMakeFiles/xcfun.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
robertodr commented 6 years ago

It's an issue with the option -DXC_MAX_ORDER=1 passed to CMake. From looking at the source, it really seems that the minimal value for that option is 3. However, if one just wants to always just calculate first functional derivatives, that should work. A quick fix would be to not set XC_MAX_ODER at all to the setup script and work with defaults. @bast @uekstrom do you have a better fix?

uekstrom commented 6 years ago

I would put in #if XC_MAX_ORDER < 3 #define ...=3 (sorry writing on my phone) for robustness, but the result is the same as your solution Roberto.

Regards Ulf

On Thu, 26 Oct 2017 at 16:32, Roberto Di Remigio notifications@github.com wrote:

It's an issue with the option -DXC_MAX_ORDER=1 passed to CMake. From looking at the source, it really seems that the minimal value for that option is 3. However, if one just wants to always just calculate first functional derivatives, that should work. A quick fix would be to not set XC_MAX_ODER at all to the setup script and work with defaults. @bast https://github.com/bast @uekstrom https://github.com/uekstrom do you have a better fix?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/dftlibs/xcfun/issues/28#issuecomment-339685586, or mute the thread https://github.com/notifications/unsubscribe-auth/AMeumR4ASdz2Ez5beObM0PpyStUKEVrTks5swJfkgaJpZM4QHMVC .

robertodr commented 6 years ago

This can be enforced at the CMake level, without fiddling with the source code at all. I was just wondering whether XC_MAX_ORDER=1 (or 2) would make sense.

uekstrom commented 6 years ago

I think that would mess up the api, it’s better to always go up to third order. The code size is not very extreme anyway.

Ulf

On Thu, 26 Oct 2017 at 19:50, Roberto Di Remigio notifications@github.com wrote:

This can be enforced at the CMake level, without fiddling with the source code at all. I was just wondering whether XC_MAX_ORDER=1 (or 2) would make sense.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/dftlibs/xcfun/issues/28#issuecomment-339745829, or mute the thread https://github.com/notifications/unsubscribe-auth/AMeumfpR97prd8WiX23nVezqstTeHxlvks5swMZXgaJpZM4QHMVC .

robertodr commented 6 years ago

Cool I'll patch it up and submit a PR.

mariavd commented 6 years ago

It seems that I misunderstood some tips I had received. Thank you for the responses.


From: Roberto Di Remigio notifications@github.com Sent: 26 October 2017 20:50:15 To: dftlibs/xcfun Cc: Dimitrova, Maria; Author Subject: Re: [dftlibs/xcfun] ‘const struct functional_data’ has no member named ‘fp2’ (#28)

This can be enforced at the CMake level, without fiddling with the source code at all. I was just wondering whether XC_MAX_ORDER=1 (or 2) would make sense.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/dftlibs/xcfun/issues/28#issuecomment-339745829, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AXbdaYINC_eU2dDbJ0hTnpnkLDkS0LFTks5swMZXgaJpZM4QHMVC.

bast commented 6 years ago

Thanks to Roberto for fixing this. Closing the issue.