at 24.11-pre 3.2 kB view raw
1{ 2 buildPythonPackage, 3 lib, 4 fetchFromGitLab, 5 writeTextFile, 6 fetchurl, 7 blas, 8 lapack, 9 mpi, 10 fftw, 11 scalapack, 12 libxc, 13 libvdwxc, 14 which, 15 ase, 16 numpy, 17 scipy, 18 pyyaml, 19 inetutils, 20}: 21 22assert lib.asserts.assertMsg (!blas.isILP64) "A 32 bit integer implementation of BLAS is required."; 23 24assert lib.asserts.assertMsg ( 25 !lapack.isILP64 26) "A 32 bit integer implementation of LAPACK is required."; 27 28let 29 gpawConfig = writeTextFile { 30 name = "siteconfig.py"; 31 text = '' 32 # Compiler 33 compiler = 'gcc' 34 mpicompiler = '${lib.getDev mpi}/bin/mpicc' 35 mpilinker = '${lib.getDev mpi}/bin/mpicc' 36 37 # BLAS 38 libraries += ['blas'] 39 library_dirs += ['${blas}/lib'] 40 41 # FFTW 42 fftw = True 43 if fftw: 44 libraries += ['fftw3'] 45 46 scalapack = True 47 if scalapack: 48 libraries += ['scalapack'] 49 50 # LibXC 51 libxc = True 52 if libxc: 53 xc = '${libxc}/' 54 include_dirs += [xc + 'include'] 55 library_dirs += [xc + 'lib/'] 56 extra_link_args += ['-Wl,-rpath={xc}/lib'.format(xc=xc)] 57 if 'xc' not in libraries: 58 libraries.append('xc') 59 60 # LibVDWXC 61 libvdwxc = True 62 if libvdwxc: 63 vdwxc = '${libvdwxc}/' 64 extra_link_args += ['-Wl,-rpath=%s/lib' % vdwxc] 65 library_dirs += ['%s/lib' % vdwxc] 66 include_dirs += ['%s/include' % vdwxc] 67 libraries += ['vdwxc'] 68 ''; 69 }; 70 71 setupVersion = "0.9.20000"; 72 pawDataSets = fetchurl { 73 url = "https://wiki.fysik.dtu.dk/gpaw-files/gpaw-setups-${setupVersion}.tar.gz"; 74 sha256 = "07yldxnn38gky39fxyv3rfzag9p4lb0xfpzn15wy2h9aw4mnhwbc"; 75 }; 76in 77buildPythonPackage rec { 78 pname = "gpaw"; 79 version = "24.1.0"; 80 format = "setuptools"; 81 82 src = fetchFromGitLab { 83 owner = "gpaw"; 84 repo = pname; 85 rev = version; 86 hash = "sha256-8eX50F124R46dGN2rJS/dDvPeDmEm7XpVyTiOAjMKyI="; 87 }; 88 89 # `inetutils` is required because importing `gpaw`, as part of 90 # pythonImportsCheck, tries to execute its binary, which in turn tries to 91 # execute `rsh` as a side-effect. 92 nativeBuildInputs = [ 93 which 94 inetutils 95 ]; 96 97 buildInputs = [ 98 blas 99 scalapack 100 libxc 101 libvdwxc 102 fftw 103 ]; 104 105 propagatedBuildInputs = [ 106 ase 107 scipy 108 numpy 109 (lib.getBin mpi) 110 pyyaml 111 ]; 112 113 patches = [ ./SetupPath.patch ]; 114 115 postPatch = '' 116 substituteInPlace gpaw/__init__.py \ 117 --subst-var-by gpawSetupPath "$out/share/gpaw/gpaw-setups-${setupVersion}" 118 ''; 119 120 preConfigure = '' 121 unset CC 122 cp ${gpawConfig} siteconfig.py 123 ''; 124 125 postInstall = '' 126 currDir=$(pwd) 127 mkdir -p $out/share/gpaw && cd $out/share/gpaw 128 cp ${pawDataSets} gpaw-setups.tar.gz 129 tar -xvf $out/share/gpaw/gpaw-setups.tar.gz 130 rm gpaw-setups.tar.gz 131 cd $currDir 132 ''; 133 134 doCheck = false; # Requires MPI runtime to work in the sandbox 135 pythonImportsCheck = [ "gpaw" ]; 136 137 passthru = { 138 inherit mpi; 139 }; 140 141 meta = with lib; { 142 description = "Density functional theory and beyond within the projector-augmented wave method"; 143 homepage = "https://wiki.fysik.dtu.dk/gpaw/index.html"; 144 license = licenses.gpl3Only; 145 platforms = platforms.unix; 146 maintainers = [ maintainers.sheepforce ]; 147 }; 148}