Skip to content

Commit

Permalink
Merge pull request #270 from thomas-rocke/DislFixes
Browse files Browse the repository at this point in the history
MAINT: Upper bound numpy version <2.0.0
  • Loading branch information
jameskermode authored Oct 16, 2024
2 parents cdd92d9 + 7094a73 commit 8124ddf
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ clean:
rm -rf $(BUILDDIR)/*

html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
$(SPHINXBUILD) --show-traceback -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

Expand Down
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@
# Raise Error (not default Warning) when a notebook execution fails
# (due to code error, timeout, etc.)
nb_execution_raise_on_error = True
nb_execution_timeout = 60
nb_execution_show_tb = True
nb_execution_timeout = 90

# -- Extension configuration -------------------------------------------------

Expand Down
8 changes: 4 additions & 4 deletions matscipy/calculators/eam/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ def read_eam(eam_file, kind="eam/alloy"):
supported_kinds = ["eam", "eam/alloy", "eam/fs"]
if kind not in supported_kinds:
raise ValueError(f"EAM kind {kind} not supported")
with open(eam_file, 'r') as file:
eam = file.readlines()
# with open(eam_file, 'r', encoding='utf-8') as file:
# eam = file.readlines()

if kind == "eam":
with open(eam_file, 'r') as file:
with open(eam_file, 'r', encoding='utf-8') as file:
# ignore comment characters on first line but strip them from subsequent lines
lines = [file.readline()]
lines.extend(_strip_comments_from_line(line) for line in file.readlines())
Expand Down Expand Up @@ -216,7 +216,7 @@ def read_eam(eam_file, kind="eam/alloy"):

if kind in ["eam/alloy", "eam/fs"]:
"""eam/alloy and eam/fs have almost the same structure, except for the electron density section"""
with open(eam_file, 'r') as file:
with open(eam_file, 'r', encoding='utf-8') as file:
# ignore comment characters on first line but strip them from subsequent lines
lines = [file.readline() for _ in range(3)]
lines.extend(_strip_comments_from_line(line) for line in file.readlines())
Expand Down
3 changes: 2 additions & 1 deletion matscipy/dislocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3493,6 +3493,7 @@ def inf_line_transform(p, z_max):
# Start by translating by z_max (periodicity) such that there are points below the cell
n = np.ceil(np.min(p[:, 2]) / z_max)
p_off = n * z_max
p = np.copy(p) # Needed as sphinx-build/myst_nb was making `p` read-only for some reason.
p[:, 2] -= p_off

# Now start from the point with negative z closest to z=0
Expand Down Expand Up @@ -4064,7 +4065,7 @@ def build_cylinder(self,
bulk, disloc, core_positions, cyl_mask, fix_mask = self._build_bulk_cyl(radius, core_positions, fix_width, extension,
fixed_points, self_consistent, method, verbose, cyl_mask=cyl_mask, **kwargs)

if partial_distance > 0:
if not np.allclose(core_positions[0, :], core_positions[1, :]):
# Specify left & right dislocation separately
disloc.info["core_positions"] = [list(core_positions[0, :]), list(core_positions[1, :])]
disloc.info["burgers_vectors"] = [list(self.left_dislocation.burgers), list(self.right_dislocation.burgers)]
Expand Down
18 changes: 10 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ classifiers = [
requires-python = ">=3.8.0"
dynamic = ["version"]
dependencies = [
"numpy>=1.16.0",
"numpy>=1.16.0, <2.0.0",
"scipy>=1.2.3",
"ase>=3.23.0",
"packaging"
Expand All @@ -35,22 +35,24 @@ test = [
"pytest",
"pytest-subtests",
"pytest-timeout",
"sympy",
"atomman",
"ovito"
"matscipy[dislocation]",
"sympy"
]
dislocation = [
"nglview==3.0.8", # resolves https://github.com/libAtoms/matscipy/issues/222
"ovito",
"atomman"
]
docs = [
"matscipy[dislocation]",
"sphinx",
"myst_nb",
"numpydoc",
"atomman",
"ovito",
"sphinx_copybutton",
"sphinx_rtd_theme",
"sphinxcontrib-spelling",
"pydata-sphinx-theme",
"jupytext",
"nglview==3.0.8" # resolves https://github.com/libAtoms/matscipy/issues/222
"jupytext"
]
cli = [
"argcomplete"
Expand Down

0 comments on commit 8124ddf

Please sign in to comment.