Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion .github/enable_sigma.cmake

This file was deleted.

48 changes: 48 additions & 0 deletions .github/workflows/merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,51 @@ jobs:
doc_target: "integrals_cxx_api"
generate_module_docs: true
secrets: inherit

platform_matrix:
uses: NWChemEx/.github/.github/workflows/platform_matrix.yaml@master

build_pypi_dist:
needs: [tag-commit, platform_matrix]
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.platform_matrix.outputs.release_matrix) }}
runs-on: ${{ matrix.os }}
steps:
- name: Build PyPI Distribution
uses: NWChemEx/.github/.github/actions/build_pypi_dist@master
with:
cibw_build: ${{ matrix.cibw_build }}
build_sdist: ${{ matrix.os == 'ubuntu-latest' && 'true' || 'false' }}
needs_mpi: "true"
needs_boost: "true"
needs_eigen: "true"

- name: Upload Distribution Artifact
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}
path: dist/

# A separate, ubuntu-only publish job (rather than a publish step per
# build_pypi_dist leg) because pypa/gh-action-pypi-publish only runs on
# Linux, and because PyPI trusted publishing does not support reusable
# workflows (this job must be defined directly here, not delegated).
deploy_to_pypi:
needs: build_pypi_dist
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Download All Distributions
uses: actions/download-artifact@v4
with:
pattern: dist-*
path: dist
merge-multiple: true

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
25 changes: 16 additions & 9 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,32 @@
#

name: Nightly Workflow
# Re-runs the same build/test jobs pull_request.yaml runs, on a schedule, to
# catch breakage that originates outside the repo (upstream dependency
# releases, refreshed GitHub runner images) rather than from a code change.
# Keep the job list below in sync with pull_request.yaml.

on:
schedule:
- cron: "0 6 * * *" # Every day at 06:00 UTC (00:00 CST)

jobs:
test_library:
uses: NWChemEx/.github/.github/workflows/test_nwx_library.yaml@master
test_cmake_build:
uses: NWChemEx/.github/.github/workflows/test_nwx_cmake_build.yaml@master
with:
compilers: '["gcc-14", "clang-18"]'
run_python_tests: "true"

test_enable_sigma:
uses: NWChemEx/.github/.github/workflows/test_nwx_library.yaml@master
uses: NWChemEx/.github/.github/workflows/test_nwx_cmake_build.yaml@master
with:
compilers: '["gcc-14", "clang-18"]'
repo_toolchain: ".github/enable_sigma.cmake"
run_python_tests: "true"
cmake_opts: "-DENABLE_SIGMA=ON"

test_enable_openmp:
uses: NWChemEx/.github/.github/workflows/test_nwx_library.yaml@master
uses: NWChemEx/.github/.github/workflows/test_nwx_cmake_build.yaml@master
with:
compilers: '["gcc-14", "clang-18"]'
repo_toolchain: ".github/enable_openmp.cmake"
run_python_tests: "true"
cmake_opts: "-DINTEGRALS_ENABLE_OPENMP=ON"

test_pip_build:
uses: NWChemEx/.github/.github/workflows/test_nwx_pip_build.yaml@master
21 changes: 12 additions & 9 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,22 @@ jobs:
with:
doc_target: "integrals_cxx_api"

test_library:
uses: NWChemEx/.github/.github/workflows/test_nwx_library.yaml@master
test_cmake_build:
uses: NWChemEx/.github/.github/workflows/test_nwx_cmake_build.yaml@master
with:
compilers: '["gcc-14", "clang-18"]'
run_python_tests: "true"

test_enable_sigma:
uses: NWChemEx/.github/.github/workflows/test_nwx_library.yaml@master
uses: NWChemEx/.github/.github/workflows/test_nwx_cmake_build.yaml@master
with:
compilers: '["gcc-14", "clang-18"]'
repo_toolchain: ".github/enable_sigma.cmake"
run_python_tests: "true"
cmake_opts: "-DENABLE_SIGMA=ON"

test_enable_openmp:
uses: NWChemEx/.github/.github/workflows/test_nwx_library.yaml@master
uses: NWChemEx/.github/.github/workflows/test_nwx_cmake_build.yaml@master
with:
compilers: '["gcc-14", "clang-18"]'
repo_toolchain: ".github/enable_openmp.cmake"
run_python_tests: "true"
cmake_opts: "-DINTEGRALS_ENABLE_OPENMP=ON"

test_pip_build:
uses: NWChemEx/.github/.github/workflows/test_nwx_pip_build.yaml@master
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,8 @@ Release/

# Users commonly store their specific CMake settings in a toolchain file
toolchain.cmake

# MacOS files
.DS_Store
# Automatically installed in dev mode
.pre-commit-config.yaml
134 changes: 46 additions & 88 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 NWChemEx-Project
# Copyright 2026 NWChemEx-Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,105 +14,63 @@

cmake_minimum_required(VERSION 3.14)

# Downloads common CMake modules used throughout NWChemEx
# Downloads common CMake modules used throughout NWChemEx. Included before
# project() so nwx_set_version() is available to compute the version.
include(cmake/get_nwx_cmake.cmake)


#Sets the version to whatever git thinks it is
include(get_version_from_git)
get_version_from_git(integrals_version "${CMAKE_CURRENT_LIST_DIR}")
# Version from scikit-build-core (wheels/sdists) or the latest git tag.
include(nwx_set_version)
nwx_set_version(integrals_version "${CMAKE_CURRENT_LIST_DIR}")
project(integrals VERSION "${integrals_version}" LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)

include(get_cmaize)
include(nwx_cxx_api_docs)

### Paths ###
set(INTEGRALS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
set(INTEGRALS_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
set(INTEGRALS_TESTS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tests")

nwx_cxx_api_docs("${INTEGRALS_SOURCE_DIR}" "${INTEGRALS_INCLUDE_DIR}")

### Options ###
cmaize_option_list(
BUILD_TESTING OFF "Should we build the tests?"
BUILD_PYBIND11_PYBINDINGS ON "Build pybind11 python3 bindings?"
ENABLE_SIGMA OFF "Should we enable Sigma for uncertainty tracking?"
INTEGRALS_ENABLE_OPENMP OFF "Should we enable OpenMP for threading?"
)


cmaize_find_or_build_dependency(
simde
URL github.com/NWChemEx/SimDE
BUILD_TARGET simde
FIND_TARGET nwx::simde
CMAKE_ARGS BUILD_TESTING=OFF
BUILD_PYBIND11_PYBINDINGS=${BUILD_PYBIND11_PYBINDINGS}
ENABLE_SIGMA=${ENABLE_SIGMA}
)
include(disable_in_source_builds)
include(set_default_nwx_options)
option(INTEGRALS_ENABLE_OPENMP "Enable OpenMP for threading?" OFF)

cmaize_find_or_build_dependency(
Libint2
URL https://github.com/evaleev/libint/releases/download/v2.11.0/libint-2.11.0.tgz
BUILD_TARGET libint2
FIND_TARGET Libint2::int2
CMAKE_ARGS ENABLE_FORTRAN=OFF
ENABLE_MPFR=OFF
LIBINT2_PYTHON=OFF
)
# Documentation target (no-op unless BUILD_DOCS is on)
include(nwx_cxx_api_docs)
nwx_cxx_api_docs("cxx/include" "cxx/src")

set(project_depends Libint2 simde)
### Dependencies ###
include(get_dependencies)
get_dependencies(simde libint2)

if("${INTEGRALS_ENABLE_OPENMP}")
find_package(OpenMP REQUIRED)
list(APPEND project_depends OpenMP::OpenMP_CXX)
set(integrals_private_depends libint2)
if(INTEGRALS_ENABLE_OPENMP)
find_package(OpenMP REQUIRED COMPONENTS CXX)
list(APPEND integrals_private_depends OpenMP::OpenMP_CXX)
endif()

cmaize_add_library(
${PROJECT_NAME}
SOURCE_DIR "${INTEGRALS_SOURCE_DIR}/${PROJECT_NAME}"
INCLUDE_DIRS "${INTEGRALS_INCLUDE_DIR}/${PROJECT_NAME}"
DEPENDS "${project_depends}"
)

cmaize_add_executable(
primitive_error_models
SOURCE_DIR "examples/primitive_error_models"
DEPENDS "${PROJECT_NAME}"
)

include(nwx_pybind11)
nwx_add_pybind11_module(
${PROJECT_NAME}
SOURCE_DIR "${INTEGRALS_SOURCE_DIR}/python"
DEPENDS "${PROJECT_NAME}"
)

if("${BUILD_TESTING}")
set(CXX_TEST_DIR ${INTEGRALS_TESTS_DIR}/cxx/)
set(PYTHON_TEST_DIR ${INTEGRALS_TESTS_DIR}/python)

cmaize_find_or_build_dependency(
Catch2
URL github.com/catchorg/Catch2
BUILD_TARGET Catch2
FIND_TARGET Catch2::Catch2
VERSION v3.6.0
### Library ###
# simde is a PUBLIC dep (appears in integrals' public headers); libint2 and
# OpenMP are implementation details (PRIVATE).
include(nwx_library)
nwx_library(${PROJECT_NAME} "cxx/include" "cxx/src"
simde PRIVATE ${integrals_private_depends})

### Python bindings (no-op unless BUILD_PYBIND11_BINDINGS is on) ###
include(nwx_python_module)
nwx_python_module(${PROJECT_NAME} "cxx/src")

### Tests ###
if(BUILD_TESTING)
include(catch2_tests_from_dir)
catch2_tests_from_dir(
"test_unit_${PROJECT_NAME}"
"tests/cxx/unit/${PROJECT_NAME}"
${PROJECT_NAME} ${NWX_DEP_TARGET_libint2}
PRIVATE_INCLUDES "cxx/src"
)

cmaize_add_tests(
test_unit_integrals
SOURCE_DIR "${CXX_TEST_DIR}/unit/${PROJECT_NAME}"
INCLUDE_DIRS "${INTEGRALS_SOURCE_DIR}/${PROJECT_NAME}"
DEPENDS Catch2 ${PROJECT_NAME}
# Demonstration executable exercised alongside the tests.
add_executable(primitive_error_models
examples/primitive_error_models/main.cpp
)
target_link_libraries(primitive_error_models PRIVATE ${PROJECT_NAME})

nwx_pybind11_tests(
py_integrals "${PYTHON_TEST_DIR}/unit_tests/test_integrals.py"
SUBMODULES pluginplay chemist tensorwrapper parallelzone simde
include(nwx_python_test)
nwx_python_test(
py_unit_test_${PROJECT_NAME}
"${CMAKE_CURRENT_LIST_DIR}/tests/python/unit_tests/test_integrals.py"
)
endif()

cmaize_add_package(${PROJECT_NAME} NAMESPACE nwx::)
72 changes: 60 additions & 12 deletions cmake/get_nwx_cmake.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 NWChemEx-Project
# Copyright 2024 NWChemEx Community
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,18 +14,66 @@

include_guard()

# Puts the shared NWXCMake modules on CMAKE_MODULE_PATH. This runs *before*
# project() so factored helpers (e.g. nwx_set_version) are available to feed
# project(VERSION ...).
#
# Resolution order:
# 1. A pip-installed `nwxcmake` package (query it for its cmake/ dir). An
# editable install (`pip install -e /path/to/NWXCMake`) points at a local
# working copy, so NWXCMake edits are picked up with no git push.
# 2. Fallback: FetchContent from github.com/NWChemEx/NWXCMake.
macro(get_nwx_cmake)
include(FetchContent)
FetchContent_Declare(
nwx_cmake
GIT_REPOSITORY https://github.com/NWChemEx/NWXCMake
)
FetchContent_MakeAvailable(nwx_cmake)
set(
CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${nwx_cmake_SOURCE_DIR}/cmake"
CACHE STRING ""
FORCE
)
if(NOT _NWX_CMAKE_MODULE_DIR)
# find_package(Python) needs no enabled language, so it is safe here,
# before project(). Request only the interpreter to avoid a dev/compiler
# probe this early.
find_package(Python QUIET COMPONENTS Interpreter)

set(_gnc_local_dir "")
if(Python_Interpreter_FOUND)
execute_process(
COMMAND "${Python_EXECUTABLE}" -c
"import nwxcmake,sys;sys.stdout.write(nwxcmake.cmake_dir())"
OUTPUT_VARIABLE _gnc_local_dir
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE _gnc_rc
ERROR_QUIET
)
if(NOT _gnc_rc EQUAL 0)
set(_gnc_local_dir "")
endif()
endif()

if(_gnc_local_dir AND IS_DIRECTORY "${_gnc_local_dir}")
message(STATUS
"NWXCMake: using local pip package at ${_gnc_local_dir}"
)
set(_gnc_resolved "${_gnc_local_dir}")
else()
message(STATUS
"NWXCMake: pip package not found; fetching from git"
)
include(FetchContent)
FetchContent_Declare(
nwx_cmake
GIT_REPOSITORY https://github.com/NWChemEx/NWXCMake
)
FetchContent_MakeAvailable(nwx_cmake)
set(_gnc_resolved "${nwx_cmake_SOURCE_DIR}/cmake")
endif()

# Cache the resolved directory (not CMAKE_MODULE_PATH itself) so
# reconfigures are stable. Clear this var (or the build dir) to
# re-resolve after switching between the pip and git sources.
set(_NWX_CMAKE_MODULE_DIR "${_gnc_resolved}"
CACHE INTERNAL "Resolved NWXCMake module directory"
)
endif()

# Prepend so NWXCMake modules win; set in the caller's scope (macro), do not
# FORCE-cache CMAKE_MODULE_PATH (avoids accumulating stale entries).
list(PREPEND CMAKE_MODULE_PATH "${_NWX_CMAKE_MODULE_DIR}")
endmacro()

get_nwx_cmake()
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
*/

#include "export_integrals.hpp"
#include "export_property_types.hpp"
#include <integrals/integrals_mm.hpp>
#include <pluginplay/plugin/plugin.hpp>
#include <pybind11/pybind11.h>

namespace integrals {

Expand Down
Loading
Loading