2021-06-27 18:06:11 +02:00
|
|
|
{ lib, stdenv, fetchFromGitHub, autoconf, automake, libtool
|
2021-08-13 15:47:17 +02:00
|
|
|
, python3, perl, gmpxx, mpfr, boost, eigen, gfortran, cmake
|
2021-09-03 14:15:37 +02:00
|
|
|
, enableFMA ? stdenv.hostPlatform.fmaSupport
|
|
|
|
, enableFortran ? true
|
2021-06-27 18:06:11 +02:00
|
|
|
}:
|
|
|
|
|
2021-08-13 15:47:17 +02:00
|
|
|
let
|
|
|
|
pname = "libint";
|
2021-06-27 18:06:11 +02:00
|
|
|
version = "2.6.0";
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Library for the evaluation of molecular integrals of many-body operators over Gaussian functions";
|
|
|
|
homepage = "https://github.com/evaleev/libint";
|
|
|
|
license = with licenses; [ lgpl3Only gpl3Only ];
|
2021-08-13 15:47:17 +02:00
|
|
|
maintainers = with maintainers; [ markuskowa sheepforce ];
|
2021-06-29 14:51:55 +02:00
|
|
|
platforms = [ "x86_64-linux" ];
|
2021-06-27 18:06:11 +02:00
|
|
|
};
|
2021-08-13 15:47:17 +02:00
|
|
|
|
|
|
|
codeGen = stdenv.mkDerivation {
|
|
|
|
inherit pname version;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "evaleev";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "0pbc2j928jyffhdp4x5bkw68mqmx610qqhnb223vdzr0n2yj5y19";
|
|
|
|
};
|
|
|
|
|
|
|
|
patches = [ ./fix-paths.patch ];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
autoconf
|
|
|
|
automake
|
|
|
|
libtool
|
|
|
|
mpfr
|
|
|
|
python3
|
|
|
|
perl
|
|
|
|
gmpxx
|
|
|
|
] ++ lib.optional enableFortran gfortran;
|
|
|
|
|
|
|
|
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"
|
|
|
|
++ lib.optional enableFortran "--enable-fortran";
|
|
|
|
|
|
|
|
makeFlags = [ "export" ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
|
|
|
cp ${pname}-${version}.tgz $out/.
|
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
inherit meta;
|
|
|
|
};
|
|
|
|
|
|
|
|
codeComp = stdenv.mkDerivation {
|
|
|
|
inherit pname version;
|
|
|
|
|
|
|
|
src = "${codeGen}/${pname}-${version}.tgz";
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
python3
|
|
|
|
cmake
|
|
|
|
] ++ lib.optional enableFortran gfortran;
|
|
|
|
|
|
|
|
buildInputs = [ boost eigen ];
|
|
|
|
|
|
|
|
# Default is just "double", but SSE2 is available on all x86_64 CPUs.
|
|
|
|
# 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"
|
|
|
|
)
|
|
|
|
];
|
|
|
|
|
|
|
|
# Can only build in the source-tree. A lot of preprocessing magic fails otherwise.
|
|
|
|
dontUseCmakeBuildDir = true;
|
|
|
|
|
|
|
|
inherit meta;
|
|
|
|
};
|
|
|
|
|
|
|
|
in codeComp
|