Skip to content

Commit 956ab9a

Browse files
committed
trying to fix #958, documentation issue
1 parent 819a286 commit 956ab9a

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

docs/conf.py

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
# Setting up generic things
7676

7777
# If building this on RTD, mock out fortran sources
78-
on_rtd = os.environ.get("READTHEDOCS", "false").lower() == "true"
78+
on_rtd = os.environ.get("READTHEDOCS", "false").lower() in ("1", "yes", "true")
7979
_doc_skip = list(
8080
map(lambda x: x.lower(), os.environ.get("_SISL_DOC_SKIP", "").split(","))
8181
)
@@ -85,6 +85,22 @@
8585
if on_rtd:
8686
os.environ["SISL_NUM_PROCS"] = "1"
8787

88+
# Let the builder decide what it should built.
89+
# This can be a pure HTML (for interaction), but that tends
90+
# to blow up file-sizes which isn't really suitable for
91+
# RTD.
92+
plotly_renderer = "iframe_connected"
93+
if on_rtd:
94+
plotly_renderer = "png"
95+
plotly_renderer = os.environ.get("_SISL_DOC_PLOTLY", plotly_renderer)
96+
97+
# Store the renderer
98+
import plotly.io as pio
99+
100+
pio.renderers.default = plotly_renderer
101+
if "PLOTLY_RENDERER" not in os.environ:
102+
os.environ["PLOTLY_RENDERER"] = plotly_renderer
103+
88104

89105
# General information about the project.
90106
project = "sisl"
@@ -227,7 +243,7 @@
227243
.. _GULP: https://nanochemistry.curtin.edu.au/gulp/news.cfm
228244
229245
.. Other programs heavily used
230-
.. _ASE: https://wiki.fysik.dtu.dk/ase
246+
.. _ASE: https://ase-lib.org
231247
.. _kwant: https://kwant-project.org
232248
.. _XCrySDen: http://www.xcrysden.org
233249
.. _VMD: https://www.ks.uiuc.edu/Research/vmd
@@ -463,14 +479,12 @@ def has_under(name: str):
463479
# Plot directives for matplotlib
464480
plot_include_source = True
465481
plot_formats = [("png", 90)]
466-
plot_pre_code = """\
482+
plot_pre_code = f"""\
467483
import numpy as np
468484
import matplotlib.pyplot as plt
469485
import sisl as si
470-
import plotly.io as pio
471486
np.random.seed(123987)
472487
np.set_printoptions(precision=4, suppress=True)
473-
pio.renderers.default = "notebook_connected"
474488
"""
475489

476490

@@ -504,7 +518,7 @@ def has_under(name: str):
504518
"python": ("https://docs.python.org/3/", None),
505519
"numpy": ("https://numpy.org/doc/stable/", None),
506520
"scipy": ("https://docs.scipy.org/doc/scipy/", None),
507-
"ase": ("https://wiki.fysik.dtu.dk/ase/", None),
521+
"ase": ("https://ase-lib.org/", None),
508522
"matplotlib": ("https://matplotlib.org/stable/", None),
509523
"xarray": ("https://docs.xarray.dev/en/stable/", None),
510524
"plotly": ("https://plotly.com/python-api-reference/", None),
@@ -570,7 +584,7 @@ class RevYearPlain(PlainStyle):
570584

571585
# Insert a link to download the IPython notebook
572586
nbsphinx_prolog = r"""
573-
{% set docname = "docs/" + env.doc2path(env.docname, base=None) %}
587+
{% set docname = "docs/" + env.doc2path(env.docname, base=None)|string %}
574588
575589
.. raw:: html
576590

src/sisl/mixing/diis.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ def solve_lagrange(self) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.float6
107107

108108
# fill the rest of the matrix
109109
scale = B[:n_h, :n_h].max() - B[:n_h, :n_h].min()
110+
scale = scale / 2 + B[:n_h, :n_h].min()
110111
B[:, n_h] = scale
111112
B[n_h, :] = scale
112113
B[n_h, n_h] = 0.0

0 commit comments

Comments
 (0)