nixpkgs/pkgs/development/python-modules/geometric/ase-is-optional.patch
2022-11-14 09:21:02 +01:00

51 lines
1.6 KiB
Diff

From aff6e4411980ac9cbe112a050c3a34ba7e305a43 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20Di=20Remigio=20Eik=C3=A5s?=
<robertodr@users.noreply.github.com>
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"
)