Skip to content
Draft
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
3 changes: 3 additions & 0 deletions .clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CompileFlags: # Tweak the parse settings, example directory given to show format
Add:
- "-I./include"
1 change: 1 addition & 0 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
pull_request:
branches: ["main"]
tags: "v*"
workflow_dispatch:
env:
BUILD_TYPE: Release
CPM_SOURCE_CACHE: ${{github.workspace}}/cache/cpm
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,5 @@ coverage/
*.cube
*.pgrid
*.ply
.direnv
.envrc
26 changes: 16 additions & 10 deletions 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
set(CMAKE_UNITY_BUILD OFF)

if (NOT NIX_BUILD)
CPMAddPackage(
NAME fmt
GITHUB_REPOSITORY "fmtlib/fmt"
Expand All @@ -14,6 +15,8 @@ CPMAddPackage(
VERSION "1.x"
)

endif ()

if(NOT "${USE_SYSTEM_TBB}")

set(TBB_OPTIONS "")
Expand All @@ -30,15 +33,17 @@ endif()
if(WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
list(APPEND TBB_OPTIONS "CMAKE_CXX_FLAGS=-O2 -fno-stack-clash-protection -fno-fcf-protection")
endif()

if (NOT NIX_BUILD)
CPMAddPackage(
NAME oneTBB
GITHUB_REPOSITORY "uxlfoundation/oneTBB"
VERSION "2022.2.0"
OPTIONS ${TBB_OPTIONS}
)
endif()
endif()

if (NOT NIX_BUILD)
CPMAddPackage(
NAME unordered_dense
GITHUB_REPOSITORY "martinus/unordered_dense"
Expand All @@ -59,19 +64,21 @@ CPMAddPackage(
VERSION "2.4.2"
)

endif()
if("${USE_MLX}")
CPMAddPackage(
NAME mlx
GITHUB_REPOSITORY "ml-explore/mlx"
VERSION "0.6.0"
)
else()
if (NOT NIX_BUILD)
CPMAddPackage(
NAME "nlohmann_json"
GITHUB_REPOSITORY "nlohmann/json"
VERSION "3.11.3"
)

endif()
endif()

if(NOT "${USE_SYSTEM_EIGEN}")
Expand All @@ -88,7 +95,7 @@ if("${eigen3_ADDED}")
endif()

endif()

if (NOT NIX_BUILD)
CPMAddPackage(
NAME gemmi
GITHUB_REPOSITORY project-gemmi/gemmi
Expand Down Expand Up @@ -122,7 +129,7 @@ if("${LBFGSpp_ADDED}")
add_library(LBFGSpp::LBFGSpp INTERFACE IMPORTED GLOBAL)
target_include_directories(LBFGSpp::LBFGSpp INTERFACE "${LBFGSpp_SOURCE_DIR}/include")
endif()

endif()
if("${USE_QCINT}")
set(LIBCINT_REPOSITORY "sunqm/qcint")
else()
Expand All @@ -135,7 +142,7 @@ endif ()

# Add compiler flags to fix the implicit function declaration error
set(LIBCINT_C_FLAGS "-Wno-implicit-function-declaration -Wno-deprecated-non-prototype -D_GNU_SOURCE")

if (NOT NIX_BUILD)
CPMAddPackage(
NAME libcint
GITHUB_REPOSITORY "${LIBCINT_REPOSITORY}"
Expand All @@ -152,15 +159,15 @@ CPMAddPackage(
${LIBCINT_BUILD_TYPE}
VERSION "6.1.2"
)

endif()
# Apply the flags to the target after it's created
if(TARGET cint)
target_compile_options(cint PRIVATE
-Wno-implicit-function-declaration
-Wno-deprecated-non-prototype
)
endif()

if (NOT NIX_BUILD)
add_library(libcint::libcint INTERFACE IMPORTED GLOBAL)
target_link_libraries(libcint::libcint INTERFACE cint)
target_include_directories(
Expand All @@ -169,7 +176,7 @@ target_include_directories(
"${libcint_SOURCE_DIR}/src"
"${libcint_BINARY_DIR}/include"
)

endif()
if(NOT "${USE_SYSTEM_LIBXC}")
CPMAddPackage(
NAME Libxc
Expand All @@ -188,11 +195,10 @@ target_include_directories(
"${Libxc_BINARY_DIR}/src"
"${Libxc_BINARY_DIR}"
)

endif()


if("${WITH_PYTHON_BINDINGS}")
if("${WITH_PYTHON_BINDINGS}" AND NOT NIX_BUILD)
CPMAddPackage(
NAME nanobind
GITHUB_REPOSITORY "wjakob/nanobind"
Expand Down
89 changes: 89 additions & 0 deletions 3rdparty/nix/dftd4.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
stdenv,
lib,
fetchFromGitHub,
buildType ? "cmake",
pkgs,
src,
version,
}:

assert !pkgs.blas.isILP64 && !pkgs.lapack.isILP64;
assert (
builtins.elem buildType [
"meson"
"cmake"
]
);

stdenv.mkDerivation {
pname = "dftd4";
inherit version;
inherit src;

nativeBuildInputs =
with pkgs;
[
gfortran
pkg-config
python3
]
++ lib.optionals (buildType == "meson") [
meson
ninja
]
++ lib.optional (buildType == "cmake") cmake;

buildInputs = with pkgs; [
blas
lapack
eigen
];

propagatedBuildInputs = with pkgs; [
mctc-lib
mstore
multicharge
];

cmakeFlags = [
(lib.strings.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic))
"-DDFTD4_USE_EIGEN=ON"
"-DBUILD_SHARED_LIBS=OFF"
];

doCheck = true;

postPatch = ''
patchShebangs --build \
config/install-mod.py \
app/tester.py
'';

preCheck = ''
export OMP_NUM_THREADS=2
'';
postInstall = ''
TARGET_DIR="$out/lib/cmake/dftd4"
mkdir -p "$TARGET_DIR"

cat > "$TARGET_DIR/dftd4Config.cmake" <<EOF
include("\''${CMAKE_CURRENT_LIST_DIR}/dftd4Targets.cmake")

set_target_properties(dftd4::dftd4 PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "\''${CMAKE_CURRENT_LIST_DIR}/../../../include/dftd4"
)
EOF
'';
meta = {
description = "Generally Applicable Atomic-Charge Dependent London Dispersion Correction";
mainProgram = "dftd4";
license = with lib.licenses; [
lgpl3Plus
gpl3Plus
];
homepage = "https://github.com/grimme-lab/dftd4";
platforms = lib.platforms.linux;
maintainers = [ lib.maintainers.sheepforce ];
};
}
29 changes: 29 additions & 0 deletions 3rdparty/nix/gemmi.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{ pkgs, stdenv, ... }:
stdenv.mkDerivation rec {
pname = "gemmi";
version = "0.6.5";
src = pkgs.fetchFromGitHub {
owner = "project-gemmi";
repo = "gemmi";
tag = "v${version}";
hash = "sha256-JJ6YBsdL3J+d0ihuJ2Nowp40c7FkDdfTqBhDrxWgSFw=";
};
dontBuild = true;
dontConfigure = true;

installPhase = ''
mkdir -p $out/include
cp -r include/* $out/include/
TARGET_DIR="$out/lib/cmake/gemmi"
mkdir -p "$TARGET_DIR"
cat > "$TARGET_DIR/gemmiConfig.cmake" <<EOF
if(NOT TARGET gemmi::gemmi)
add_library(gemmi::gemmi INTERFACE IMPORTED)
endif()

set_target_properties(gemmi::gemmi PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "$out/include"
)
EOF
'';
}
29 changes: 29 additions & 0 deletions 3rdparty/nix/lbfgspp.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
lib,
stdenv,
cmake,
eigen,
version,
src,
}:

stdenv.mkDerivation {
pname = "lbfgspp";
inherit src;
inherit version;
nativeBuildInputs = [ cmake ];

propagatedBuildInputs = [ eigen ];

cmakeFlags = [
"-DCMAKE_INSTALL_INCLUDEDIR=include"
];

meta = with lib; {
description = "A header-only C++ library for L-BFGS and L-BFGS-B algorithms";
homepage = "https://github.com/yixuan/LBFGSpp";
license = licenses.mit;
platforms = platforms.all;
maintainers = [ ];
};
}
66 changes: 66 additions & 0 deletions 3rdparty/nix/libcint.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
stdenv,
lib,
fetchFromGitHub,
cmake,
blas,
python3,
src,
version,
}:

stdenv.mkDerivation rec {
pname = "libcint";
inherit version;
inherit src;

postPatch = ''
sed -i 's/libcint.so/libcint${stdenv.hostPlatform.extensions.sharedLibrary}/g' testsuite/*.py
mkdir -p $out/lib/cmake/libcint
cat > $out/lib/cmake/libcint/libcintConfig.cmake <<EOF
set(Libcint_FOUND TRUE)
# Use placeholder "out" to refer to this package's installation path
set(LIBCINT_INCLUDE_DIRS "${placeholder "out"}/include")
set(LIBCINT_LIBRARIES "${placeholder "out"}/lib/libcint.a")

if(NOT TARGET libcint::libcint)
add_library(libcint::libcint UNKNOWN IMPORTED)
set_target_properties(libcint::libcint PROPERTIES
IMPORTED_LOCATION "\''${LIBCINT_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "\''${LIBCINT_INCLUDE_DIRS}"
)
endif()
'';
nativeBuildInputs = [ cmake ];
buildInputs = [ blas ];
cmakeFlags = [
"-DCMAKE_INSTALL_PREFIX=" # ends up double-adding /nix/store/... prefix, this avoids issue
"-DWITH_FORTRAN=OFF"
"-DWITH_CINT2_INTERFACE=OFF"
"-DENABLE_STATIC=ON"
"-DBUILD_SHARED_LIBS=OFF"
"-DPYPZPX=ON"
"-DBUILD_MARCH_NATIVE=ON"
"-DWITH_RANGE_COULOMB=ON"
];
env.NIX_CFLAGS_COMPILE = "-Wno-implicit-function-declaration -Wno-deprecated-non-prototype -D_GNU_SOURCE";
strictDeps = true;

doCheck = true;
nativeCheckInputs = [ python3.pkgs.numpy ];

meta = {
description = "General GTO integrals for quantum chemistry";
longDescription = ''
libcint is an open source library for analytical Gaussian integrals.
It provides C/Fortran API to evaluate one-electron / two-electron
integrals for Cartesian / real-spheric / spinor Gaussian type functions.
'';
homepage = "http://wiki.sunqm.net/libcint";
downloadPage = "https://github.com/sunqm/libcint";
changelog = "https://github.com/sunqm/libcint/blob/master/ChangeLog";
license = lib.licenses.bsd2;
maintainers = [ ];
platforms = lib.platforms.unix;
};
}
Loading
Loading