diff --git a/.github/enable_sigma.cmake b/.github/enable_sigma.cmake deleted file mode 100644 index d6120ba5..00000000 --- a/.github/enable_sigma.cmake +++ /dev/null @@ -1 +0,0 @@ -set(ENABLE_SIGMA ON) diff --git a/.github/workflows/merge.yaml b/.github/workflows/merge.yaml index 90a1118c..9dd43acb 100644 --- a/.github/workflows/merge.yaml +++ b/.github/workflows/merge.yaml @@ -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/ diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index 58401a9f..4aa678a0 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -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 diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index 4d84db28..269a12a5 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -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 diff --git a/.gitignore b/.gitignore index b57d034a..38f70f07 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index db4b4c8b..130dff0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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. @@ -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::) diff --git a/cmake/get_nwx_cmake.cmake b/cmake/get_nwx_cmake.cmake index c99674d9..9188ad48 100644 --- a/cmake/get_nwx_cmake.cmake +++ b/cmake/get_nwx_cmake.cmake @@ -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. @@ -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() diff --git a/include/integrals/integrals.hpp b/cxx/include/integrals/integrals.hpp similarity index 100% rename from include/integrals/integrals.hpp rename to cxx/include/integrals/integrals.hpp diff --git a/include/integrals/integrals_mm.hpp b/cxx/include/integrals/integrals_mm.hpp similarity index 100% rename from include/integrals/integrals_mm.hpp rename to cxx/include/integrals/integrals_mm.hpp diff --git a/include/integrals/property_types.hpp b/cxx/include/integrals/property_types.hpp similarity index 100% rename from include/integrals/property_types.hpp rename to cxx/include/integrals/property_types.hpp diff --git a/src/integrals/ao_integrals/ao_integrals.hpp b/cxx/src/integrals/ao_integrals/ao_integrals.hpp similarity index 100% rename from src/integrals/ao_integrals/ao_integrals.hpp rename to cxx/src/integrals/ao_integrals/ao_integrals.hpp diff --git a/src/integrals/ao_integrals/ao_integrals_driver.cpp b/cxx/src/integrals/ao_integrals/ao_integrals_driver.cpp similarity index 100% rename from src/integrals/ao_integrals/ao_integrals_driver.cpp rename to cxx/src/integrals/ao_integrals/ao_integrals_driver.cpp diff --git a/src/integrals/ao_integrals/coulomb_metric.cpp b/cxx/src/integrals/ao_integrals/coulomb_metric.cpp similarity index 100% rename from src/integrals/ao_integrals/coulomb_metric.cpp rename to cxx/src/integrals/ao_integrals/coulomb_metric.cpp diff --git a/src/integrals/ao_integrals/df_integral.cpp b/cxx/src/integrals/ao_integrals/df_integral.cpp similarity index 100% rename from src/integrals/ao_integrals/df_integral.cpp rename to cxx/src/integrals/ao_integrals/df_integral.cpp diff --git a/src/integrals/ao_integrals/j_density_fitted.cpp b/cxx/src/integrals/ao_integrals/j_density_fitted.cpp similarity index 100% rename from src/integrals/ao_integrals/j_density_fitted.cpp rename to cxx/src/integrals/ao_integrals/j_density_fitted.cpp diff --git a/src/integrals/ao_integrals/j_four_center.cpp b/cxx/src/integrals/ao_integrals/j_four_center.cpp similarity index 100% rename from src/integrals/ao_integrals/j_four_center.cpp rename to cxx/src/integrals/ao_integrals/j_four_center.cpp diff --git a/src/integrals/ao_integrals/k_density_fitted.cpp b/cxx/src/integrals/ao_integrals/k_density_fitted.cpp similarity index 100% rename from src/integrals/ao_integrals/k_density_fitted.cpp rename to cxx/src/integrals/ao_integrals/k_density_fitted.cpp diff --git a/src/integrals/ao_integrals/k_four_center.cpp b/cxx/src/integrals/ao_integrals/k_four_center.cpp similarity index 100% rename from src/integrals/ao_integrals/k_four_center.cpp rename to cxx/src/integrals/ao_integrals/k_four_center.cpp diff --git a/src/integrals/ao_integrals/uq_atom_symm_blocked_driver.cpp b/cxx/src/integrals/ao_integrals/uq_atom_symm_blocked_driver.cpp similarity index 100% rename from src/integrals/ao_integrals/uq_atom_symm_blocked_driver.cpp rename to cxx/src/integrals/ao_integrals/uq_atom_symm_blocked_driver.cpp diff --git a/src/integrals/ao_integrals/uq_driver.cpp b/cxx/src/integrals/ao_integrals/uq_driver.cpp similarity index 100% rename from src/integrals/ao_integrals/uq_driver.cpp rename to cxx/src/integrals/ao_integrals/uq_driver.cpp diff --git a/src/python/export_integrals.cpp b/cxx/src/integrals/export_integrals.cpp similarity index 96% rename from src/python/export_integrals.cpp rename to cxx/src/integrals/export_integrals.cpp index ce3139c4..2907b5f8 100644 --- a/src/python/export_integrals.cpp +++ b/cxx/src/integrals/export_integrals.cpp @@ -14,10 +14,10 @@ * limitations under the License. */ +#include "export_integrals.hpp" #include "export_property_types.hpp" #include #include -#include namespace integrals { diff --git a/cxx/src/integrals/export_integrals.hpp b/cxx/src/integrals/export_integrals.hpp new file mode 100644 index 00000000..e4ab543e --- /dev/null +++ b/cxx/src/integrals/export_integrals.hpp @@ -0,0 +1,30 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once +#include +#include + +namespace integrals { + +using python_module_type = pybind11::module_; + +using python_module_reference = python_module_type&; + +template +using python_class_type = pybind11::class_; + +} // namespace integrals diff --git a/src/python/export_property_types.hpp b/cxx/src/integrals/export_property_types.hpp similarity index 88% rename from src/python/export_property_types.hpp rename to cxx/src/integrals/export_property_types.hpp index f7033a62..08a429b5 100644 --- a/src/python/export_property_types.hpp +++ b/cxx/src/integrals/export_property_types.hpp @@ -14,12 +14,14 @@ * limitations under the License. */ +#pragma once +#include "export_integrals.hpp" #include #include namespace integrals { -inline void export_property_types(auto& m) { +inline void export_property_types(python_module_reference m) { using namespace integrals::property_types; EXPORT_PROPERTY_TYPE(DecontractBasisSet, m); diff --git a/src/integrals/integrals_mm.cpp b/cxx/src/integrals/integrals_mm.cpp similarity index 100% rename from src/integrals/integrals_mm.cpp rename to cxx/src/integrals/integrals_mm.cpp diff --git a/src/integrals/libint/analytic_error.cpp b/cxx/src/integrals/libint/analytic_error.cpp similarity index 100% rename from src/integrals/libint/analytic_error.cpp rename to cxx/src/integrals/libint/analytic_error.cpp diff --git a/src/integrals/libint/black_box_primitive_estimator.cpp b/cxx/src/integrals/libint/black_box_primitive_estimator.cpp similarity index 100% rename from src/integrals/libint/black_box_primitive_estimator.cpp rename to cxx/src/integrals/libint/black_box_primitive_estimator.cpp diff --git a/src/integrals/libint/cauchy_schwarz_primitive_estimator.cpp b/cxx/src/integrals/libint/cauchy_schwarz_primitive_estimator.cpp similarity index 100% rename from src/integrals/libint/cauchy_schwarz_primitive_estimator.cpp rename to cxx/src/integrals/libint/cauchy_schwarz_primitive_estimator.cpp diff --git a/src/integrals/libint/detail_/fill_tensor.hpp b/cxx/src/integrals/libint/detail_/fill_tensor.hpp similarity index 100% rename from src/integrals/libint/detail_/fill_tensor.hpp rename to cxx/src/integrals/libint/detail_/fill_tensor.hpp diff --git a/src/integrals/libint/detail_/get_basis_sets.hpp b/cxx/src/integrals/libint/detail_/get_basis_sets.hpp similarity index 100% rename from src/integrals/libint/detail_/get_basis_sets.hpp rename to cxx/src/integrals/libint/detail_/get_basis_sets.hpp diff --git a/src/integrals/libint/detail_/libint_op.hpp b/cxx/src/integrals/libint/detail_/libint_op.hpp similarity index 100% rename from src/integrals/libint/detail_/libint_op.hpp rename to cxx/src/integrals/libint/detail_/libint_op.hpp diff --git a/src/integrals/libint/detail_/make_engine.hpp b/cxx/src/integrals/libint/detail_/make_engine.hpp similarity index 100% rename from src/integrals/libint/detail_/make_engine.hpp rename to cxx/src/integrals/libint/detail_/make_engine.hpp diff --git a/src/integrals/libint/detail_/make_libint_basis_set.hpp b/cxx/src/integrals/libint/detail_/make_libint_basis_set.hpp similarity index 100% rename from src/integrals/libint/detail_/make_libint_basis_set.hpp rename to cxx/src/integrals/libint/detail_/make_libint_basis_set.hpp diff --git a/src/integrals/libint/detail_/primitive_pair_estimators.hpp b/cxx/src/integrals/libint/detail_/primitive_pair_estimators.hpp similarity index 100% rename from src/integrals/libint/detail_/primitive_pair_estimators.hpp rename to cxx/src/integrals/libint/detail_/primitive_pair_estimators.hpp diff --git a/src/integrals/libint/detail_/shells2ord.hpp b/cxx/src/integrals/libint/detail_/shells2ord.hpp similarity index 100% rename from src/integrals/libint/detail_/shells2ord.hpp rename to cxx/src/integrals/libint/detail_/shells2ord.hpp diff --git a/src/integrals/libint/libint.cpp b/cxx/src/integrals/libint/libint.cpp similarity index 100% rename from src/integrals/libint/libint.cpp rename to cxx/src/integrals/libint/libint.cpp diff --git a/src/integrals/libint/libint.hpp b/cxx/src/integrals/libint/libint.hpp similarity index 100% rename from src/integrals/libint/libint.hpp rename to cxx/src/integrals/libint/libint.hpp diff --git a/src/integrals/libint/libint_visitor.hpp b/cxx/src/integrals/libint/libint_visitor.hpp similarity index 100% rename from src/integrals/libint/libint_visitor.hpp rename to cxx/src/integrals/libint/libint_visitor.hpp diff --git a/src/integrals/libint/primitive_contractor.cpp b/cxx/src/integrals/libint/primitive_contractor.cpp similarity index 100% rename from src/integrals/libint/primitive_contractor.cpp rename to cxx/src/integrals/libint/primitive_contractor.cpp diff --git a/src/integrals/libint/primitive_error_model.cpp b/cxx/src/integrals/libint/primitive_error_model.cpp similarity index 100% rename from src/integrals/libint/primitive_error_model.cpp rename to cxx/src/integrals/libint/primitive_error_model.cpp diff --git a/src/integrals/libint/primitive_normalization.cpp b/cxx/src/integrals/libint/primitive_normalization.cpp similarity index 100% rename from src/integrals/libint/primitive_normalization.cpp rename to cxx/src/integrals/libint/primitive_normalization.cpp diff --git a/src/integrals/libint/raw_primitive_eris.cpp b/cxx/src/integrals/libint/raw_primitive_eris.cpp similarity index 100% rename from src/integrals/libint/raw_primitive_eris.cpp rename to cxx/src/integrals/libint/raw_primitive_eris.cpp diff --git a/src/integrals/uncertain_types.hpp b/cxx/src/integrals/uncertain_types.hpp similarity index 100% rename from src/integrals/uncertain_types.hpp rename to cxx/src/integrals/uncertain_types.hpp diff --git a/src/integrals/utils/decontract_basis_set.cpp b/cxx/src/integrals/utils/decontract_basis_set.cpp similarity index 100% rename from src/integrals/utils/decontract_basis_set.cpp rename to cxx/src/integrals/utils/decontract_basis_set.cpp diff --git a/src/integrals/utils/get_permutations.hpp b/cxx/src/integrals/utils/get_permutations.hpp similarity index 100% rename from src/integrals/utils/get_permutations.hpp rename to cxx/src/integrals/utils/get_permutations.hpp diff --git a/src/integrals/utils/primitive_index_helpers.hpp b/cxx/src/integrals/utils/primitive_index_helpers.hpp similarity index 100% rename from src/integrals/utils/primitive_index_helpers.hpp rename to cxx/src/integrals/utils/primitive_index_helpers.hpp diff --git a/src/integrals/utils/rank2_shell_norm.hpp b/cxx/src/integrals/utils/rank2_shell_norm.hpp similarity index 100% rename from src/integrals/utils/rank2_shell_norm.hpp rename to cxx/src/integrals/utils/rank2_shell_norm.hpp diff --git a/src/integrals/utils/screen_primitive_pairs.cpp b/cxx/src/integrals/utils/screen_primitive_pairs.cpp similarity index 100% rename from src/integrals/utils/screen_primitive_pairs.cpp rename to cxx/src/integrals/utils/screen_primitive_pairs.cpp diff --git a/src/integrals/utils/uncertainty_reductions.hpp b/cxx/src/integrals/utils/uncertainty_reductions.hpp similarity index 100% rename from src/integrals/utils/uncertainty_reductions.hpp rename to cxx/src/integrals/utils/uncertainty_reductions.hpp diff --git a/src/integrals/utils/utils.hpp b/cxx/src/integrals/utils/utils.hpp similarity index 100% rename from src/integrals/utils/utils.hpp rename to cxx/src/integrals/utils/utils.hpp diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..d7413948 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,49 @@ +# 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. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[build-system] +requires = [ + "scikit-build-core>=0.10", + "setuptools-scm>=8", +] +build-backend = "scikit_build_core.build" + +[project] +name = "nwchemex-integrals" +dynamic = ["version"] +description = "Integral evaluation modules for the NWChemEx ecosystem" +license = { text = "Apache-2.0" } +requires-python = ">=3.8" +dependencies = [ + "pybind11", + "nwchemex-nwxcmake>=0.1.0", + "nwchemex-simde>=0.0.77", +] + +[project.optional-dependencies] +dev = ["pytest", "pre-commit"] + +[tool.scikit-build] +metadata.version.provider = "scikit_build_core.metadata.setuptools_scm" +# All installed content comes from the CMake install; no pure-Python packages. +wheel.packages = [] +build-dir = "build" + +[tool.setuptools_scm] +fallback_version = "0.0.0" + +# For editable (developer) installs, also build the tests. +[[tool.scikit-build.overrides]] +if.state = "editable" +cmake.args = ["-DDEVELOPER_SETUP=ON"] diff --git a/tests/python/conftest.py b/tests/python/conftest.py new file mode 100644 index 00000000..d9c5a96e --- /dev/null +++ b/tests/python/conftest.py @@ -0,0 +1,35 @@ +# +# 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. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import parallelzone as pz +import pytest + + +@pytest.fixture(scope="session", autouse=True) +def _session_runtime_view(): + """ + Holds a single RuntimeView for the whole pytest session. + + MPI may only be initialized/finalized once per process. The first + RuntimeView constructed owns that responsibility; individual test + modules construct their own RuntimeView per test (e.g. in setUp), + which is safe only as long as this session-scoped instance is still + alive to keep MPI initialized in between. Without this, pytest would + run each test module independently and MPI would be finalized after + the first module's tests finished, breaking every module after it. + """ + rv = pz.runtime.RuntimeView() + yield rv diff --git a/tests/python/unit_tests/utils/test_decontract_basis_set.py b/tests/python/unit_tests/utils/test_decontract_basis_set.py index fcb2a599..b4e5982a 100644 --- a/tests/python/unit_tests/utils/test_decontract_basis_set.py +++ b/tests/python/unit_tests/utils/test_decontract_basis_set.py @@ -16,13 +16,12 @@ import unittest +import integrals import parallelzone as pz import pluginplay as pp from chemist import PointD, ShellType from chemist.basis_set import AOBasisSetD, AtomicBasisSetD, ContractedGaussianD -import integrals - class TestDecontractBasisSet(unittest.TestCase): def test_temp(self): diff --git a/version.txt b/version.txt deleted file mode 100644 index 3eefcb9d..00000000 --- a/version.txt +++ /dev/null @@ -1 +0,0 @@ -1.0.0