-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #188948 from sheepforce/gpaw
gpaw: init at 22.8.0
- Loading branch information
Showing
5 changed files
with
198 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
pkgs/development/libraries/science/chemistry/libvdwxc/default.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ stdenv | ||
, lib | ||
, fetchFromGitLab | ||
, gfortran | ||
, autoreconfHook | ||
, fftwMpi | ||
, mpi | ||
}: | ||
|
||
stdenv.mkDerivation rec { | ||
pname = "libvdwxc"; | ||
# Stable version has non-working MPI detection. | ||
version = "unstable-24.02.2020"; | ||
|
||
src = fetchFromGitLab { | ||
owner = "libvdwxc"; | ||
repo = pname; | ||
rev = "92f4910c6ac88e111db2fb3a518089d0510c53b0"; | ||
sha256 = "1c7pjrvifncbdyngs2bv185imxbcbq64nka8gshhp8n2ns6fids6"; | ||
}; | ||
|
||
nativeBuildInputs = [ autoreconfHook gfortran ]; | ||
|
||
propagatedBuildInputs = [ mpi fftwMpi ]; | ||
|
||
preConfigure = '' | ||
mkdir build && cd build | ||
export PATH=$PATH:${mpi}/bin | ||
configureFlagsArray+=( | ||
--with-mpi=${mpi} | ||
CC=mpicc | ||
FC=mpif90 | ||
MPICC=mpicc | ||
MPIFC=mpif90 | ||
) | ||
''; | ||
|
||
configureScript = "../configure"; | ||
|
||
hardeningDisable = [ "format" ]; | ||
|
||
doCheck = true; | ||
|
||
meta = with lib; { | ||
description = "Portable C library of density functionals with van der Waals interactions for density functional theory"; | ||
license = with licenses; [ lgpl3Plus bsd3 ]; | ||
homepage = "https://libvdwxc.org/"; | ||
platforms = platforms.unix; | ||
maintainers = [ maintainers.sheepforce ]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
diff --git a/gpaw/__init__.py b/gpaw/__init__.py | ||
index b5c029e13..518c16b13 100644 | ||
--- a/gpaw/__init__.py | ||
+++ b/gpaw/__init__.py | ||
@@ -201,12 +201,7 @@ def initialize_data_paths(): | ||
try: | ||
setup_paths[:0] = os.environ['GPAW_SETUP_PATH'].split(os.pathsep) | ||
except KeyError: | ||
- if len(setup_paths) == 0: | ||
- if os.pathsep == ';': | ||
- setup_paths[:] = [r'C:\gpaw-setups'] | ||
- else: | ||
- setup_paths[:] = ['/usr/local/share/gpaw-setups', | ||
- '/usr/share/gpaw-setups'] | ||
+ setup_paths[:0] = ["@gpawSetupPath@"] | ||
|
||
|
||
read_rc_file() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
{ buildPythonPackage | ||
, lib | ||
, fetchFromGitLab | ||
, writeTextFile | ||
, fetchurl | ||
, blas | ||
, lapack | ||
, mpi | ||
, scalapack | ||
, libxc | ||
, libvdwxc | ||
, which | ||
, ase | ||
, numpy | ||
, scipy | ||
}: | ||
|
||
assert lib.asserts.assertMsg (!blas.isILP64) | ||
"A 32 bit integer implementation of BLAS is required."; | ||
|
||
assert lib.asserts.assertMsg (!lapack.isILP64) | ||
"A 32 bit integer implementation of LAPACK is required."; | ||
|
||
let | ||
gpawConfig = writeTextFile { | ||
name = "siteconfig.py"; | ||
text = '' | ||
# Compiler | ||
compiler = 'gcc' | ||
mpicompiler = '${mpi}/bin/mpicc' | ||
mpilinker = '${mpi}/bin/mpicc' | ||
# BLAS | ||
libraries += ['blas'] | ||
library_dirs += ['${blas}/lib'] | ||
# FFTW | ||
fftw = True | ||
if fftw: | ||
libraries += ['fftw3'] | ||
scalapack = True | ||
if scalapack: | ||
libraries += ['scalapack'] | ||
# LibXC | ||
libxc = True | ||
if libxc: | ||
xc = '${libxc}/' | ||
include_dirs += [xc + 'include'] | ||
library_dirs += [xc + 'lib/'] | ||
extra_link_args += ['-Wl,-rpath={xc}/lib'.format(xc=xc)] | ||
if 'xc' not in libraries: | ||
libraries.append('xc') | ||
# LibVDWXC | ||
libvdwxc = True | ||
if libvdwxc: | ||
vdwxc = '${libvdwxc}/' | ||
extra_link_args += ['-Wl,-rpath=%s/lib' % vdwxc] | ||
library_dirs += ['%s/lib' % vdwxc] | ||
include_dirs += ['%s/include' % vdwxc] | ||
libraries += ['vdwxc'] | ||
''; | ||
}; | ||
|
||
setupVersion = "0.9.20000"; | ||
pawDataSets = fetchurl { | ||
url = "https://wiki.fysik.dtu.dk/gpaw-files/gpaw-setups-${setupVersion}.tar.gz"; | ||
sha256 = "07yldxnn38gky39fxyv3rfzag9p4lb0xfpzn15wy2h9aw4mnhwbc"; | ||
}; | ||
|
||
in buildPythonPackage rec { | ||
pname = "gpaw"; | ||
version = "22.8.0"; | ||
|
||
src = fetchFromGitLab { | ||
owner = "gpaw"; | ||
repo = pname; | ||
rev = version; | ||
hash = "sha256-Kgf8yuGua7mcGP+jVVmbE8JCsbrfzewRTRt3ihq9YX4="; | ||
}; | ||
|
||
nativeBuildInputs = [ which ]; | ||
|
||
buildInputs = [ blas scalapack libxc libvdwxc ]; | ||
|
||
propagatedBuildInputs = [ ase scipy numpy mpi ]; | ||
|
||
patches = [ ./SetupPath.patch ]; | ||
|
||
postPatch = '' | ||
substituteInPlace gpaw/__init__.py \ | ||
--subst-var-by gpawSetupPath "$out/share/gpaw/gpaw-setups-${setupVersion}" | ||
''; | ||
|
||
preConfigure = '' | ||
unset CC | ||
cp ${gpawConfig} siteconfig.py | ||
''; | ||
|
||
postInstall = '' | ||
currDir=$(pwd) | ||
mkdir -p $out/share/gpaw && cd $out/share/gpaw | ||
cp ${pawDataSets} gpaw-setups.tar.gz | ||
tar -xvf $out/share/gpaw/gpaw-setups.tar.gz | ||
rm gpaw-setups.tar.gz | ||
cd $currDir | ||
''; | ||
|
||
doCheck = false; # Requires MPI runtime to work in the sandbox | ||
pythonImportsCheckHook = [ "gpaw" ]; | ||
|
||
passthru = { inherit mpi; }; | ||
|
||
meta = with lib; { | ||
description = "Density functional theory and beyond within the projector-augmented wave method"; | ||
homepage = "https://wiki.fysik.dtu.dk/gpaw/index.html"; | ||
license = licenses.gpl3Only; | ||
platforms = platforms.unix; | ||
maintainers = [ maintainers.sheepforce ]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters