New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fortran interface #94

Merged
merged 18 commits into from Aug 22, 2018

Conversation

Projects
None yet
2 participants
@pseewald
Contributor

pseewald commented Mar 20, 2018

This Fortran interface facilitates the use of libint in codes written in Fortran 2003 or later. I tested that it is correct for different libint configurations. I also added an example that documents how to use libint in Fortran.

Instructions: After generating a libint library

cd libint-2.x.y
./configure --enable-fortran FC=... FCFLAGS=...
make
make fortran
make install

This compiles a Fortran example in fortran subdirectory and installs the libint_f.mod file in include. So far I tested with gcc/gfortran only.

Todo's (I can take care of them if you are inclined to accept this pull request):

  • add tests
  • update documentation
@evaleev

This comment has been minimized.

Owner

evaleev commented Jul 9, 2018

Dear Patrick, this is a great start (and sorry for taking so long to get to this ... only now have time to push 2.5.0 out). I'm still trying to get my head around what is going on ... more tests would be great, esp compute_eri generalized to contracted shells, etc.

@evaleev evaleev added this to the v2.5.0 milestone Jul 9, 2018

evaleev and others added some commits Jul 9, 2018

@pseewald

This comment has been minimized.

Contributor

pseewald commented Jul 10, 2018

Dear Edward, thanks for your comments, I will add tests. I wonder whether the creation of fortran_incldefs.h (which is clearly a hack) could be avoided. For this I see two options:

  • the Libint compiler could write all #define macros of libint2_types.h into a separate file. This file could be used by Fortran instead of the fortran_incldefs.h.
  • alternatively the Libint compiler could emit a Fortran derived type with exactly the same structure as the C struct Libint_t.

For maintainability I'd prefer the second option over the manually coded Fortran derived type, but I don't know if and how this can be implemented into Libint compiler. Would you recommend this solution, and if yes, where should I start looking for implementing this?

@evaleev

This comment has been minimized.

Owner

evaleev commented Jul 10, 2018

@pseewald

This comment has been minimized.

Contributor

pseewald commented Jul 10, 2018

Could we just build a postprocessor (e.g. in python) to "rewrite"
libint2_types.h into a header file that includes the Fortran binding +
metadata?

Yes I agree that this is relatively easy and a good solution. I could write a Python script but this would introduce a Python dependency for building libint with Fortran support. Alternatively, I could try to write a simple shell script instead. What is your preference?

@evaleev

This comment has been minimized.

Owner

evaleev commented Jul 10, 2018

@evaleev

This comment has been minimized.

Owner

evaleev commented Jul 10, 2018

@pseewald

This comment has been minimized.

Contributor

pseewald commented Aug 22, 2018

Dear Eduard, I think I committed everything that was on my todo list. The test is generalized to contracted integrals, also the numerical results are checked with an identical C++ implementation. And the Fortran libint_t type is auto-generated in a way that should be maintainable.

Is there anything else?

@evaleev evaleev merged commit c2e0a72 into evaleev:master Aug 22, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@evaleev

This comment has been minimized.

Owner

evaleev commented Aug 22, 2018

Patrick: looks great! Thank you so much. Merging..

@pseewald

This comment has been minimized.

Contributor

pseewald commented Aug 23, 2018

Thanks a lot for your help. I would like to update documentation for using Libint in Fortran before 2.5.0 release - is there a timeframe for that?

@evaleev

This comment has been minimized.

Owner

evaleev commented Aug 23, 2018

@pseewald pseewald referenced this pull request Sep 7, 2018

Open

Fortran documentation #113

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment