summary refs log tree commit diff
diff options
context:
space:
mode:
authorsheepforce <phillip.seeber@googlemail.com>2022-12-02 21:01:40 +0100
committersheepforce <phillip.seeber@googlemail.com>2022-12-02 21:01:40 +0100
commite8e5cba9414caea6f6b4626f2b47829d8ad85a6b (patch)
tree74e6336d4531424f290bf58d173a5c96b3e7da6c
parentfaf429bd5fca7c14d66bd2329841c8278579da23 (diff)
downloadnixpkgs-e8e5cba9414caea6f6b4626f2b47829d8ad85a6b.tar
nixpkgs-e8e5cba9414caea6f6b4626f2b47829d8ad85a6b.tar.gz
nixpkgs-e8e5cba9414caea6f6b4626f2b47829d8ad85a6b.tar.bz2
nixpkgs-e8e5cba9414caea6f6b4626f2b47829d8ad85a6b.tar.lz
nixpkgs-e8e5cba9414caea6f6b4626f2b47829d8ad85a6b.tar.xz
nixpkgs-e8e5cba9414caea6f6b4626f2b47829d8ad85a6b.tar.zst
nixpkgs-e8e5cba9414caea6f6b4626f2b47829d8ad85a6b.zip
libint: 2.7.1 -> 2.7.2 & exposed config options
libint: more conservative optimisation settings


libint: fix integral angular momentum


remove leftover log file


libint: more options


libint: more options


libint: more options


libint: more fixes


libint: more fixes


libint: more fixes


libint: more fixes


libint: more fixes


libint: more configuration options


libint: psi4-compatible alias


libint: 2.7.1 -> 2.7.2 + expose build options


libint: fix formatting


libint; change psi4 settings


libint: adapt psi4 settings


libint: fix typo


libint: fix compilation


libint: disable SSE for Psi4


libint: review changes

-rw-r--r--pkgs/development/libraries/libint/default.nix169
-rw-r--r--pkgs/top-level/all-packages.nix22
2 files changed, 164 insertions, 27 deletions
diff --git a/pkgs/development/libraries/libint/default.nix b/pkgs/development/libraries/libint/default.nix
index dd5b26244a9..2fbe553c39d 100644
--- a/pkgs/development/libraries/libint/default.nix
+++ b/pkgs/development/libraries/libint/default.nix
@@ -1,12 +1,115 @@
-{ lib, stdenv, fetchFromGitHub, autoconf, automake, libtool
-, python3, perl, gmpxx, mpfr, boost, eigen, gfortran, cmake
+{ lib
+, stdenv
+, fetchFromGitHub
+, autoconf
+, automake
+, libtool
+, python3
+, perl
+, gmpxx
+, mpfr
+, boost
+, eigen
+, gfortran
+, cmake
 , enableFMA ? stdenv.hostPlatform.fmaSupport
 , enableFortran ? true
+, enableSSE ? (!enableFortran) && stdenv.hostPlatform.isx86_64
+
+  # Maximum angular momentum of basis functions
+  # 7 is required for def2/J auxiliary basis on 3d metals upwards
+, maxAm ? 7
+
+  # ERI derivative order for 4-, 3- and 2-centre ERIs.
+  # 2nd derivatives are defaults and allow gradients Hessians with density fitting
+  # Setting them to zero disables derivatives.
+, eriDeriv ? 2
+, eri3Deriv ? 2
+, eri2Deriv ? 2
+
+  # Angular momentum for derivatives of ERIs. Takes a list of length $DERIV_ORD+1.
+  # Starting from index 0, each index i specifies the supported angular momentum
+  # for the derivative order i, e.g. [6,5,4] supports ERIs for l=6, their first
+  # derivatives for l=5 and their second derivatives for l=4.
+, eriAm ? (builtins.genList (i: maxAm - 1 - i) (eriDeriv + 1))
+, eri3Am ? (builtins.genList (i: maxAm - i) (eri2Deriv + 1))
+, eri2Am ? (builtins.genList (i: maxAm - i) (eri2Deriv + 1))
+
+  # Same as above for optimised code. Higher optimisations take a long time.
+, eriOptAm ? (builtins.genList (i: maxAm - 3 - i) (eriDeriv + 1))
+, eri3OptAm ? (builtins.genList (i: maxAm - 3 - i) (eri2Deriv + 1))
+, eri2OptAm ? (builtins.genList (i: maxAm - 3 - i) (eri2Deriv + 1))
+
+  # One-Electron integrals of all kinds including multipole integrals.
+  # Libint does not build them and their derivatives by default.
+, enableOneBody ? false
+, oneBodyDerivOrd ? 2
+, multipoleOrd ? 4 # Maximum order of multipole integrals, 4=octopoles
+
+  # Whether to enable generic code if angular momentum is unsupported
+, enableGeneric ? true
+
+  # Support integrals over contracted Gaussian
+, enableContracted ? true
+
+  # Spherical harmonics/Cartesian orbital conventions
+, cartGaussOrd ? "standard" # Ordering of Cartesian basis functions, "standard" is CCA
+, shGaussOrd ? "standard" # Ordering of spherical harmonic basis functions. "standard" is -l to +l, "guassian" is 0, 1, -1, 2, -2, ...
+, shellSet ? "standard"
+, eri3PureSh ? false # Transformation of 3-centre ERIs into spherical harmonics
+, eri2PureSh ? false # Transformation of 2-centre ERIs into spherical harmonics
 }:
 
+# Check that Fortran bindings are not used together with SIMD real type
+assert (if enableFortran then !enableSSE else true);
+
+# Check that a possible angular momentum for basis functions is used
+assert (maxAm >= 1 && maxAm <= 8);
+
+# Check for valid derivative order in ERIs
+assert (eriDeriv >= 0 && eriDeriv <= 4);
+assert (eri2Deriv >= 0 && eri2Deriv <= 4);
+assert (eri3Deriv >= 0 && eri3Deriv <= 4);
+
+# Ensure valid arguments for generated angular momenta in ERI derivatives are used.
+assert (
+  builtins.length eriAm == eriDeriv + 1 &&
+  builtins.foldl' (a: b: a && b) true (builtins.map (a: a <= maxAm && a >= 0) eriAm)
+);
+assert (
+  builtins.length eri3Am == eriDeriv + 1 &&
+  builtins.foldl' (a: b: a && b) true (builtins.map (a: a <= maxAm && a >= 0) eri3Am)
+);
+assert (
+  builtins.length eri2Am == eriDeriv + 1 &&
+  builtins.foldl' (a: b: a && b) true (builtins.map (a: a <= maxAm && a >= 0) eri2Am)
+);
+
+# Ensure valid arguments for generated angular momenta in optimised ERI derivatives are used.
+assert (
+  builtins.length eriOptAm == eriDeriv + 1 &&
+  builtins.foldl' (a: b: a && b) true (builtins.map (a: a <= maxAm && a >= 0) eriOptAm)
+);
+assert (
+  builtins.length eri3OptAm == eriDeriv + 1 &&
+  builtins.foldl' (a: b: a && b) true (builtins.map (a: a <= maxAm && a >= 0) eri3OptAm)
+);
+assert (
+  builtins.length eri2OptAm == eriDeriv + 1 &&
+  builtins.foldl' (a: b: a && b) true (builtins.map (a: a <= maxAm && a >= 0) eri2OptAm)
+);
+
+# Ensure a valid derivative order for one-electron integrals
+assert (oneBodyDerivOrd >= 0 && oneBodyDerivOrd <= 4);
+
+# Check that valid basis shell orders are used, see https://github.com/evaleev/libint/wiki
+assert (builtins.elem cartGaussOrd [ "standard" "intv3" "gamess" "orca" "bagel" ]);
+assert (builtins.elem shGaussOrd [ "standard" "gaussian" ]);
+assert (builtins.elem shellSet [ "standard" "orca" ]);
+
 let
   pname = "libint";
-  version = "2.7.1";
+  version = "2.7.2";
 
   meta = with lib; {
     description = "Library for the evaluation of molecular integrals of many-body operators over Gaussian functions";
@@ -23,7 +126,7 @@ let
       owner = "evaleev";
       repo = pname;
       rev = "v${version}";
-      sha256 = "5nSeyT1DhFsA76Dt3dqYfhfBYD+iTl34O3lVeH6+OVw=";
+      hash = "sha256-lX+DVnhdOb8d7MX9umf33y88CNiGb3TYYlMZtQXfx+8=";
     };
 
     # Replace hardcoded "/bin/rm" with normal "rm"
@@ -52,23 +155,36 @@ let
 
     buildInputs = [ boost eigen ];
 
-    preConfigure = "./autogen.sh";
-
-    configureFlags = [
-      "--enable-eri=2"
-      "--enable-eri3=2"
-      "--enable-eri2=2"
-      "--with-eri-max-am=7,5,4"
-      "--with-eri-opt-am=3"
-      "--with-eri3-max-am=7"
-      "--with-eri2-max-am=7"
-      "--with-g12-max-am=5"
-      "--with-g12-opt-am=3"
-      "--with-g12dkh-max-am=5"
-      "--with-g12dkh-opt-am=3"
-      "--enable-contracted-ints"
-      "--enable-shared"
-    ] ++ lib.optional enableFMA "--enable-fma";
+    configureFlags = with lib; [
+      "--with-max-am=${builtins.toString maxAm}"
+      "--with-eri-max-am=${concatStringsSep "," (builtins.map builtins.toString eriAm)}"
+      "--with-eri3-max-am=${concatStringsSep "," (builtins.map builtins.toString eri3Am)}"
+      "--with-eri2-max-am=${concatStringsSep "," (builtins.map builtins.toString eri2Am)}"
+      "--with-eri-opt-am=${concatStringsSep "," (builtins.map builtins.toString eriOptAm)}"
+      "--with-eri3-opt-am=${concatStringsSep "," (builtins.map builtins.toString eri3OptAm)}"
+      "--with-eri2-opt-am=${concatStringsSep "," (builtins.map builtins.toString eri2OptAm)}"
+      "--with-cartgauss-ordering=${cartGaussOrd}"
+      "--with-shgauss-ordering=${shGaussOrd}"
+      "--with-shell-set=${shellSet}"
+    ]
+    ++ optional enableFMA "--enable-fma"
+    ++ optional (eriDeriv > 0) "--enable-eri=${builtins.toString eriDeriv}"
+    ++ optional (eri2Deriv > 0) "--enable-eri2=${builtins.toString eri2Deriv}"
+    ++ optional (eri3Deriv > 0) "--enable-eri3=${builtins.toString eri3Deriv}"
+    ++ lists.optionals enableOneBody [
+      "--enable-1body=${builtins.toString oneBodyDerivOrd}"
+      "--enable-1body-property-derivs"
+    ]
+    ++ optional (multipoleOrd > 0) "--with-multipole-max-order=${builtins.toString multipoleOrd}"
+    ++ optional enableGeneric "--enable-generic"
+    ++ optional enableContracted "--enable-contracted-ints"
+    ++ optional eri3PureSh "--enable-eri3-pure-sh"
+    ++ optional eri2PureSh "--enable-eri2-pure-sh"
+    ;
+
+    preConfigure = ''
+      ./autogen.sh
+    '';
 
     makeFlags = [ "export" ];
 
@@ -98,11 +214,9 @@ let
     # AVX support is advertised, but does not work in 2.6 (possibly in 2.7).
     # Fortran interface is incompatible with changing the LIBINT2_REALTYPE.
     cmakeFlags = [
-      (if enableFortran
-        then "-DENABLE_FORTRAN=ON"
-        else "-DLIBINT2_REALTYPE=libint2::simd::VectorSSEDouble"
-      )
-    ];
+      "-DLIBINT2_SHGAUSS_ORDERING=${shGaussOrd}"
+    ] ++ lib.optional enableFortran "-DENABLE_FORTRAN=ON"
+    ++ lib.optional enableSSE "-DLIBINT2_REALTYPE=libint2::simd::VectorSSEDouble";
 
     # Can only build in the source-tree. A lot of preprocessing magic fails otherwise.
     dontUseCmakeBuildDir = true;
@@ -110,4 +224,5 @@ let
     inherit meta;
   };
 
-in codeComp
+in
+codeComp
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index c421dcbbc9d..09be79b8e80 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -9075,6 +9075,28 @@ with pkgs;
   libinsane = callPackage ../development/libraries/libinsane { };
 
   libint = callPackage ../development/libraries/libint {};
+  libintPsi4 = callPackage ../development/libraries/libint {
+    enableFortran = false;
+    enableSSE = false;
+    maxAm = 6;
+    eriDeriv = 2;
+    eri3Deriv = 2;
+    eri2Deriv = 2;
+    eriAm = [ 6 5 4 ];
+    eri3Am = [ 6 5 4 ];
+    eri2Am = [ 6 5 4 ];
+    eriOptAm = [ 3 2 2 ];
+    eri3OptAm = [ 3 2 2 ];
+    eri2OptAm = [ 3 2 2 ];
+    enableOneBody = true;
+    oneBodyDerivOrd = 2;
+    enableGeneric = false;
+    enableContracted = false;
+    cartGaussOrd = "standard";
+    shGaussOrd = "gaussian";
+    eri2PureSh = false;
+    eri3PureSh = false;
+  };
 
   libipfix = callPackage ../development/libraries/libipfix { };