Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for numpy v2 #179

Merged
merged 4 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions arc/alkali_atom_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from numpy.linalg import eigh

from .wigner import Wigner6j, Wigner3j, CG, WignerDmatrix
from scipy.integrate import trapezoid
from scipy.constants import physical_constants, pi, epsilon_0, hbar
from scipy.constants import k as C_k
from scipy.constants import c as C_c
Expand Down Expand Up @@ -575,7 +576,7 @@ def radialWavefunction(

psi_r = d[0]
r = d[1]
suma = np.trapz(psi_r**2, x=r)
suma = trapezoid(psi_r**2, x=r)
psi_r = psi_r / (sqrt(suma))
else:
# full implementation in Python
Expand All @@ -592,7 +593,7 @@ def potential(x):
innerLimit, outerLimit, potential, step, 0.01, 0.01
)

suma = np.trapz(psi_r**2, x=r)
suma = trapezoid(psi_r**2, x=r)
psi_r = psi_r / (sqrt(suma))

return r, psi_r
Expand Down Expand Up @@ -959,7 +960,7 @@ def getRadialMatrixElement(

# note that r1 and r2 change in same staps,
# starting from the same value
dipoleElement = np.trapz(
dipoleElement = trapezoid(
np.multiply(
np.multiply(psi1_r1[0:upTo], psi2_r2[0:upTo]), r1[0:upTo]
),
Expand Down Expand Up @@ -1063,7 +1064,7 @@ def getQuadrupoleMatrixElement(

# note that r1 and r2 change in same staps,
# starting from the same value
quadrupoleElement = np.trapz(
quadrupoleElement = trapezoid(
np.multiply(
np.multiply(psi1_r1[0:upTo], psi2_r2[0:upTo]),
np.multiply(r1[0:upTo], r1[0:upTo]),
Expand Down
5 changes: 3 additions & 2 deletions arc/calculations_atom_pairstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
from scipy.sparse.linalg import eigsh
from scipy.sparse import csr_matrix
from scipy.optimize import curve_fit
from scipy.integrate import trapezoid
from scipy.constants import e as C_e
from scipy.constants import h as C_h
from scipy.constants import c as C_c
Expand Down Expand Up @@ -1112,7 +1113,7 @@ def getLeRoyRadius(self):
step,
)

sqrt_r1_on2 = np.trapz(
sqrt_r1_on2 = trapezoid(
np.multiply(np.multiply(psi1_r1, psi1_r1), np.multiply(r1, r1)),
x=r1,
)
Expand All @@ -1127,7 +1128,7 @@ def getLeRoyRadius(self):
step,
)

sqrt_r2_on2 = np.trapz(
sqrt_r2_on2 = trapezoid(
np.multiply(np.multiply(psi2_r2, psi2_r2), np.multiply(r2, r2)),
x=r2,
)
Expand Down
3 changes: 2 additions & 1 deletion arc/calculations_atom_single.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from scipy.constants import e as C_e
from scipy.constants import m_e as C_m_e
from scipy.optimize import curve_fit
from scipy.integrate import trapezoid
from scipy import interpolate

# for matrices
Expand Down Expand Up @@ -132,7 +133,7 @@ def __init__(self, atom, basisStates, coefficients):
2.0 * n * (n + 15.0),
step,
)
suma = np.trapz(rWavefunc**2, x=r)
suma = trapezoid(rWavefunc**2, x=r)
rWavefunc = rWavefunc / (sqrt(suma))

self.basisWavefunctions.append(
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools>=61.0", "wheel", "oldest-supported-numpy"]
requires = ["setuptools>=61.0", "wheel", "oldest-supported-numpy; python_version=='3.8'", "numpy>=2.0.0; python_version!='3.8'"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
Expand Down Expand Up @@ -58,7 +58,7 @@ classifiers = [
requires-python = ">=3.8"
dependencies = [
"scipy>=0.18.1",
"numpy>=1.16.0",
"numpy>=1.19.3",
"matplotlib>=1.5.3",
"sympy>=1.1.1",
"lmfit>=0.9.0",
Expand Down
Loading