ipyvasp 0.9.83__py2.py3-none-any.whl → 0.9.84__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ipyvasp/_version.py +1 -1
- ipyvasp/core/plot_toolkit.py +4 -1
- ipyvasp/core/serializer.py +2 -2
- ipyvasp/lattice.py +6 -5
- ipyvasp/utils.py +1 -1
- ipyvasp/widgets.py +14 -18
- {ipyvasp-0.9.83.dist-info → ipyvasp-0.9.84.dist-info}/METADATA +1 -1
- {ipyvasp-0.9.83.dist-info → ipyvasp-0.9.84.dist-info}/RECORD +12 -12
- {ipyvasp-0.9.83.dist-info → ipyvasp-0.9.84.dist-info}/LICENSE +0 -0
- {ipyvasp-0.9.83.dist-info → ipyvasp-0.9.84.dist-info}/WHEEL +0 -0
- {ipyvasp-0.9.83.dist-info → ipyvasp-0.9.84.dist-info}/entry_points.txt +0 -0
- {ipyvasp-0.9.83.dist-info → ipyvasp-0.9.84.dist-info}/top_level.txt +0 -0
ipyvasp/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.9.
|
|
1
|
+
__version__ = "0.9.84"
|
ipyvasp/core/plot_toolkit.py
CHANGED
|
@@ -1009,7 +1009,10 @@ def iplot2html(fig, outfile=None, modebar=True):
|
|
|
1009
1009
|
|
|
1010
1010
|
|
|
1011
1011
|
def iplot2widget(fig, fig_widget=None, template=None):
|
|
1012
|
-
"Converts plotly's figure to FigureWidget by copying attributes and data. If fig_widget is provided, it will update it. Adds template if provided."
|
|
1012
|
+
"Converts plotly's figure to FigureWidget by copying attributes and data. If fig_widget is provided, it will update it. Adds template if provided. If fig is FigureWidget, it is just returned"
|
|
1013
|
+
if isinstance(fig, go.FigureWidget):
|
|
1014
|
+
return fig
|
|
1015
|
+
|
|
1013
1016
|
if not isinstance(fig, go.Figure):
|
|
1014
1017
|
raise ValueError("fig must be instance of plotly.graph_objects.Figure")
|
|
1015
1018
|
|
ipyvasp/core/serializer.py
CHANGED
|
@@ -917,13 +917,13 @@ def dump(data, format: str = "pickle", outfile: str = None, indent: int = 1) ->
|
|
|
917
917
|
if format == "pickle":
|
|
918
918
|
if outfile == None:
|
|
919
919
|
return pickle.dumps(dict_obj)
|
|
920
|
-
outfile = Path(outfile).
|
|
920
|
+
outfile = Path(outfile).with_suffix(".pickle")
|
|
921
921
|
with open(outfile, "wb") as f:
|
|
922
922
|
pickle.dump(dict_obj, f)
|
|
923
923
|
if format == "json":
|
|
924
924
|
if outfile == None:
|
|
925
925
|
return json.dumps(dict_obj, cls=EncodeFromNumpy, indent=indent)
|
|
926
|
-
outfile = Path(outfile).
|
|
926
|
+
outfile = Path(outfile).with_suffix(".json")
|
|
927
927
|
with open(outfile, "w") as f:
|
|
928
928
|
json.dump(dict_obj, f, cls=EncodeFromNumpy, indent=indent)
|
|
929
929
|
return None
|
ipyvasp/lattice.py
CHANGED
|
@@ -14,6 +14,7 @@ from contextlib import redirect_stdout
|
|
|
14
14
|
from io import StringIO
|
|
15
15
|
from itertools import permutations
|
|
16
16
|
from contextlib import suppress
|
|
17
|
+
from collections import namedtuple
|
|
17
18
|
|
|
18
19
|
import numpy as np
|
|
19
20
|
from pandas.io.clipboard import clipboard_get, clipboard_set
|
|
@@ -630,7 +631,7 @@ class POSCAR:
|
|
|
630
631
|
return self._cell
|
|
631
632
|
|
|
632
633
|
def get_plane(self, hkl, d=1/2,tol=1e-2):
|
|
633
|
-
"""Returns
|
|
634
|
+
"""Returns tuple `Plane(point, normal, vertices)` of a plane bound inside cell. .
|
|
634
635
|
hkl should be list of three miller indices. d is fractional distance in range 0,1 in direction of hkl.
|
|
635
636
|
e.g. if there are 8 planes of atoms in a cubic cell, d = 0, 1/8,...7/8, 1 match position of those planes.
|
|
636
637
|
"""
|
|
@@ -651,13 +652,13 @@ class POSCAR:
|
|
|
651
652
|
qts = self.cell.to_fractional(pts)
|
|
652
653
|
qts = qts[(qts >= -tol).all(axis=1) & (qts <= 1 + tol).all(axis=1)]
|
|
653
654
|
pts = self.cell.to_cartesian(qts)
|
|
654
|
-
return pts
|
|
655
|
+
return namedtuple("Plane","point normal vertices")(point, normal, pts)
|
|
655
656
|
|
|
656
657
|
def splot_plane(self, hkl, d=1/2,tol=1e-2,ax=None, **kwargs):
|
|
657
658
|
"""Provide hkl and a 3D axes to plot plane. kwargs are passed to `mpl_toolkits.mplot3d.art3d.Poly3DCollection`
|
|
658
659
|
Note: You may get wrong plane if your basis are not aligned to axes. So you can use `transpose` or `set_zdir` methods before plottling cell.
|
|
659
660
|
"""
|
|
660
|
-
P = self.get_plane(hkl,d=d,tol=tol)
|
|
661
|
+
P = self.get_plane(hkl,d=d,tol=tol).vertices
|
|
661
662
|
if ax is None:
|
|
662
663
|
ax = get_axes(axes_3d=True)
|
|
663
664
|
ax.set( # it does not show otherwise
|
|
@@ -676,9 +677,9 @@ class POSCAR:
|
|
|
676
677
|
fig = go.Figure()
|
|
677
678
|
|
|
678
679
|
P = self.get_plane(hkl,d=d,tol=tol)
|
|
679
|
-
kwargs['delaunayaxis'] = ('xyz')[np.eye(3).dot(
|
|
680
|
+
kwargs['delaunayaxis'] = ('xyz')[np.abs(np.eye(3).dot(P.normal)).argmax()] # with alphahull=-1, delaunayaxis to be set properly
|
|
680
681
|
kwargs = {**dict(color='#8a8',opacity=0.7,alphahull=-1, showlegend=True,name=str(hkl)),**kwargs}
|
|
681
|
-
fig.add_trace(go.Mesh3d({k:v for v,k in zip(P.T, 'xyz')},**kwargs))
|
|
682
|
+
fig.add_trace(go.Mesh3d({k:v for v,k in zip(P.vertices.T, 'xyz')},**kwargs))
|
|
682
683
|
return fig
|
|
683
684
|
|
|
684
685
|
@_sub_doc(stk.get_bz, {"basis :.*loop :": "loop :"})
|
ipyvasp/utils.py
CHANGED
|
@@ -267,7 +267,7 @@ def prevent_overwrite(path) -> Path:
|
|
|
267
267
|
if out_path.exists():
|
|
268
268
|
# Check existing files
|
|
269
269
|
i = 0
|
|
270
|
-
name = out_path.stem + "-{}" + out_path.suffix
|
|
270
|
+
name = (out_path.parent / out_path.stem) + "-{}" + out_path.suffix
|
|
271
271
|
while Path(name.format(i)).is_file():
|
|
272
272
|
i += 1
|
|
273
273
|
out_path = Path(name.format(i))
|
ipyvasp/widgets.py
CHANGED
|
@@ -13,6 +13,7 @@ from time import time
|
|
|
13
13
|
from pathlib import Path
|
|
14
14
|
from collections.abc import Iterable
|
|
15
15
|
from functools import partial
|
|
16
|
+
from pprint import pformat
|
|
16
17
|
|
|
17
18
|
# Widgets Imports
|
|
18
19
|
from IPython.display import display
|
|
@@ -262,10 +263,10 @@ class Files:
|
|
|
262
263
|
If you don't need to interpret the result of the function call, you can use the @self.interact decorator instead.
|
|
263
264
|
"""
|
|
264
265
|
info = ipw.HTML().add_class("fprogess")
|
|
265
|
-
dd = Dropdown(description='File', options=self._files)
|
|
266
|
+
dd = Dropdown(description='File', options=['Select a File',*self._files]) # allows single file workable
|
|
266
267
|
|
|
267
268
|
def interact_func(fname, **kws):
|
|
268
|
-
if fname: # This would be None if no file is selected
|
|
269
|
+
if fname and str(fname) != 'Select a File': # This would be None if no file is selected
|
|
269
270
|
info.value = _progress_svg
|
|
270
271
|
try:
|
|
271
272
|
start = time()
|
|
@@ -627,7 +628,7 @@ class BandsWidget(VBox):
|
|
|
627
628
|
self._tsd = Dropdown(
|
|
628
629
|
description="Style", options=["plotly_white", "plotly_dark"]
|
|
629
630
|
)
|
|
630
|
-
self._click = Dropdown(description="Click", options=["None", "
|
|
631
|
+
self._click = Dropdown(description="Click", options=["None", "vbm", "cbm"])
|
|
631
632
|
self._ktcicks = Text(description="kticks")
|
|
632
633
|
self._brange = ipw.IntRangeSlider(description="bands",min=1, max=1) # number, not index
|
|
633
634
|
self._ppicks = PropsPicker(
|
|
@@ -680,9 +681,9 @@ class BandsWidget(VBox):
|
|
|
680
681
|
)
|
|
681
682
|
self._brange.max = self.bands.source.summary.NBANDS
|
|
682
683
|
if self.bands.source.summary.LSORBIT:
|
|
683
|
-
self._click.options = ["None", "
|
|
684
|
+
self._click.options = ["None", "vbm", "cbm", "so_max", "so_min"]
|
|
684
685
|
else:
|
|
685
|
-
self._click.options = ["None", "
|
|
686
|
+
self._click.options = ["None", "vbm", "cbm"]
|
|
686
687
|
|
|
687
688
|
if (file := path.parent / "result.json").is_file():
|
|
688
689
|
self._result = serializer.load(str(file.absolute())) # Old data loaded
|
|
@@ -692,7 +693,7 @@ class BandsWidget(VBox):
|
|
|
692
693
|
{
|
|
693
694
|
"v": round(pdata.volume, 4),
|
|
694
695
|
**{k: round(v, 4) for k, v in zip("abc", pdata.norms)},
|
|
695
|
-
**{k: round(v, 4) for k, v in zip("
|
|
696
|
+
**{k: round(v, 4) for k, v in zip(["alpha","beta","gamma"], pdata.angles)},
|
|
696
697
|
}
|
|
697
698
|
)
|
|
698
699
|
self._click_save_data(None) # Load into view
|
|
@@ -771,13 +772,10 @@ class BandsWidget(VBox):
|
|
|
771
772
|
def _show_and_save(data_dict):
|
|
772
773
|
self._interact.output_widget.clear_output(wait=True) # Why need again?
|
|
773
774
|
with self._interact.output_widget:
|
|
774
|
-
print(
|
|
775
|
-
", ".join(
|
|
776
|
-
f"{key} = {value}"
|
|
775
|
+
print(pformat({key: value
|
|
777
776
|
for key, value in data_dict.items()
|
|
778
777
|
if key not in ("so_max", "so_min")
|
|
779
|
-
)
|
|
780
|
-
)
|
|
778
|
+
}))
|
|
781
779
|
|
|
782
780
|
serializer.dump(
|
|
783
781
|
data_dict,
|
|
@@ -785,11 +783,9 @@ class BandsWidget(VBox):
|
|
|
785
783
|
outfile=self.path.parent / "result.json",
|
|
786
784
|
)
|
|
787
785
|
|
|
788
|
-
if
|
|
789
|
-
change is None
|
|
790
|
-
): # called from other functions but not from store_clicked_data
|
|
786
|
+
if change is None: # called from other functions but not from store_clicked_data
|
|
791
787
|
return _show_and_save(self._result)
|
|
792
|
-
# Should be after checking
|
|
788
|
+
# Should be after checking change
|
|
793
789
|
if self._click.value and self._click.value == "None":
|
|
794
790
|
return # No need to act on None
|
|
795
791
|
|
|
@@ -806,11 +802,11 @@ class BandsWidget(VBox):
|
|
|
806
802
|
x, 6
|
|
807
803
|
) # Save x to test direct/indirect
|
|
808
804
|
|
|
809
|
-
if data_dict.get("
|
|
810
|
-
data_dict["
|
|
805
|
+
if data_dict.get("vbm", None) and data_dict.get("cbm", None):
|
|
806
|
+
data_dict["gap"] = np.round(data_dict["cbm"] - data_dict["vbm"], 6)
|
|
811
807
|
|
|
812
808
|
if data_dict.get("so_max", None) and data_dict.get("so_min", None):
|
|
813
|
-
data_dict["
|
|
809
|
+
data_dict["soc"] = np.round(
|
|
814
810
|
data_dict["so_max"] - data_dict["so_min"], 6
|
|
815
811
|
)
|
|
816
812
|
|
|
@@ -2,24 +2,24 @@ ipyvasp/__init__.py,sha256=rlorju9arMtHw1QRYPljday-PyZWJdSCxg4lw3g6t0Q,1409
|
|
|
2
2
|
ipyvasp/__main__.py,sha256=eJV1TZSiT8mC_VqAeksNnBI2I8mKMiPkEIlwikbtOjI,216
|
|
3
3
|
ipyvasp/_enplots.py,sha256=D38paN8zqZgluNAwmCwcocd7-_h_T0HTGolI1eBkDes,37484
|
|
4
4
|
ipyvasp/_lattice.py,sha256=kOseNCIWt-VCnkhFQZEcsXhyNYobjfqNfAl3seXHiVU,105584
|
|
5
|
-
ipyvasp/_version.py,sha256=
|
|
5
|
+
ipyvasp/_version.py,sha256=3xnjEM8AMDNSU-FRZtXZ39MIuWcHwZXBmMyzZckPxEs,24
|
|
6
6
|
ipyvasp/bsdos.py,sha256=JvYvHLqMp3eVaJ0amD-9kxp7FehQIFq3WFUxsO5dj0Q,31794
|
|
7
7
|
ipyvasp/cli.py,sha256=aWFEVhNmnW8eSOp5uh95JaDwLQ9K9nlCQcbnOSuhWgw,6844
|
|
8
8
|
ipyvasp/evals_dataframe.py,sha256=-sqxK7LPV6sYDO_XXmZ80FznOaXTkVdbqJKKvTUtMak,20637
|
|
9
|
-
ipyvasp/lattice.py,sha256=
|
|
9
|
+
ipyvasp/lattice.py,sha256=VfyhmbpRHA3nePWUmaoMmCiAehby_VvDuDcp34OK3rA,33685
|
|
10
10
|
ipyvasp/misc.py,sha256=SZJ_ePUR2-HEKYTEpDHVRVE7zpIQVTCjiuw0BCC9UTU,2349
|
|
11
11
|
ipyvasp/potential.py,sha256=tzA73c5lkp6ahLSJchMrU043-QWaOV0nIOUA7VMmfKQ,11408
|
|
12
12
|
ipyvasp/surface.py,sha256=MjE5oB0wW6Pca_C-xu8rN6OMH7lUEeNPNyM7Kz_Im-8,23766
|
|
13
|
-
ipyvasp/utils.py,sha256=
|
|
14
|
-
ipyvasp/widgets.py,sha256=
|
|
13
|
+
ipyvasp/utils.py,sha256=nw_oglztXfl0CZmo63PBstI4didTkuXhThYqhMP8DVI,14247
|
|
14
|
+
ipyvasp/widgets.py,sha256=X4gPkTy--aFZpXGCQJVg4HByt5-mpVB6gNiFmTTIyRg,46628
|
|
15
15
|
ipyvasp/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
ipyvasp/core/parser.py,sha256=TmRoIhyIGJ4nr32tb1MAAy5clUZh0CQh-2hP8mnTaVc,38221
|
|
17
|
-
ipyvasp/core/plot_toolkit.py,sha256=
|
|
18
|
-
ipyvasp/core/serializer.py,sha256
|
|
17
|
+
ipyvasp/core/plot_toolkit.py,sha256=V-IQo7MrOhmNCGpWHIMtV04TmmubgFvGgH_yd4YmoX4,36158
|
|
18
|
+
ipyvasp/core/serializer.py,sha256=v0ma4htirybtQo_wFhIEjkRoZMQk9ETDz85iloaq3YY,38427
|
|
19
19
|
ipyvasp/core/spatial_toolkit.py,sha256=dXowREhiFzBvvr5f_bApzFhf8IzjH2E2Ix90oCBUetY,14885
|
|
20
|
-
ipyvasp-0.9.
|
|
21
|
-
ipyvasp-0.9.
|
|
22
|
-
ipyvasp-0.9.
|
|
23
|
-
ipyvasp-0.9.
|
|
24
|
-
ipyvasp-0.9.
|
|
25
|
-
ipyvasp-0.9.
|
|
20
|
+
ipyvasp-0.9.84.dist-info/LICENSE,sha256=F3SO5RiAZOMfmMGf1KOuk2g_c4ObvuBJhd9iBLDgXoQ,1263
|
|
21
|
+
ipyvasp-0.9.84.dist-info/METADATA,sha256=hX-hNmmx-Yh8dpfR3ZGAigi5cKt7yLQhI6vIWDiPqnI,2421
|
|
22
|
+
ipyvasp-0.9.84.dist-info/WHEEL,sha256=iYlv5fX357PQyRT2o6tw1bN-YcKFFHKqB_LwHO5wP-g,110
|
|
23
|
+
ipyvasp-0.9.84.dist-info/entry_points.txt,sha256=C7m0Sjmr14wFjflCkWXLzr5N6-cQj8uJC9n82mUtzt8,44
|
|
24
|
+
ipyvasp-0.9.84.dist-info/top_level.txt,sha256=ftziWlMWu_1VpDP1sRTFrkfBnWxAi393HYDVu4wRhUk,8
|
|
25
|
+
ipyvasp-0.9.84.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|