ipyvasp 0.9.89__tar.gz → 0.9.91__tar.gz

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.
Files changed (30) hide show
  1. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/PKG-INFO +2 -2
  2. ipyvasp-0.9.91/ipyvasp/_version.py +1 -0
  3. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/ipyvasp/bsdos.py +8 -0
  4. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/ipyvasp/core/parser.py +28 -10
  5. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/ipyvasp/evals_dataframe.py +1 -1
  6. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/ipyvasp/widgets.py +20 -4
  7. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/ipyvasp.egg-info/PKG-INFO +2 -2
  8. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/ipyvasp.egg-info/requires.txt +1 -1
  9. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/setup.py +1 -1
  10. ipyvasp-0.9.89/ipyvasp/_version.py +0 -1
  11. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/LICENSE +0 -0
  12. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/README.md +0 -0
  13. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/ipyvasp/__init__.py +0 -0
  14. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/ipyvasp/__main__.py +0 -0
  15. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/ipyvasp/_enplots.py +0 -0
  16. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/ipyvasp/_lattice.py +0 -0
  17. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/ipyvasp/cli.py +0 -0
  18. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/ipyvasp/core/__init__.py +0 -0
  19. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/ipyvasp/core/plot_toolkit.py +0 -0
  20. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/ipyvasp/core/serializer.py +0 -0
  21. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/ipyvasp/core/spatial_toolkit.py +0 -0
  22. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/ipyvasp/lattice.py +0 -0
  23. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/ipyvasp/misc.py +0 -0
  24. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/ipyvasp/potential.py +0 -0
  25. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/ipyvasp/utils.py +0 -0
  26. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/ipyvasp.egg-info/SOURCES.txt +0 -0
  27. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/ipyvasp.egg-info/dependency_links.txt +0 -0
  28. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/ipyvasp.egg-info/entry_points.txt +0 -0
  29. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/ipyvasp.egg-info/top_level.txt +0 -0
  30. {ipyvasp-0.9.89 → ipyvasp-0.9.91}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ipyvasp
3
- Version: 0.9.89
3
+ Version: 0.9.91
4
4
  Summary: A processing tool for VASP DFT input/output processing in Jupyter Notebook.
5
5
  Home-page: https://github.com/massgh/ipyvasp
6
6
  Author: Abdul Saboor
@@ -20,7 +20,7 @@ Requires-Dist: scipy==1.9.1
20
20
  Requires-Dist: ipywidgets>=8.0.4
21
21
  Requires-Dist: pillow>=9.3.0
22
22
  Requires-Dist: pandas==1.4.4
23
- Requires-Dist: plotly==5.14.1
23
+ Requires-Dist: plotly==6.0.1
24
24
  Requires-Dist: requests==2.28.1
25
25
  Requires-Dist: typer==0.9.0
26
26
  Provides-Extra: extra
@@ -0,0 +1 @@
1
+ __version__ = "0.9.91"
@@ -200,6 +200,14 @@ class _BandsDosBase:
200
200
  def data(self):
201
201
  "Returns a dictionary of information about the picked data after a plotting function called."
202
202
  return self._data
203
+
204
+ def get_skipk(self):
205
+ "Returns number of first few skipped kpoints in bandstructure plot in case of HSE calculations."
206
+ return self.source.get_skipk()
207
+
208
+ def set_skipk(self, skipk):
209
+ "Set/reset to skip first kpoints in bandstructure plot in case of HSE calculations."
210
+ self.source.set_skipk(skipk)
203
211
 
204
212
  def _fix_projections(self, projections):
205
213
  labels, spins, atoms, orbs, uspins, uatoms, uorbs = (
@@ -16,8 +16,11 @@ class DataSource:
16
16
  """Base class for all data sources. It provides a common interface to access data from different sources.
17
17
  Subclass it to get data from a source and implement the abstract methods."""
18
18
 
19
- def __init__(self, path):
19
+ def __init__(self, path, skipk=None):
20
20
  self._path = Path(path).absolute()
21
+ self._skipk = (
22
+ skipk if isinstance(skipk, (int, np.integer)) else self._read_skipk()
23
+ )
21
24
  if not self._path.is_file():
22
25
  raise FileNotFoundError("File: '{}'' does not exist!".format(path))
23
26
  self._summary = self.get_summary() # summary data is read only once
@@ -76,7 +79,23 @@ class DataSource:
76
79
  raise NotImplementedError(
77
80
  "`get_structure` should be implemented in a subclass. See Vasprun.get_structure as example."
78
81
  )
79
-
82
+
83
+ def _read_skipk(self):
84
+ raise NotImplementedError(
85
+ "`_read_skipk` should be implemented in a subclass. See Vasprun._read_skipk as example."
86
+ )
87
+
88
+ def get_skipk(self):
89
+ "Returns the number of first few k-points to skip in band structure plot in case of HSE calculation."
90
+ return self._skipk
91
+
92
+ def set_skipk(self, skipk):
93
+ "Set the number of first few k-points to skip in band structure plot in case of HSE calculation."
94
+ if isinstance(skipk, (int, np.integer)):
95
+ self._skipk = skipk
96
+ else:
97
+ raise TypeError("skipk should be an integer to skip first few random kpoints.")
98
+
80
99
  def get_kpoints(self):
81
100
  raise NotImplementedError(
82
101
  "`get_kpoints` should be implemented in a subclass. See Vasprun.get_kpoints as example."
@@ -111,7 +130,8 @@ class Vaspout(DataSource):
111
130
  dos = DataSource.dos
112
131
  bands = DataSource.bands
113
132
 
114
- def __init__(self, path):
133
+ def __init__(self, path, skipk=None):
134
+ # super().__init__(path, skipk)
115
135
  raise NotImplementedError("Vaspout is not implemented yet.")
116
136
 
117
137
  def read(file, start_match, stop_match=r'\n', nth_match=1, skip_last=False,apply=None):
@@ -153,10 +173,7 @@ class Vasprun(DataSource):
153
173
  bands = DataSource.bands
154
174
 
155
175
  def __init__(self, path="./vasprun.xml", skipk=None):
156
- super().__init__(path)
157
- self._skipk = (
158
- skipk if isinstance(skipk, (int, np.integer)) else self.get_skipk()
159
- )
176
+ super().__init__(path, skipk)
160
177
 
161
178
  def read(self, start_match, stop_match=r'\n', nth_match=1, skip_last=False,apply=None):
162
179
  """Reads a part of the file between start_match and stop_match and returns a generator. It is lazy and fast.
@@ -167,7 +184,7 @@ class Vasprun(DataSource):
167
184
  kws = {k:v for k,v in locals().items() if k !='self'}
168
185
  return read(self.path,**kws)
169
186
 
170
- def get_skipk(self):
187
+ def _read_skipk(self):
171
188
  "Returns the number of k-points to skip in band structure plot in case of HSE calculation."
172
189
  weights = np.fromiter(
173
190
  (
@@ -199,8 +216,9 @@ class Vasprun(DataSource):
199
216
  ).iter("v")
200
217
  ]
201
218
  )
202
- info_dict["NBANDS"] = int( # Bad initializations, read last one
203
- ET.fromstring(list(self.read("<i.*NBANDS", "</i>"))[-1]).text
219
+ _nbands = [*self.read("<i.*NBANDS[\"\']", "</i>"),*self.read("<i.*NBANDS[\"\']", "</i>",nth_match=2)]
220
+ info_dict["NBANDS"] = int( # Bad initializations of NBANDS, read last one
221
+ ET.fromstring(_nbands[-1]).text
204
222
  )
205
223
  info_dict["NELECTS"] = int(
206
224
  float(ET.fromstring(next(self.read("<i.*NELECT", "</i>"))).text)
@@ -66,7 +66,7 @@ class EvalsDataFrame(pd.DataFrame):
66
66
  source : DataSource
67
67
  Data source to collect data from. Could be ``ipyvasp.Vasprun`` or ``ipyvasp.Vaspout``. Alternatively you can use ``DataSource.get_dataframe`` method to get dataframe directly.
68
68
  spins : list
69
-
69
+ of spin indices [zero based here], In output data frame you will see corresponding spin number based on full data.
70
70
  bands : list
71
71
  of band indices [zero based here], In output data frame you will see corresponding band number based on full data.
72
72
  atoms : list
@@ -100,6 +100,7 @@ def fix_signature(cls):
100
100
  cls.__signature__ = inspect.signature(cls.__init__)
101
101
  return cls
102
102
 
103
+ @fix_signature
103
104
  class Files:
104
105
  """Creates a Batch of files in a directory recursively based on glob pattern or given list of files.
105
106
  This is a boilerplate abstraction to do analysis in multiple calculations simultaneously.
@@ -675,8 +676,9 @@ class BandsWidget(VBox):
675
676
  description="Style", options=["plotly_white", "plotly_dark"]
676
677
  )
677
678
  self._click = Dropdown(description="Click", options=["None", "vbm", "cbm"])
678
- self._ktcicks = Text(description="kticks")
679
+ self._ktcicks = Text(description="kticks", tooltip="0 index maps to minimum value of kpoints slider.")
679
680
  self._brange = ipw.IntRangeSlider(description="bands",min=1, max=1) # number, not index
681
+ self._krange = ipw.IntRangeSlider(description="kpoints",min=0, max=1,value=[0,1], tooltip="Includes non-zero weight kpoints")
680
682
  self._ppicks = PropsPicker(
681
683
  on_button_click=self._update_graph, on_selection_changed=self._warn_update
682
684
  )
@@ -690,6 +692,7 @@ class BandsWidget(VBox):
690
692
  free_widgets=[
691
693
  self._tsd,
692
694
  self._brange,
695
+ self._krange,
693
696
  self._ktcicks,
694
697
  ipw.HTML("<hr/>"),
695
698
  self._ppicks,
@@ -702,6 +705,7 @@ class BandsWidget(VBox):
702
705
  self._tsd.observe(self._change_theme, "value")
703
706
  self._click.observe(self._click_save_data, "value")
704
707
  self._ktcicks.observe(self._warn_update, "value")
708
+ self._krange.observe(self._set_krange, "value")
705
709
  self._brange.observe(self._warn_update, "value")
706
710
 
707
711
  @property
@@ -722,9 +726,17 @@ class BandsWidget(VBox):
722
726
  vp.Vasprun(path) if path.parts[-1].endswith('xml') else vp.Vaspout(path)
723
727
  ).bands
724
728
  self._ppicks.update(self.bands.source.summary)
725
- self._ktcicks.value = ", ".join(
729
+
730
+ self._krange.max = self.bands.source.summary.NKPTS - 1
731
+ self._krange.tooltip = f"Includes {self.bands.source.get_skipk()} non-zero weight kpoints"
732
+ self.bands.source.set_skipk(0) # full range to view for slider flexibility after fix above
733
+
734
+ self._kwargs['kpairs'] = [self._krange.value,]
735
+ if (ticks := ", ".join(
726
736
  f"{k}:{v}" for k, v in self.bands.get_kticks()
727
- )
737
+ )): # Do not overwrite if empty
738
+ self._ktcicks.value = ticks
739
+
728
740
  self._brange.max = self.bands.source.summary.NBANDS
729
741
  if self.bands.source.summary.LSORBIT:
730
742
  self._click.options = ["None", "vbm", "cbm", "so_max", "so_min"]
@@ -781,7 +793,7 @@ class BandsWidget(VBox):
781
793
  for vs in self._ktcicks.value.split(",")
782
794
  ]
783
795
  kticks = [(int(vs[0]), vs[1]) for vs in hsk if len(vs) == 2] or None
784
- self._kwargs = {"kticks": kticks, # below numbers instead of index and full shown range
796
+ self._kwargs = {**self._kwargs, "kticks": kticks, # below numbers instead of index and full shown range
785
797
  "bands": range(self._brange.value[0] - 1, self._brange.value[1]) if self._brange.value else None}
786
798
 
787
799
  if self._ppicks.projections:
@@ -814,6 +826,10 @@ class BandsWidget(VBox):
814
826
  def _change_theme(self, change):
815
827
  self._fig.layout.template = self._tsd.value
816
828
 
829
+ def _set_krange(self, change):
830
+ self._kwargs["kpairs"] = [self._krange.value,]
831
+ self._warn_update(None) # Update warning
832
+
817
833
  def _click_save_data(self, change=None):
818
834
  def _show_and_save(data_dict):
819
835
  self._interact.output_widget.clear_output(wait=True) # Why need again?
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ipyvasp
3
- Version: 0.9.89
3
+ Version: 0.9.91
4
4
  Summary: A processing tool for VASP DFT input/output processing in Jupyter Notebook.
5
5
  Home-page: https://github.com/massgh/ipyvasp
6
6
  Author: Abdul Saboor
@@ -20,7 +20,7 @@ Requires-Dist: scipy==1.9.1
20
20
  Requires-Dist: ipywidgets>=8.0.4
21
21
  Requires-Dist: pillow>=9.3.0
22
22
  Requires-Dist: pandas==1.4.4
23
- Requires-Dist: plotly==5.14.1
23
+ Requires-Dist: plotly==6.0.1
24
24
  Requires-Dist: requests==2.28.1
25
25
  Requires-Dist: typer==0.9.0
26
26
  Provides-Extra: extra
@@ -4,7 +4,7 @@ scipy==1.9.1
4
4
  ipywidgets>=8.0.4
5
5
  pillow>=9.3.0
6
6
  pandas==1.4.4
7
- plotly==5.14.1
7
+ plotly==6.0.1
8
8
  requests==2.28.1
9
9
  typer==0.9.0
10
10
 
@@ -25,7 +25,7 @@ REQUIRED = [
25
25
  "ipywidgets>=8.0.4",
26
26
  "pillow>=9.3.0",
27
27
  "pandas==1.4.4",
28
- "plotly==5.14.1",
28
+ "plotly==6.0.1",
29
29
  "requests==2.28.1",
30
30
  "typer==0.9.0",
31
31
  ]
@@ -1 +0,0 @@
1
- __version__ = "0.9.89"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes