77 gfortran ,
88 perl ,
99 blas-ilp64 ,
10+ lapack-ilp64 ,
1011 hdf5-cpp ,
1112 python3 ,
1213 texliveMinimal ,
1617 gsl ,
1718 boost ,
1819 autoPatchelfHook ,
19- enableQcmaquis ? false ,
20+ enableQcmaquis ? true ,
2021 # Note that the CASPT2 module is broken with MPI
2122 # See https://gitlab.com/Molcas/OpenMolcas/-/issues/169
2223 enableMpi ? false ,
2526} :
2627
2728assert blas-ilp64 . isILP64 ;
28- assert lib . elem blas-ilp64 . passthru . implementation [
29- "openblas"
30- "mkl"
31- ] ;
32- assert enableQcmaquis -> lib . elem blas-ilp64 . passthru . implementation "mkl" ;
29+ assert lapack-ilp64 . isILP64 ;
3330
3431let
3532 python = python3 . withPackages (
4643 rev = "release-3.1.4" ; # Must match tag in cmake/custom/qcmaquis.cmake
4744 hash = "sha256-vhC5k+91IPFxdCi5oYt1NtF9W08RxonJjPpA0ls4I+o=" ;
4845 } ;
49- nevtp2Src = fetchFromGitHub {
50- owner = "qcscine" ;
51- repo = "nevpt2" ;
52- rev = "e1484fd" ; # Must match tag in cmake/custom/nevpt2.cmake
53- hash = "sha256-Vl+FhwhJBbD/7U2CwsYE9BClSQYLJ8DKXV9EXxQUmz0=" ;
46+
47+ # NEVPT2 sources must be patched to be valid C code in gctime.c
48+ nevpt2Src = stdenv . mkDerivation {
49+ pname = "nevpt2-src" ;
50+ version = "unstable" ;
51+ phases = [
52+ "unpackPhase"
53+ "patchPhase"
54+ "installPhase"
55+ ] ;
56+ src = fetchFromGitHub {
57+ owner = "qcscine" ;
58+ repo = "nevpt2" ;
59+ rev = "e1484fd" ; # Must match tag in cmake/custom/nevpt2.cmake
60+ hash = "sha256-Vl+FhwhJBbD/7U2CwsYE9BClSQYLJ8DKXV9EXxQUmz0=" ;
61+ } ;
62+ patches = [ ./nevpt2.patch ] ;
63+ installPhase = ''
64+ mkdir $out
65+ cp -r * $out/.
66+ '' ;
5467 } ;
5568
5669in
@@ -66,10 +79,7 @@ stdenv.mkDerivation rec {
6679 } ;
6780
6881 patches = [
69- # Required to handle openblas multiple outputs
70- ./openblasPath.patch
71-
72- # Required for a local QCMaquis build
82+ # Required for a local QCMaquis build. Also sanitises QCMaquis BLAS/LAPACK handling
7383 ./qcmaquis.patch
7484 ] ;
7585
@@ -83,7 +93,7 @@ stdenv.mkDerivation rec {
8393 --subst-var-by "qcmaquis_src_url" "file://${ qcmaquisSrc } "
8494
8595 substituteInPlace cmake/custom/nevpt2.cmake \
86- --subst-var-by "nevpt2_src_url" "file://${ nevtp2Src } "
96+ --subst-var-by "nevpt2_src_url" "file://${ nevpt2Src } "
8797 '' ;
8898
8999 nativeBuildInputs = [
@@ -97,13 +107,14 @@ stdenv.mkDerivation rec {
97107
98108 buildInputs =
99109 [
100- blas-ilp64 . passthru . provider
101110 hdf5-cpp
102111 python
103112 armadillo
104113 libxc
105114 gsl . dev
106115 boost
116+ blas-ilp64
117+ lapack-ilp64
107118 ]
108119 ++ lib . optionals enableMpi [
109120 mpi
@@ -112,38 +123,31 @@ stdenv.mkDerivation rec {
112123
113124 passthru = lib . optionalAttrs enableMpi { inherit mpi ; } ;
114125
115- cmakeFlags =
116- [
117- "-DOPENMP=ON"
118- "-DTOOLS=ON"
119- "-DHDF5=ON"
120- "-DFDE=ON"
121- "-DEXTERNAL_LIBXC=${ lib . getDev libxc } "
122- ( lib . strings . cmakeBool "DMRG" enableQcmaquis )
123- ( lib . strings . cmakeBool "NEVPT2" enableQcmaquis )
124- "-DCMAKE_SKIP_BUILD_RPATH=ON"
125- ( lib . strings . cmakeBool "BUILD_STATIC_LIBS" stdenv . hostPlatform . isStatic )
126- ( lib . strings . cmakeBool "BUILD_SHARED_LIBS" ( ! stdenv . hostPlatform . isStatic ) )
127- ]
128- ++ lib . optionals ( blas-ilp64 . passthru . implementation == "openblas" ) [
129- "-DOPENBLASROOT=${ blas-ilp64 . passthru . provider . dev } "
130- "-DLINALG=OpenBLAS"
131- ]
132- ++ lib . optionals ( blas-ilp64 . passthru . implementation == "mkl" ) [
133- "-DMKLROOT=${ blas-ilp64 . passthru . provider } "
134- "-DLINALG=MKL"
135- ]
136- ++ lib . optionals enableMpi [
137- "-DGA=ON"
138- "-DMPI=ON"
139- ] ;
140-
141- preConfigure = lib . optionalString enableMpi ''
142- export GAROOT=${ globalarrays } ;
143- '' ;
144-
126+ preConfigure =
127+ ''
128+ cmakeFlagsArray+=(
129+ "-DOPENMP=ON"
130+ "-DTOOLS=ON"
131+ "-DHDF5=ON"
132+ "-DFDE=ON"
133+ "-DEXTERNAL_LIBXC=${ lib . getDev libxc } "
134+ ${ lib . strings . cmakeBool "DMRG" enableQcmaquis }
135+ ${ lib . strings . cmakeBool "NEVPT2" enableQcmaquis }
136+ "-DCMAKE_SKIP_BUILD_RPATH=ON"
137+ ${ lib . strings . cmakeBool "BUILD_STATIC_LIBS" stdenv . hostPlatform . isStatic }
138+ ${ lib . strings . cmakeBool "BUILD_SHARED_LIBS" ( ! stdenv . hostPlatform . isStatic ) }
139+ "-DLINALG=Manual"
140+ "-DLINALG_LIBRARIES=-lblas -llapack"
141+ ${ lib . strings . cmakeBool "DGA" enableMpi }
142+ ${ lib . strings . cmakeBool "MPI" enableMpi }
143+ )
144+ ''
145+ + lib . optionalString enableMpi ''
146+ export GAROOT=${ globalarrays } ;
147+ '' ;
148+
149+ # The Makefile will install pymolcas during the build grrr.
145150 postConfigure = ''
146- # The Makefile will install pymolcas during the build grrr.
147151 mkdir -p $out/bin
148152 export PATH=$PATH:$out/bin
149153 '' ;
@@ -158,8 +162,8 @@ stdenv.mkDerivation rec {
158162 # removed by autopatchelf
159163 noAuditTmpdir = true ;
160164
165+ # Wrong store path in shebang (bare Python, no Python pkgs), force manual re-patching
161166 postFixup = ''
162- # Wrong store path in shebang (bare Python, no Python pkgs), force manual re-patching
163167 for exe in $(find $out/bin/ -type f -name "*.py"); do
164168 sed -i "1s:.*:#!${ python } /bin/python:" "$exe"
165169 done
0 commit comments