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