dftlibs / xcfun

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

Revamp Fortran interface #98

Closed robertodr closed 4 years ago

robertodr commented 4 years ago

New year, new API. I started this PR thinking to rewrite the Fortran interface using iso_c_binding but it spiraled out of control and I rewrote the C API to the library too. There are breaking changes, but I plan to write a migration guide. With these changes there is no longer a dependency on the C compiler. I don't plan to document the API in this PR. I have #106 in progress for that purpose and I don't want the two branches to conflict too much.

This will close #61 and #60

To potential reviewers Please let's review and get in ~#109~ #111 first.

Todos

Types of changes

Status

codecov-io commented 4 years ago

Codecov Report

Merging #98 into master will increase coverage by 0.44%. The diff coverage is 68.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #98      +/-   ##
==========================================
+ Coverage   52.54%   52.99%   +0.44%     
==========================================
  Files          78       78              
  Lines        1922     1970      +48     
==========================================
+ Hits         1010     1044      +34     
- Misses        912      926      +14
Impacted Files Coverage Δ
src/specmath.hpp 100% <ø> (ø) :arrow_up:
src/config.hpp 0% <0%> (ø)
test/testall.cpp 91.97% <100%> (ø)
src/densvars.hpp 48.88% <60%> (ø) :arrow_up:
src/xcint.cpp 90.24% <60%> (+9.8%) :arrow_up:
src/XCFunctional.cpp 65.65% <65.65%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 3cc5e13...6e9b5da. Read the comment docs.

robertodr commented 4 years ago

This is ready for review. Please squash-merge The history is messy, not all intermediate commits build cleanly, and the changes in each commit are not atomic anyways.

chjacob-tubs commented 4 years ago

I will try to test and review this tomorrow!

robertodr commented 4 years ago

I will try to test and review this tomorrow!

Thank you! The C++ and Python interfaces look quite silly and contrived at the moment. I have decoupled the C++ implementation from the C API, which allows to do more sophisticated stuff C++-side. However, the binding still goes through a flat C API.

bast commented 4 years ago

Much praise and respect for this. I will test this within LSDalton/OpenRSP/XCint. Probably not quite tomorrow (travel) but this week.

chjacob-tubs commented 4 years ago

I will try to test and review this tomorrow!

Thank you! The C++ and Python interfaces look quite silly and contrived at the moment. I have decoupled the C++ implementation from the C API, which allows to do more sophisticated stuff C++-side. However, the binding still goes through a flat C API.

Maybe open an issue to also simplify the Python interface? I would be happy to work on that, but will wait for the examples first

bast commented 4 years ago

Much praise and respect for this. I will test this within LSDalton/OpenRSP/XCint. Probably not quite tomorrow (travel) but this week.

I am testing this tonight ...

bast commented 4 years ago

Great migration doc! I am getting segfaults when called from XCint but most probably my fault. I need to look at it with fresh eyes.

This confused me a bit (outdated example): https://github.com/robertodr/xcfun/blob/re-fortran/examples/CXX_host/example.cpp

robertodr commented 4 years ago

I will try to test and review this tomorrow!

Thank you! The C++ and Python interfaces look quite silly and contrived at the moment. I have decoupled the C++ implementation from the C API, which allows to do more sophisticated stuff C++-side. However, the binding still goes through a flat C API.

Maybe open an issue to also simplify the Python interface? I would be happy to work on that, but will wait for the examples first

I have opened #112 with a longer explanation.

robertodr commented 4 years ago

Great migration doc! I am getting segfaults when called from XCint but most probably my fault. I need to look at it with fresh eyes.

This confused me a bit (outdated example): https://github.com/robertodr/xcfun/blob/re-fortran/examples/CXX_host/example.cpp

I have fixed the example (was a bit sloppy with the rebase yesterday) Let me know about those segfaults :crossed_fingers:

bast commented 4 years ago

Thanks I will restart testing. I am 100% sure the segfaults will turn out to be my fault. I will report very soon.