Skip to content

Add Fortran API#174

Open
awvwgk wants to merge 10 commits intowavefunction91:masterfrom
awvwgk:fortran-api
Open

Add Fortran API#174
awvwgk wants to merge 10 commits intowavefunction91:masterfrom
awvwgk:fortran-api

Conversation

@awvwgk
Copy link
Collaborator

@awvwgk awvwgk commented Jan 28, 2026

Closes #66

@awvwgk awvwgk self-assigned this Jan 28, 2026
@awvwgk awvwgk added the enhancement New feature or request label Jan 28, 2026
@awvwgk awvwgk force-pushed the fortran-api branch 5 times, most recently from 1832b49 to 59ab170 Compare January 28, 2026 13:43
@awvwgk awvwgk changed the title [WIP] Add Fortran API Add Fortran API Jan 28, 2026
@awvwgk awvwgk added the Fortran API Related to the Fortran API label Jan 28, 2026
@awvwgk awvwgk force-pushed the fortran-api branch 3 times, most recently from fcaf2e3 to d2fbfbc Compare January 29, 2026 21:01
- provide C enums
- add atom and molecule types
- add basis set and shell definitions
- add molecule grid and runtime environment
- add load balancer to C API
- add molecular weights for C API
- add functional class wrapping ExchCXX
- add xc integrator and matrix type
- add references for functionals
- add support for reading and writing from HDF5 in C
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds Fortran/C bindings to GauXC to enable integration with legacy Fortran codes. The implementation introduces a C API layer and Fortran interfaces that bind to the C functions using iso_c_binding.

Changes:

  • Added C API with headers and implementation for core functionality (molecule, basisset, matrix, integrator, etc.)
  • Added Fortran modules that interface with the C API using iso_c_binding
  • Updated build system to support optional C and Fortran API compilation via CMake options
  • Added test coverage for C API interoperability in existing test files

Reviewed changes

Copilot reviewed 66 out of 66 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
CMakeLists.txt Added GAUXC_ENABLE_C and GAUXC_ENABLE_FORTRAN options with build logic
src/CMakeLists.txt Conditional compilation of C/Fortran sources based on enabled features
include/gauxc/*.h C API headers for all major components (molecule, basisset, matrix, integrator, etc.)
src/c_*.cxx C API implementation wrapping C++ classes
src/.f90, src/.F90 Fortran modules providing iso_c_binding interfaces to C API
include/gauxc/util/c_*.hpp Helper utilities for C-C++ interop (pointer casting, conversions)
include/gauxc/gauxc_config.{h,f}.in Configuration templates for C/Fortran feature detection
tests/moltypes_test.cxx Added C API interoperability tests
src/external/c_hdf5_{read,write}.cxx C API for HDF5 I/O operations
src/external/hdf5_{read,write}.f90 Fortran wrappers for HDF5 operations
Comments suppressed due to low confidence (1)

include/gauxc/gauxc_config.h.in:14

  • The configuration macro GAUXC_HAS_C is defined in gauxc_config.f.in (line 1) but missing from gauxc_config.h.in. This creates an inconsistency where C/C++ code won't have access to the GAUXC_HAS_C macro to conditionally compile C API code, even though it's available in Fortran. Add #cmakedefine GAUXC_HAS_C to gauxc_config.h.in.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

enhancement New feature or request Fortran API Related to the Fortran API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Fortran/C Bindings

2 participants