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