Compare commits

4 Commits

Author SHA256 Message Date
a684b004d7 Accepting request 1198016 from devel:languages:python:numeric
OBS-URL: https://build.opensuse.org/request/show/1198016
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-ase?expand=0&rev=5
2024-09-02 11:13:57 +00:00
8c24dc3e4b Accepting request 1197865 from home:bnavigator:branches:devel:languages:python:numeric
- Unpin numpy
- Add ase-mr3400-numpy2.patch gl#ase/ase#3400

OBS-URL: https://build.opensuse.org/request/show/1197865
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-ase?expand=0&rev=9
2024-08-31 09:19:11 +00:00
b365038244 Accepting request 1188288 from devel:languages:python:numeric
- Update to 3.23.0:
  * Add FixSubsetCom to fix the center of mass of the specified subset
    of atoms.
  * Add the indices option to ase.Atoms.get_center_of_mass() to compute
    the center of mass of the specified subset of atoms.
  * All saddle-point search and minimum-energy path methods have been
    moved into a new ase.mep module. You should start importing from this
    location; e.g., from ase.mep import NEB, DyNEB.
  * Fix ase.constraints.FixCom.adjust_momenta() to have no center-of-mass
    momentum
  * ase.build.surface.graphene() now takes a thickness argument
  * ase.build.bulk() now assigns initial magnetic moments to BCC Fe, Co,
    and Ni.
  * ase.build.make_supercell() can now control how to order the atoms in
    the supercell via the option order
  * mask() returns the mask of nonzero cell vectors, an array of three
    booleans.
  * reciprocal() now guarantees that cell vectors which are zero correspond
    to reciprocal cell vectors that are also zero. Previously the
    reciprocal cell vectors could have small nonzero values due to floating
    point tolerance.
  * The Cell object now has normal() and normals() which calculate normal
    vectors to one or all pairs of cell vectors. Also added area() and
    areas(), which return the area spanned by one or all pairs of cell
    vectors.
  * New a2b and periodic formats for Formula objects. The abc format has
    been renamed to ab2.
  * IO formats can now be implemented in separate packages and registered
    in ase with the entry point ase.ioformats in the external package
    configuration.

OBS-URL: https://build.opensuse.org/request/show/1188288
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-ase?expand=0&rev=4
2024-07-19 13:26:33 +00:00
e9e74a2480 - Update to 3.23.0:
* Add FixSubsetCom to fix the center of mass of the specified subset
    of atoms.
  * Add the indices option to ase.Atoms.get_center_of_mass() to compute
    the center of mass of the specified subset of atoms.
  * All saddle-point search and minimum-energy path methods have been
    moved into a new ase.mep module. You should start importing from this
    location; e.g., from ase.mep import NEB, DyNEB.
  * Fix ase.constraints.FixCom.adjust_momenta() to have no center-of-mass
    momentum
  * ase.build.surface.graphene() now takes a thickness argument
  * ase.build.bulk() now assigns initial magnetic moments to BCC Fe, Co,
    and Ni.
  * ase.build.make_supercell() can now control how to order the atoms in
    the supercell via the option order
  * mask() returns the mask of nonzero cell vectors, an array of three
    booleans.
  * reciprocal() now guarantees that cell vectors which are zero correspond
    to reciprocal cell vectors that are also zero. Previously the
    reciprocal cell vectors could have small nonzero values due to floating
    point tolerance.
  * The Cell object now has normal() and normals() which calculate normal
    vectors to one or all pairs of cell vectors. Also added area() and
    areas(), which return the area spanned by one or all pairs of cell
    vectors.
  * New a2b and periodic formats for Formula objects. The abc format has
    been renamed to ab2.
  * IO formats can now be implemented in separate packages and registered
    in ase with the entry point ase.ioformats in the external package
    configuration.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-ase?expand=0&rev=7
2024-07-18 03:51:42 +00:00
8 changed files with 313 additions and 120 deletions

View File

@@ -1,26 +0,0 @@
From 5e733253d9e791ed1568076ede93a983f27979f6 Mon Sep 17 00:00:00 2001
From: "Adam J. Jackson" <a.j.jackson@physics.org>
Date: Tue, 30 Nov 2021 09:51:47 +0000
Subject: [PATCH] TST: Vibration slab test should check for movement in ANY
direction
It is possible for a perfectly good eigenvector to be zero in some
Cartesian direction; this was encountered in #976 and appears to be
architecture-dependent.
---
ase/test/vibrations/test_vib.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ase/test/vibrations/test_vib.py b/ase/test/vibrations/test_vib.py
index fe28ff13e5..7786a47aec 100644
--- a/ase/test/vibrations/test_vib.py
+++ b/ase/test/vibrations/test_vib.py
@@ -524,4 +524,4 @@ class TestSlab:
assert_array_almost_equal(vibs.get_mode(i)[0], [0., 0., 0.])
# The N atoms should have finite displacement
- assert np.all(vibs.get_mode(i)[-2:, :])
+ assert np.all(np.any(vibs.get_mode(i)[-2:, :], axis=1))
--
GitLab

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:004df6b0ea04b1114c790fadfe45d4125eb0e53125c66a93425af853d82ab432
size 2807134

3
ase-3.23.0.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:91a2aa31d89bd90b0efdfe4a7e84264f32828b2abfc9f38e65e041ad76fec8ae
size 2336462

222
ase-mr3400-numpy2.patch Normal file
View File

@@ -0,0 +1,222 @@
From 06c59143e7fdf15483491cf71800afba8b862bda Mon Sep 17 00:00:00 2001
From: yuzie007 <yuji.ikeda.ac.jp@gmail.com>
Date: Thu, 20 Jun 2024 17:44:31 +0200
Subject: [PATCH 1/7] Use `np.exceptions.ComplexWarning`
---
ase/test/vibrations/test_vib.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Index: ase-3.23.0/ase/test/vibrations/test_vib.py
===================================================================
--- ase-3.23.0.orig/ase/test/vibrations/test_vib.py
+++ ase-3.23.0/ase/test/vibrations/test_vib.py
@@ -6,6 +6,10 @@ import numpy as np
import pytest
from numpy.testing import (assert_array_almost_equal,
assert_array_equal)
+try:
+ from numpy.exceptions import ComplexWarning # NumPy 2.0.0
+except ImportError:
+ from numpy import ComplexWarning
import ase.io
from ase import Atoms, units
@@ -438,14 +442,14 @@ def test_constrained_atoms(n2_data):
def test_dos(n2_vibdata):
- with pytest.warns(np.ComplexWarning):
+ with pytest.warns(ComplexWarning):
dos = n2_vibdata.get_dos()
assert_array_almost_equal(dos.get_energies(),
n2_vibdata.get_energies())
def test_pdos(n2_vibdata):
- with pytest.warns(np.ComplexWarning):
+ with pytest.warns(ComplexWarning):
pdos = n2_vibdata.get_pdos()
assert_array_almost_equal(pdos[0].get_energies(),
n2_vibdata.get_energies())
Index: ase-3.23.0/ase/constraints.py
===================================================================
--- ase-3.23.0.orig/ase/constraints.py
+++ ase-3.23.0/ase/constraints.py
@@ -1161,19 +1161,19 @@ class FixInternals(FixConstraint):
# Projection
hh = []
for i, constraint in enumerate(self.constraints):
- hh.append(aa[:, i] * np.row_stack(aa[:, i]))
+ hh.append(aa[:, i] * np.vstack(aa[:, i]))
- txx = aa[:, self.n] * np.row_stack(aa[:, self.n])
- tyy = aa[:, self.n + 1] * np.row_stack(aa[:, self.n + 1])
- tzz = aa[:, self.n + 2] * np.row_stack(aa[:, self.n + 2])
- rxx = aa[:, self.n + 3] * np.row_stack(aa[:, self.n + 3])
- ryy = aa[:, self.n + 4] * np.row_stack(aa[:, self.n + 4])
- rzz = aa[:, self.n + 5] * np.row_stack(aa[:, self.n + 5])
+ txx = aa[:, self.n] * np.vstack(aa[:, self.n])
+ tyy = aa[:, self.n + 1] * np.vstack(aa[:, self.n + 1])
+ tzz = aa[:, self.n + 2] * np.vstack(aa[:, self.n + 2])
+ rxx = aa[:, self.n + 3] * np.vstack(aa[:, self.n + 3])
+ ryy = aa[:, self.n + 4] * np.vstack(aa[:, self.n + 4])
+ rzz = aa[:, self.n + 5] * np.vstack(aa[:, self.n + 5])
T = txx + tyy + tzz + rxx + ryy + rzz
for vec in hh:
T += vec
- ff = np.dot(T, np.row_stack(ff))
- forces[:, :] -= np.dot(T, np.row_stack(ff)).reshape(-1, 3)
+ ff = np.dot(T, np.vstack(ff))
+ forces[:, :] -= np.dot(T, np.vstack(ff)).reshape(-1, 3)
def __repr__(self):
constraints = [repr(constr) for constr in self.constraints]
Index: ase-3.23.0/ase/mep/autoneb.py
===================================================================
--- ase-3.23.0.orig/ase/mep/autoneb.py
+++ ase-3.23.0/ase/mep/autoneb.py
@@ -544,7 +544,7 @@ class AutoNEB:
try:
energies.append(a.get_potential_energy())
except RuntimeError:
- energies.append(np.NaN)
+ energies.append(np.nan)
return energies
def get_energies_one_image(self, image):
@@ -553,7 +553,7 @@ class AutoNEB:
try:
energy = image.get_potential_energy()
except RuntimeError:
- energy = np.NaN
+ energy = np.nan
return energy
def get_highest_energy_index(self):
Index: ase-3.23.0/ase/dft/__init__.py
===================================================================
--- ase-3.23.0.orig/ase/dft/__init__.py
+++ ase-3.23.0/ase/dft/__init__.py
@@ -1,4 +1,8 @@
import numpy as np
+try:
+ from numpy import trapezoid # NumPy 2.0.0
+except ImportError:
+ from numpy import trapz as trapezoid
from ase.dft.dos import DOS
from ase.dft.kpoints import monkhorst_pack
@@ -19,9 +23,9 @@ def get_distribution_moment(x, y, order=
y = np.asarray(y)
if order == 0:
- return np.trapz(y, x)
+ return trapezoid(y, x)
elif isinstance(order, int):
- return np.trapz(x**order * y, x) / np.trapz(y, x)
+ return trapezoid(x**order * y, x) / trapezoid(y, x)
elif hasattr(order, '__iter__'):
return [get_distribution_moment(x, y, n) for n in order]
else:
Index: ase-3.23.0/ase/md/switch_langevin.py
===================================================================
--- ase-3.23.0.orig/ase/md/switch_langevin.py
+++ ase-3.23.0/ase/md/switch_langevin.py
@@ -1,6 +1,10 @@
from typing import Any, List, Optional
import numpy as np
+try:
+ from numpy import trapezoid # NumPy 2.0.0
+except ImportError:
+ from numpy import trapz as trapezoid
from ase import Atoms
from ase.calculators.mixing import MixedCalculator
@@ -117,7 +121,7 @@ class SwitchLangevin(Langevin):
lambdas = self.path_data[:, 1]
U1 = self.path_data[:, 2]
U2 = self.path_data[:, 3]
- delta_F = np.trapz(U2 - U1, lambdas)
+ delta_F = trapezoid(U2 - U1, lambdas)
return delta_F
Index: ase-3.23.0/ase/test/calculator/test_harmonic.py
===================================================================
--- ase-3.23.0.orig/ase/test/calculator/test_harmonic.py
+++ ase-3.23.0/ase/test/calculator/test_harmonic.py
@@ -1,6 +1,10 @@
import numpy as np
import pytest
from numpy.testing import assert_array_almost_equal
+try:
+ from numpy import trapezoid # NumPy 2.0.0
+except ImportError:
+ from numpy import trapz as trapezoid
from ase import Atoms
from ase.calculators.calculator import CalculationFailed, CalculatorSetupError
@@ -266,7 +270,7 @@ def test_thermodynamic_integration():
e0, e1 = calc_linearCombi.get_energy_contributions(atoms)
ediffs[lamb].append(float(e1) - float(e0))
ediffs[lamb] = np.mean(ediffs[lamb])
- dA = np.trapz([ediffs[lamb] for lamb in lambs], x=lambs) # anharm. corr.
+ dA = trapezoid([ediffs[lamb] for lamb in lambs], x=lambs) # anharm. corr.
assert -0.005 < dA < 0.005 # the MD run is to short for convergence
if dA == 0.0:
raise ValueError('there is most likely something wrong, but it could '
Index: ase-3.23.0/ase/io/octopus/input.py
===================================================================
--- ase-3.23.0.orig/ase/io/octopus/input.py
+++ ase-3.23.0/ase/io/octopus/input.py
@@ -516,7 +516,7 @@ def atoms2kwargs(atoms, use_ase_cell):
if atoms.cell.orthorhombic:
Lsize = 0.5 * np.diag(cell)
- kwargs['lsize'] = [[repr(size) for size in Lsize]]
+ kwargs['lsize'] = [[str(size) for size in Lsize]]
# ASE uses (0...cell) while Octopus uses -L/2...L/2.
# Lsize is really cell / 2, and we have to adjust our
# positions by subtracting Lsize (see construction of the coords
@@ -533,7 +533,7 @@ def atoms2kwargs(atoms, use_ase_cell):
if sym is None:
raise ValueError('Cannot represent atom X without tags and '
'species info in atoms.info')
- coord_block.append([repr(sym)] + [repr(x) for x in pos])
+ coord_block.append([repr(sym)] + [str(x) for x in pos])
kwargs[coordtype] = coord_block
npbc = sum(atoms.pbc)
Index: ase-3.23.0/ase/dft/band_structure.py
===================================================================
--- ase-3.23.0.orig/ase/dft/band_structure.py
+++ ase-3.23.0/ase/dft/band_structure.py
@@ -1,6 +1,9 @@
import warnings
-from numpy import VisibleDeprecationWarning
+try:
+ from numpy.exceptions import VisibleDeprecationWarning # NumPy 2.0.0
+except ImportError:
+ from numpy import VisibleDeprecationWarning
from ase.spectrum.band_structure import * # noqa: F401,F403
Index: ase-3.23.0/ase/test/test_imports.py
===================================================================
--- ase-3.23.0.orig/ase/test/test_imports.py
+++ ase-3.23.0/ase/test/test_imports.py
@@ -3,7 +3,10 @@ from importlib import import_module
from pathlib import Path
import pytest
-from numpy import VisibleDeprecationWarning
+try:
+ from numpy.exceptions import VisibleDeprecationWarning # NumPy 2.0.0
+except ImportError:
+ from numpy import VisibleDeprecationWarning
import ase

View File

@@ -1,32 +0,0 @@
Index: ase-3.22.1/ase/calculators/autodetect.py
===================================================================
--- ase-3.22.1.orig/ase/calculators/autodetect.py
+++ ase-3.22.1/ase/calculators/autodetect.py
@@ -45,11 +45,11 @@ def detect(name):
return d
if name in python_modules:
- loader = importlib.find_loader(python_modules[name])
- if loader is not None:
+ spec = importlib.util.find_spec(python_modules[name])
+ if spec is not None:
d['type'] = 'python'
d['module'] = python_modules[name]
- d['path'] = loader.get_filename()
+ d['path'] = spec.loader.get_filename()
return d
envvar = get_executable_env_var(name)
Index: ase-3.22.1/ase/test/testsuite.py
===================================================================
--- ase-3.22.1.orig/ase/test/testsuite.py
+++ ase-3.22.1/ase/test/testsuite.py
@@ -53,7 +53,7 @@ def test(calculators=tuple(), jobs=0, ve
def have_module(module):
- return importlib.find_loader(module) is not None
+ return importlib.util.find_spec(module) is not None
MULTIPROCESSING_MAX_WORKERS = 32

View File

@@ -1,3 +1,76 @@
-------------------------------------------------------------------
Fri Aug 30 12:50:49 UTC 2024 - Ben Greiner <code@bnavigator.de>
- Unpin numpy
- Add ase-mr3400-numpy2.patch gl#ase/ase#3400
-------------------------------------------------------------------
Thu Jul 18 03:49:28 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Update to 3.23.0:
* Add FixSubsetCom to fix the center of mass of the specified subset
of atoms.
* Add the indices option to ase.Atoms.get_center_of_mass() to compute
the center of mass of the specified subset of atoms.
* All saddle-point search and minimum-energy path methods have been
moved into a new ase.mep module. You should start importing from this
location; e.g., from ase.mep import NEB, DyNEB.
* Fix ase.constraints.FixCom.adjust_momenta() to have no center-of-mass
momentum
* ase.build.surface.graphene() now takes a thickness argument
* ase.build.bulk() now assigns initial magnetic moments to BCC Fe, Co,
and Ni.
* ase.build.make_supercell() can now control how to order the atoms in
the supercell via the option order
* mask() returns the mask of nonzero cell vectors, an array of three
booleans.
* reciprocal() now guarantees that cell vectors which are zero correspond
to reciprocal cell vectors that are also zero. Previously the
reciprocal cell vectors could have small nonzero values due to floating
point tolerance.
* The Cell object now has normal() and normals() which calculate normal
vectors to one or all pairs of cell vectors. Also added area() and
areas(), which return the area spanned by one or all pairs of cell
vectors.
* New a2b and periodic formats for Formula objects. The abc format has
been renamed to ab2.
* IO formats can now be implemented in separate packages and registered
in ase with the entry point ase.ioformats in the external package
configuration.
* ase.phonons.Displacement now has a comm keyword argument to better
support parallelization.
* Fix ase.build.rotate.minimize_rotation_and_translation() for systems
with periodic boundary conditions.
* Fix ase.io.db.row.AtomsRow.charge(), which was looking for
inital_charges instead of initial_charges.
* Fixed definition of the Lennard-Jones potential in ase.utils.ff
* The x3d viewer has improved aesthetics
* Added a function, ase.dft.kpoints.mindistance2monkhorstpack(), to
construct a Monkhorst-Pack grid
* Fixed turbomole calculator parsing issues when = are present in data
groups
* Fixed round-trip dict (de)serialization with FixedMode constraint
* Show total number of rows in ASE database
* Fix units of magnetic moments in ASE database
* General improvements to POVRay colors
* Remove deprecated CLI functions, such as the old ase-gui command
* Fix calculation of stresses in ase.stress.full_3x3_to_voigt_6_stress()
* Add polarization parser for FHI-AIMS calculator
* Fix bug in ase.atoms.Atoms.get_center_of_mass()
* Fix multiprocessing bug with ase.neb.NEB
* NEB calculations now call get_forces() instead of get_potential_energy()
followed by get_forces() to prevent duplicate work
* Improve performance of ase.build.supercells.make_supercell() for large
supercells
* Fix conservation of momentum in ase.md.langevin.Langevin
* Fix bug in ase.vibrations.Vibrations causing property calculations to
always use the default method
- Switch to pyproject macros.
- Remove patches, included upstream:
* support-matplotlib-36.patch
* 2582.patch
* deprecated-importlib-find_loader.patch
-------------------------------------------------------------------
Tue Feb 6 18:08:22 UTC 2024 - Daniel Garcia <daniel.garcia@suse.com>

View File

@@ -17,19 +17,17 @@
Name: python-ase
Version: 3.22.1
Version: 3.23.0
Release: 0
Summary: Atomic Simulation Environment
License: LGPL-2.1-or-later
URL: https://wiki.fysik.dtu.dk/ase
Source: https://files.pythonhosted.org/packages/source/a/ase/ase-%{version}.tar.gz
# PATCH-FIX-UPSTREAM https://gitlab.com/ase/ase/-/merge_requests/2826
Patch0: support-matplotlib-36.patch
# PATCH-FIX-UPSTREAM https://gitlab.com/ase/ase/-/merge_requests/2582
Patch1: 2582.patch
# PATCH-FIX-UPSTREAM deprecated-importlib-find_loader.patch https://gitlab.com/ase/ase/-/merge_requests/2938
Patch2: deprecated-importlib-find_loader.patch
# PATCH-FIX-UPSTREAM ase-mr3400-numpy2.patch https://gitlab.com/ase/ase/-/merge_requests/3400
Patch0: ase-mr3400-numpy2.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: python-rpm-macros
# SECTION test requirements
BuildRequires: %{python_module matplotlib >= 3.1.0}
@@ -44,6 +42,8 @@ BuildRequires: fdupes
Requires: python-matplotlib >= 3.1.0
Requires: python-numpy >= 1.15.0
Requires: python-scipy >= 1.1.0
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch: noarch
%python_subpackages
@@ -54,24 +54,22 @@ Atomic Simulation Environment
%autosetup -p1 -n ase-%{version}
%build
%python_build
%pyproject_wheel
%install
%python_install
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/ase
%python_clone -a %{buildroot}%{_bindir}/ase-db
%python_clone -a %{buildroot}%{_bindir}/ase-gui
%python_clone -a %{buildroot}%{_bindir}/ase-run
%python_clone -a %{buildroot}%{_bindir}/ase-info
%python_clone -a %{buildroot}%{_bindir}/ase-build
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
# No scipy CODATA
%pytest -k 'not test_units'
donttest="test_units"
# Broken with current release, remove on upgrade
donttest+=" or test_pw_input_write_nested_flat or test_fix_scaled"
%pytest -k "not ($donttest)"
%post
%python_install_alternative ase ase-db ase-gui ase-run ase-info ase-build
%python_install_alternative ase
%postun
%python_uninstall_alternative ase
@@ -80,12 +78,7 @@ Atomic Simulation Environment
%doc CHANGELOG.rst README.rst
%license COPYING COPYING.LESSER LICENSE
%python_alternative %{_bindir}/ase
%python_alternative %{_bindir}/ase-db
%python_alternative %{_bindir}/ase-gui
%python_alternative %{_bindir}/ase-run
%python_alternative %{_bindir}/ase-info
%python_alternative %{_bindir}/ase-build
%{python_sitelib}/ase
%{python_sitelib}/ase*info
%{python_sitelib}/ase-%{version}.dist-info
%changelog

View File

@@ -1,37 +0,0 @@
From 3d4fff328ba9a06d9799563f357cfe5968f1f79c Mon Sep 17 00:00:00 2001
From: Ask Hjorth Larsen <asklarsen@gmail.com>
Date: Mon, 16 Jan 2023 16:41:15 +0100
Subject: [PATCH] set window title in way that will not crash on matplotlib
3.6+
---
ase/cli/band_structure.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/ase/cli/band_structure.py b/ase/cli/band_structure.py
index 303c64b88..603ad659a 100644
--- a/ase/cli/band_structure.py
+++ b/ase/cli/band_structure.py
@@ -16,15 +16,17 @@ def read_band_structure(filename):
def main(args, parser):
import matplotlib.pyplot as plt
+
bs = read_band_structure(args.calculation)
emin, emax = (float(e) for e in args.range)
- fig = plt.gcf()
- fig.canvas.set_window_title(args.calculation)
+ fig = plt.figure(args.calculation)
ax = fig.gca()
+
bs.plot(ax=ax,
filename=args.output,
emin=emin + bs.reference,
emax=emax + bs.reference)
+
if args.output is None:
plt.show()
--
GitLab