Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
1c87794
Add C API for GauXC
awvwgk Jan 19, 2026
bb7b43f
Add Fortran API
awvwgk Jan 28, 2026
6440889
Fix defaults for GAUXC_ENABLE_FORTRAN values
awvwgk Feb 2, 2026
65d3ab7
Pass runtime environment by value
awvwgk Feb 5, 2026
407efcc
Fix typo in symbol
awvwgk Feb 5, 2026
9819ba4
Remove default error message
awvwgk Feb 5, 2026
3722de2
Pass by value
awvwgk Feb 5, 2026
ff16199
Fix check for number of primitives
awvwgk Feb 6, 2026
9b2d9da
Merge branch 'c-api' into fortran-api
awvwgk Feb 6, 2026
12a44b4
Minor fixes
awvwgk Feb 6, 2026
a7d430e
Move C API to separate directory
awvwgk Feb 11, 2026
07b1eb1
Restructure C API
awvwgk Feb 23, 2026
3b177b3
Merge branch 'c-api' into fortran-api
awvwgk Feb 23, 2026
b020748
Update Fortran API
awvwgk Feb 23, 2026
407ff08
Merge remote-tracking branch 'upstream/master' into c-api
awvwgk Feb 23, 2026
0ee7227
Merge branch 'c-api' into fortran-api
awvwgk Feb 23, 2026
8dada20
Add Fortran specific rt routines for using MPI_Comm_f2c converter
awvwgk Feb 23, 2026
7e26660
Fix type declaration for OpenMPI
awvwgk Mar 2, 2026
30267be
Move C headers
awvwgk Mar 2, 2026
1d8ee57
Merge branch 'c-api' into fortran-api
awvwgk Mar 2, 2026
4119222
Add convenience interface for molecule and basis set construction
awvwgk Mar 24, 2026
ace8c7e
Fix Fortran API
awvwgk Apr 15, 2026
ecf4a9c
Address review comments
awvwgk Apr 15, 2026
46c63ea
Merge branch 'c-api' into fortran-api
awvwgk Apr 15, 2026
e725c2d
Add additional integrator interfaces
awvwgk Apr 15, 2026
dbf4b1c
Fix signature for exc grad
awvwgk Apr 15, 2026
5f784ae
Fix test suite
awvwgk Apr 15, 2026
bc5eeee
Merge branch 'c-api' into fortran-api
awvwgk Apr 15, 2026
cacb3ef
More fixes
awvwgk Apr 15, 2026
2fe0d66
Merge branch 'c-api' into fortran-api
awvwgk Apr 15, 2026
aa4b650
Fix intent for status handler
awvwgk Apr 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ endif()


# GauXC Options
option( GAUXC_ENABLE_C "Enable C API" ON )
option( GAUXC_ENABLE_HOST "Enable Host Integrator" ON )
option( GAUXC_ENABLE_CUDA "Enable CUDA Bindings" OFF )
option( GAUXC_ENABLE_HIP "Enable HIP Bindings" OFF )
Expand All @@ -52,12 +53,19 @@ cmake_dependent_option( GAUXC_ENABLE_CUTLASS
"Enable CUTLASS Linear Algebra" OFF
"GAUXC_ENABLE_CUDA" OFF
)
cmake_dependent_option( GAUXC_ENABLE_FORTRAN
"Enable Fortran API" OFF
"GAUXC_ENABLE_C" OFF
)

# Default the feature variables
set( GAUXC_HAS_C FALSE CACHE BOOL "" FORCE )
set( GAUXC_HAS_FORTRAN FALSE CACHE BOOL "" FORCE )
set( GAUXC_HAS_HOST FALSE CACHE BOOL "" FORCE )
set( GAUXC_HAS_CUDA FALSE CACHE BOOL "" FORCE )
set( GAUXC_HAS_HIP FALSE CACHE BOOL "" FORCE )
set( GAUXC_HAS_MPI FALSE CACHE BOOL "" FORCE )
set( GAUXC_HAS_MPI_F08 FALSE CACHE BOOL "" FORCE )
set( GAUXC_HAS_OPENMP FALSE CACHE BOOL "" FORCE )
set( GAUXC_HAS_GAU2GRID FALSE CACHE STRING "" FORCE )
set( GAUXC_HAS_HDF5 FALSE CACHE BOOL "" FORCE )
Expand All @@ -67,10 +75,13 @@ set( GAUXC_HAS_CUTLASS FALSE CACHE BOOL "" FORCE )
set( GAUXC_BLAS_IS_LP64 FALSE CACHE BOOL "" FORCE )

mark_as_advanced( FORCE
GAUXC_HAS_C
GAUXC_HAS_FORTRAN
GAUXC_HAS_HOST
GAUXC_HAS_CUDA
GAUXC_HAS_HIP
GAUXC_HAS_MPI
GAUXC_HAS_MPI_F08
GAUXC_HAS_OPENMP
GAUXC_HAS_GAU2GRID
GAUXC_HAS_HDF5
Expand All @@ -86,6 +97,10 @@ if( NOT GAUXC_ENABLE_GAU2GRID )
will be made optional in a future release of GauXC [WIP]" )
endif()

if( GAUXC_ENABLE_FORTRAN )
enable_language( Fortran )
set( GAUXC_HAS_FORTRAN TRUE CACHE BOOL "GauXC has Fortran API" FORCE )
endif()

if( GAUXC_ENABLE_HOST )
set(GAUXC_HAS_HOST TRUE CACHE BOOL "GauXC has Host Bindings" FORCE)
Expand Down
6 changes: 6 additions & 0 deletions cmake/gauxc-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ include(CMakeFindDependencyMacro)
find_dependency( ExchCXX )
find_dependency( IntegratorXX )

set( GAUXC_HAS_C @GAUXC_HAS_C@ )
set( GAUXC_HAS_FORTRAN @GAUXC_HAS_FORTRAN@ )
set( GAUXC_HAS_HOST @GAUXC_HAS_HOST@ )
set( GAUXC_HAS_CUDA @GAUXC_HAS_CUDA@ )
set( GAUXC_HAS_HIP @GAUXC_HAS_HIP@ )
set( GAUXC_HAS_MAGMA @GAUXC_HAS_MAGMA@ )
set( GAUXC_HAS_NCCL @GAUXC_HAS_NCCL@ )
set( GAUXC_HAS_CUTLASS @GAUXC_HAS_CUTLASS@ )
set( GAUXC_HAS_MPI @GAUXC_HAS_MPI@ )
set( GAUXC_HAS_MPI_F08 @GAUXC_HAS_MPI_F08@ )
set( GAUXC_HAS_OPENMP @GAUXC_HAS_OPENMP@ )
set( GAUXC_HAS_GAU2GRID @GAUXC_HAS_GAU2GRID@ )
set( GAUXC_HAS_HDF5 @GAUXC_HAS_HDF5@ )
Expand All @@ -25,6 +28,9 @@ set( GAUXC_BLAS_IS_LP64 @GAUXC_BLAS_IS_LP64@ )
# Make sure C / CXX are enabled (former for BLAS discovery)
enable_language(C)
enable_language(CXX)
if(GAUXC_HAS_FORTRAN)
enable_language(Fortran)
endif()

if(GAUXC_HAS_OPENMP)
find_dependency( OpenMP )
Expand Down
31 changes: 31 additions & 0 deletions cmake/gauxc-test-drive.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
add_library( gauxc_test_drive INTERFACE )
find_package(test-drive CONFIG QUIET)
if( NOT test-drive_FOUND )
find_package(PkgConfig QUIET)
if(PkgConfig_FOUND)
pkg_check_modules(TEST_DRIVE test-drive)
set(test-drive_FOUND ${TEST_DRIVE_FOUND})
if(TEST_DRIVE_FOUND)
add_library(test-drive::test-drive INTERFACE IMPORTED)
target_include_directories(test-drive::test-drive INTERFACE ${TEST_DRIVE_INCLUDE_DIRS})
target_link_libraries(test-drive::test-drive INTERFACE ${TEST_DRIVE_LIBRARIES})
endif()
endif()
endif()
if( NOT test-drive_FOUND )
FetchContent_Declare(
test-drive
GIT_REPOSITORY https://github.com/fortran-lang/test-drive.git
GIT_TAG v0.5.0
)
set(TEST_DRIVE_BUILD_TESTING OFF CACHE BOOL "Build test-drive self tests" FORCE)
FetchContent_MakeAvailable(test-drive)

endif()
if(TARGET test-drive::test-drive)
target_link_libraries(gauxc_test_drive INTERFACE test-drive::test-drive)
elseif(TARGET test-drive)
target_link_libraries(gauxc_test_drive INTERFACE test-drive)
else()
target_link_libraries(gauxc_test_drive INTERFACE test-drive-lib)
endif()
42 changes: 42 additions & 0 deletions include/gauxc/c/atom.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* GauXC Copyright (c) 2020-2024, The Regents of the University of California,
* through Lawrence Berkeley National Laboratory (subject to receipt of
* any required approvals from the U.S. Dept. of Energy).
*
* (c) 2024-2025, Microsoft Corporation
*
* All rights reserved.
*
* See LICENSE.txt for details
*/
#pragma once

#ifdef __cplusplus
#include <cstdint>
#include <cstdbool>
#include <cstddef>
#else
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#endif

#ifdef __cplusplus
extern "C" {
namespace GauXC::C {
#endif

/**
* @brief GauXC C API Atom representation.
*/
typedef struct GauXCAtom {
int64_t Z; ///< Atomic number.
double x; ///< X coordinate (Bohr).
double y; ///< Y coordinate (Bohr).
double z; ///< Z coordinate (Bohr).
} GauXCAtom;

#ifdef __cplusplus
} // namespace GauXC::C
} // extern "C"
#endif
72 changes: 72 additions & 0 deletions include/gauxc/c/basisset.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
* GauXC Copyright (c) 2020-2024, The Regents of the University of California,
* through Lawrence Berkeley National Laboratory (subject to receipt of
* any required approvals from the U.S. Dept. of Energy).
*
* (c) 2024-2025, Microsoft Corporation
*
* All rights reserved.
*
* See LICENSE.txt for details
*/
#pragma once

#ifdef __cplusplus
#include <cstdint>
#include <cstdbool>
#include <cstddef>
#else
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#endif
#include <gauxc/c/types.h>
#include <gauxc/c/status.h>
#include <gauxc/c/shell.h>

#ifdef __cplusplus
extern "C" {
namespace GauXC::C {
#endif

/**
* @brief GauXC C API BasisSet handle.
*/
typedef struct GauXCBasisSet {
GauXCHeader hdr; ///< Header for internal use.
void* ptr; ///< Pointer to the BasisSet instance.
} GauXCBasisSet;

/**
* @brief Create a new BasisSet instance.
* @param status Status object to capture any errors.
* @return Handle to the created BasisSet.
*/
extern GauXCBasisSet gauxc_basisset_new( GauXCStatus* status );

/**
* @brief Create a new BasisSet instance from arrays of shells.
* @param status Status object to capture any errors.
* @param shells Pointer to an array of GauXCShell.
* @param nshells Number of shells in the array.
* @param normalize Whether to normalize the basis functions.
* @return Handle to the created BasisSet.
*/
extern GauXCBasisSet gauxc_basisset_new_from_shells(
GauXCStatus* status,
const GauXCShell* shells,
size_t nshells,
bool normalize
);

/**
* @brief Delete a BasisSet instance.
* @param status Status object to capture any errors.
* @param basis Handle to the BasisSet to delete.
*/
extern void gauxc_basisset_delete( GauXCStatus* status, GauXCBasisSet* basis );

#ifdef __cplusplus
} // namespace GauXC::C
} // extern "C"
#endif
81 changes: 81 additions & 0 deletions include/gauxc/c/enums.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/**
* GauXC Copyright (c) 2020-2024, The Regents of the University of California,
* through Lawrence Berkeley National Laboratory (subject to receipt of
* any required approvals from the U.S. Dept. of Energy).
*
* (c) 2024-2025, Microsoft Corporation
*
* All rights reserved.
*
* See LICENSE.txt for details
*/
#pragma once

#ifdef __cplusplus
extern "C" {
namespace GauXC::C {
#endif

/**
* @brief GauXC specific enums for the specification of radial quadratures
*
* Generally mapped to equivalent enums in IntegratorXX
*/
enum GauXC_RadialQuad {
GauXC_RadialQuad_Becke, ///< Becke radial quadrature
GauXC_RadialQuad_MuraKnowles, ///< Mura-Knowles radial quadrature
GauXC_RadialQuad_MurrayHandyLaming, ///< Murray-Handy-Laming radial quadrature
GauXC_RadialQuad_TreutlerAhlrichs ///< Treutler-Ahlrichs radial quadrature
};

/**
* @brief Specifications of grid defaults for atomic integration
*
* See https://gaussian.com/integral for specification
*/
enum GauXC_AtomicGridSizeDefault {
GauXC_AtomicGridSizeDefault_FineGrid, ///< Fine grid (least accurate)
GauXC_AtomicGridSizeDefault_UltraFineGrid, ///< Ultrafine grid (appropriate accuracy)
GauXC_AtomicGridSizeDefault_SuperFineGrid, ///< Superfine grid (most accurate)
GauXC_AtomicGridSizeDefault_GM3, ///< Treutler-Ahlrichs GM3
GauXC_AtomicGridSizeDefault_GM5 ///< Treutler-Ahlrichs GM5
};

/**
* @brief Specifications of atomic partitioning scheme for the
* molecular integration
*/
enum GauXC_XCWeightAlg {
GauXC_XCWeightAlg_NOTPARTITIONED, ///< Not partitioned
GauXC_XCWeightAlg_Becke, ///< The original Becke weighting scheme
GauXC_XCWeightAlg_SSF, ///< The Stratmann-Scuseria-Frisch weighting scheme
GauXC_XCWeightAlg_LKO ///< The Lauqua-Kuessman-Ochsenfeld weighting scheme
};

/**
* @brief Specification of the execution space for various operations
*/
enum GauXC_ExecutionSpace {
GauXC_ExecutionSpace_Host, ///< Execute task on the host
GauXC_ExecutionSpace_Device ///< Execute task on the device (e.g. GPU)
};

/// Supported Algorithms / Integrands
enum GauXC_SupportedAlg {
GauXC_SupportedAlg_XC, ///< Exchange-correlation integration
GauXC_SupportedAlg_DEN, ///< Density integration
GauXC_SupportedAlg_SNLINK ///< Seminumerical Coulomb/exchange (snLinK)
};

/// High-level specification of pruning schemes for atomic quadratures
enum GauXC_PruningScheme {
GauXC_PruningScheme_Unpruned, ///< Unpruned atomic quadrature
GauXC_PruningScheme_Robust, ///< The "Robust" scheme of Psi4
GauXC_PruningScheme_Treutler ///< The Treutler-Ahlrichs scheme
};


#ifdef __cplusplus
} // namespace GauXC::C
} // extern "C"
#endif
Loading
Loading