summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/boltztrap2/default.nix
blob: a2b1b15bf848c7db590518fcfcba759ad29c1aad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{
  lib,
  buildPythonPackage,
  fetchFromGitLab,
  stdenv,
  spglib,
  numpy,
  scipy,
  matplotlib,
  ase,
  netcdf4,
  cython,
  cmake,
  setuptools,
  setuptools-scm,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "boltztrap2";
  version = "25.3.1";

  pyproject = true;

  build-system = [
    setuptools
    setuptools-scm
  ];

  src = fetchFromGitLab {
    owner = "sousaw";
    repo = "BoltzTraP2";
    tag = "v${version}";
    hash = "sha256-eocstudmgMkuxa94txU8uqIp8HpNEuWQys7WvRRZ4as=";
  };

  postPatch = ''
    substituteInPlace external/spglib-1.9.9/CMakeLists.txt \
      --replace-fail "cmake_minimum_required(VERSION 2.4)" "cmake_minimum_required(VERSION 3.10)"
    substituteInPlace pyproject.toml \
      --replace-fail "numpy>=2.0.0" "numpy"
  '';

  dontUseCmakeConfigure = true;

  nativeBuildInputs = [
    cmake
    cython
  ];

  dependencies = [
    spglib
    numpy
    scipy
    matplotlib
    ase
    netcdf4
  ];

  pythonImportsCheck = [ "BoltzTraP2" ];

  nativeCheckInputs = [ pytestCheckHook ];

  preInstallCheck = ''
    tar xf data.tar.xz
    rm -rf BoltzTraP2
  '';

  pytestFlags = [ "tests" ];

  disabledTests = lib.optionals (stdenv.system != "x86_64-linux") [
    # Tests np.load numpy arrays from disk that were, apparently, saved on
    # x86_64-linux. Then these files are used to compare results of
    # calculations, which won't work as expected if running on a different
    # platform.
    "test_DOS_Si"
    "test_BTPDOS_Si"
    "test_calc_cv_Si"
    "test_fermiintegrals_Si"
    "test_fitde3D_saved_noder"
  ];

  meta = {
    description = "Band-structure interpolator and transport coefficient calculator";
    mainProgram = "btp2";
    homepage = "http://www.boltztrap.org/";
    license = lib.licenses.gpl3Plus;
    maintainers = [ ];
  };
}