ipyvasp 0.9.88__tar.gz → 0.9.90__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.
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/PKG-INFO +1 -1
- ipyvasp-0.9.90/ipyvasp/_version.py +1 -0
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/ipyvasp/bsdos.py +8 -0
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/ipyvasp/core/parser.py +28 -10
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/ipyvasp/evals_dataframe.py +1 -1
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/ipyvasp/utils.py +3 -2
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/ipyvasp.egg-info/PKG-INFO +1 -1
- ipyvasp-0.9.88/ipyvasp/_version.py +0 -1
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/LICENSE +0 -0
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/README.md +0 -0
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/ipyvasp/__init__.py +0 -0
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/ipyvasp/__main__.py +0 -0
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/ipyvasp/_enplots.py +0 -0
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/ipyvasp/_lattice.py +0 -0
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/ipyvasp/cli.py +0 -0
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/ipyvasp/core/__init__.py +0 -0
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/ipyvasp/core/plot_toolkit.py +0 -0
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/ipyvasp/core/serializer.py +0 -0
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/ipyvasp/core/spatial_toolkit.py +0 -0
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/ipyvasp/lattice.py +0 -0
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/ipyvasp/misc.py +0 -0
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/ipyvasp/potential.py +0 -0
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/ipyvasp/widgets.py +0 -0
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/ipyvasp.egg-info/SOURCES.txt +0 -0
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/ipyvasp.egg-info/dependency_links.txt +0 -0
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/ipyvasp.egg-info/entry_points.txt +0 -0
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/ipyvasp.egg-info/requires.txt +0 -0
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/ipyvasp.egg-info/top_level.txt +0 -0
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/setup.cfg +0 -0
- {ipyvasp-0.9.88 → ipyvasp-0.9.90}/setup.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.9.90"
|
|
@@ -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
|
|
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
|
-
|
|
203
|
-
|
|
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
|
|
@@ -42,7 +42,7 @@ def take(f, rows, cols=None, dtype=None, exclude=None,sep=None):
|
|
|
42
42
|
Negative indexing is not supported in cols because of variable length of each line.
|
|
43
43
|
If `cols=None`, returns a single str of line if one integer given, otherwise a list of lines.
|
|
44
44
|
If `cols` is int ot sequence of int, each line is splitted by `sep` (default all whitespaces) and `dtype` is applied over resulting fields.
|
|
45
|
-
`exclude` should be regex. It removes lines after selection by `rows`.
|
|
45
|
+
`exclude` should be regex. It removes matching lines after selection by `rows`. Empty lines are also discarded if `cols` is given.
|
|
46
46
|
|
|
47
47
|
Returns list (nested or plain) or single value or None based on `rows` and `cols` selection.
|
|
48
48
|
|
|
@@ -86,7 +86,7 @@ def take(f, rows, cols=None, dtype=None, exclude=None,sep=None):
|
|
|
86
86
|
if exclude:
|
|
87
87
|
lines = (l for l in lines if not re.search(exclude,l))
|
|
88
88
|
|
|
89
|
-
if cols:
|
|
89
|
+
if cols is not None:
|
|
90
90
|
conv = dtype if callable(dtype) else (lambda v: v)
|
|
91
91
|
return_col = False
|
|
92
92
|
if isinstance(cols, int):
|
|
@@ -96,6 +96,7 @@ def take(f, rows, cols=None, dtype=None, exclude=None,sep=None):
|
|
|
96
96
|
if not isinstance(cols, (list,tuple, range)):
|
|
97
97
|
raise TypeError(f"cols should be a sequce of integers or single int, got {type(cols)}")
|
|
98
98
|
|
|
99
|
+
lines = (l for l in lines if l.strip()) # remove empty lines after indexing and only if cols are given
|
|
99
100
|
lines = ([conv(v) for i, v in enumerate(l.split(sep)) if i in cols] for l in lines)
|
|
100
101
|
|
|
101
102
|
if return_col:
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.9.88"
|
|
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
|
|
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
|