diff --git a/pkgs/development/python-modules/geometric/ase-is-optional.patch b/pkgs/development/python-modules/geometric/ase-is-optional.patch new file mode 100644 index 000000000000..911867c35457 --- /dev/null +++ b/pkgs/development/python-modules/geometric/ase-is-optional.patch @@ -0,0 +1,50 @@ +From aff6e4411980ac9cbe112a050c3a34ba7e305a43 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Roberto=20Di=20Remigio=20Eik=C3=A5s?= + +Date: Fri, 11 Nov 2022 09:20:25 +0100 +Subject: [PATCH] Do not import ASE stuff at the top + +Since it is an optional add-on and it's not listed in the installation requirements. +--- + geometric/tests/test_ase_engine.py | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/geometric/tests/test_ase_engine.py b/geometric/tests/test_ase_engine.py +index 8750763..34239b5 100644 +--- a/geometric/tests/test_ase_engine.py ++++ b/geometric/tests/test_ase_engine.py +@@ -10,7 +10,6 @@ + - geometry optimisation w/ ASE internal calc + """ + import numpy as np +-from ase.calculators.lj import LennardJones + from pytest import fixture, raises + + from geometric.ase_engine import EngineASE +@@ -37,6 +36,8 @@ def molecule_h2o() -> Molecule: + + @using_ase + def test_construction(molecule_h2o): ++ from ase.calculators.lj import LennardJones ++ + lj_calc = LennardJones() + engine = EngineASE(molecule_h2o, lj_calc) + assert engine.calculator == lj_calc +@@ -44,6 +45,8 @@ def test_construction(molecule_h2o): + + @using_ase + def test_from_args(molecule_h2o): ++ from ase.calculators.lj import LennardJones ++ + lj_calc = LennardJones(sigma=1.4, epsilon=3.0) + + # create equivalent engines in two ways +@@ -68,6 +71,8 @@ def test_from_args(molecule_h2o): + + @using_ase + def test_from_string(molecule_h2o): ++ from ase.calculators.lj import LennardJones ++ + engine = EngineASE.from_calculator_string( + molecule_h2o, calculator_import="ase.calculators.lj.LennardJones" + ) diff --git a/pkgs/development/python-modules/geometric/default.nix b/pkgs/development/python-modules/geometric/default.nix index 89f1e73ed9af..775ace5f6b2c 100644 --- a/pkgs/development/python-modules/geometric/default.nix +++ b/pkgs/development/python-modules/geometric/default.nix @@ -1,19 +1,28 @@ -{ buildPythonPackage, lib, fetchFromGitHub -, networkx, numpy, scipy, six +{ buildPythonPackage +, lib +, fetchFromGitHub +, networkx +, numpy +, scipy +, six , pytestCheckHook }: buildPythonPackage rec { pname = "geometric"; - version = "0.9.7.2"; + version = "1.0"; src = fetchFromGitHub { owner = "leeping"; repo = "geomeTRIC"; rev = version; - hash = "sha256-QFpfY6tWqcda6AJT17YBEuwu/4DYPbIMJU1c9/gHjaA="; + hash = "sha256-y8dh4vZ/d1KL1EpDrle8CH/KIDMCKKZdAyJVgUFjx/o="; }; + patches = [ + ./ase-is-optional.patch + ]; + propagatedBuildInputs = [ networkx numpy @@ -21,6 +30,10 @@ buildPythonPackage rec { six ]; + preCheck = '' + export OMP_NUM_THREADS=2 + ''; + checkInputs = [ pytestCheckHook ]; meta = with lib; {