ipyvasp 0.8.2__py2.py3-none-any.whl → 0.8.4__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/_lattice.py +3 -3
- ipyvasp/_version.py +1 -1
- ipyvasp/core/serializer.py +46 -2
- {ipyvasp-0.8.2.dist-info → ipyvasp-0.8.4.dist-info}/METADATA +1 -1
- {ipyvasp-0.8.2.dist-info → ipyvasp-0.8.4.dist-info}/RECORD +9 -9
- {ipyvasp-0.8.2.dist-info → ipyvasp-0.8.4.dist-info}/LICENSE +0 -0
- {ipyvasp-0.8.2.dist-info → ipyvasp-0.8.4.dist-info}/WHEEL +0 -0
- {ipyvasp-0.8.2.dist-info → ipyvasp-0.8.4.dist-info}/entry_points.txt +0 -0
- {ipyvasp-0.8.2.dist-info → ipyvasp-0.8.4.dist-info}/top_level.txt +0 -0
ipyvasp/_lattice.py
CHANGED
|
@@ -1753,12 +1753,12 @@ def iplot_lattice(
|
|
|
1753
1753
|
clabs = [unqc.index(c) for c in colors_n] # few colors categories
|
|
1754
1754
|
corder = np.argsort(clabs) # coordinates order for those categories
|
|
1755
1755
|
|
|
1756
|
-
groups =
|
|
1756
|
+
groups = dict([(i,[]) for i in range(len(unqc))])
|
|
1757
1757
|
for co in corder:
|
|
1758
1758
|
groups[clabs[co]].append(coords_n[co])
|
|
1759
|
-
groups[clabs[co]].append([[np.nan, np.nan, np.nan]])
|
|
1759
|
+
groups[clabs[co]].append([[np.nan, np.nan, np.nan]]) # nan to break links outside bonds
|
|
1760
1760
|
|
|
1761
|
-
for i in range(
|
|
1761
|
+
for i in range(len(unqc)):
|
|
1762
1762
|
groups[i] = np.concatenate(groups[i], axis=0)
|
|
1763
1763
|
|
|
1764
1764
|
bond_kws = {"line_width": 4, **bond_kws}
|
ipyvasp/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.8.
|
|
1
|
+
__version__ = "0.8.4"
|
ipyvasp/core/serializer.py
CHANGED
|
@@ -12,11 +12,12 @@ import json, re
|
|
|
12
12
|
import pickle
|
|
13
13
|
import inspect
|
|
14
14
|
from collections import namedtuple
|
|
15
|
-
from itertools import product
|
|
15
|
+
from itertools import product,combinations
|
|
16
16
|
from copy import deepcopy
|
|
17
17
|
from pathlib import Path
|
|
18
18
|
|
|
19
19
|
import numpy as np
|
|
20
|
+
from pandas import DataFrame
|
|
20
21
|
from scipy.spatial import KDTree
|
|
21
22
|
|
|
22
23
|
from .spatial_toolkit import (
|
|
@@ -352,7 +353,6 @@ class PoscarData(Dict2Data):
|
|
|
352
353
|
tree = KDTree(cs)
|
|
353
354
|
_, inn = tree.query(cs, k=k)
|
|
354
355
|
output = (inn % N)[:N] # to get the index of the atom in the original list
|
|
355
|
-
output[:,1:] = np.sort(output[:,1:], axis=1) # sort the indices of neighbors
|
|
356
356
|
return output
|
|
357
357
|
|
|
358
358
|
get_knn = get_neighbors # important alias
|
|
@@ -402,6 +402,50 @@ class PoscarData(Dict2Data):
|
|
|
402
402
|
dists = dists[dists > 0] # Remove distance with itself
|
|
403
403
|
return np.min(dists) if dists.size else np.nan
|
|
404
404
|
|
|
405
|
+
|
|
406
|
+
def get_distances(self, type1, type2, min=-np.infty, max=np.infty):
|
|
407
|
+
"""Get an array of all distnaces in a range set by min and max between type 1 and type2.
|
|
408
|
+
For example `get_distances('Ga','As',2,3)[:,-1].mean()` can be used to get average bond length between Ga and As in GaAs.
|
|
409
|
+
Returned array is of shape (N,3) where first two entries in columns are indices of pairs between which distance was calculated.
|
|
410
|
+
"""
|
|
411
|
+
out = []
|
|
412
|
+
for i in self.types[type1]:
|
|
413
|
+
for j in [k for k in self.types[type2] if k != i]:
|
|
414
|
+
a = self.coords[i]
|
|
415
|
+
bs = [self.to_cartesian(self.positions[j] + p) for p in set(product([-1,0,1],[-1,0,1],[-1,0,1]))]
|
|
416
|
+
ds = np.array([np.linalg.norm(a-b) for b in bs])
|
|
417
|
+
d = ds[ds > 0].min() # no same site distance
|
|
418
|
+
if min < d < max:
|
|
419
|
+
out.append([i, j, d])
|
|
420
|
+
out = np.array(out,dtype=object)
|
|
421
|
+
return out[out[:,-1].argsort()] if out.size else out
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
def get_bond_data(self, site_indices, k = 5):
|
|
425
|
+
"Returns a DataFrame with bonds angle, bond length, vector positions etc. that can be used for plotting."
|
|
426
|
+
if k < 3:
|
|
427
|
+
raise ValueError("k >= 3 is required!")
|
|
428
|
+
|
|
429
|
+
idxs = self.get_knn(k)[list(site_indices)]
|
|
430
|
+
out = []
|
|
431
|
+
for i, *js in idxs:
|
|
432
|
+
a = self.coords[i]
|
|
433
|
+
nears = [] # neaigbors could be on other side, bring close
|
|
434
|
+
for j in js:
|
|
435
|
+
bs = np.array([self.to_cartesian(self.positions[j] + p) for p in product([-1,0,1],[-1,0,1],[-1,0,1])])
|
|
436
|
+
ds = np.array([np.linalg.norm(a-b) for b in bs])
|
|
437
|
+
nears.append((j, bs[ds.argsort()][0]))
|
|
438
|
+
|
|
439
|
+
for (m,b),(n, c) in combinations(nears,2):
|
|
440
|
+
v1, v2 = b-a, c-a
|
|
441
|
+
n1, n2 = np.linalg.norm(v1), np.linalg.norm(v2)
|
|
442
|
+
name = '-'.join(self.symbols[[m,i,n]])
|
|
443
|
+
angle = np.degrees(np.arccos(v1.dot(v2)/(n1*n2)))
|
|
444
|
+
out.append([name, m,i,n, angle, n1, n2, *b, *a, *c])
|
|
445
|
+
|
|
446
|
+
columns = 'bond a o b angle d_ao d_bo ax ay az ox oy oz bx by bz'.split()
|
|
447
|
+
return DataFrame(out, columns=columns)
|
|
448
|
+
|
|
405
449
|
def to_fractional(self, coords):
|
|
406
450
|
"Converts cartesian coordinates to fractional coordinates in the basis of cell."
|
|
407
451
|
return to_basis(self.basis, coords)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
ipyvasp/__init__.py,sha256=7o41i5eYlNKg1Hsv0DLNFZ81GilxB02IXAJN-QiJQi0,1420
|
|
2
2
|
ipyvasp/__main__.py,sha256=eJV1TZSiT8mC_VqAeksNnBI2I8mKMiPkEIlwikbtOjI,216
|
|
3
3
|
ipyvasp/_enplots.py,sha256=D38paN8zqZgluNAwmCwcocd7-_h_T0HTGolI1eBkDes,37484
|
|
4
|
-
ipyvasp/_lattice.py,sha256=
|
|
5
|
-
ipyvasp/_version.py,sha256=
|
|
4
|
+
ipyvasp/_lattice.py,sha256=GlSoBwS_LckiZIArtZ3CbFfktG29oBqEAZtLHwYtzak,104390
|
|
5
|
+
ipyvasp/_version.py,sha256=xN6PfPY25p649J9o3dNFb_Eo4-lIyF4ED9Z8avJ_oLw,23
|
|
6
6
|
ipyvasp/bsdos.py,sha256=ZtQji-W11UdFFicAoWZjlqVhI5tqYu_jpKyPPWKkeeo,30634
|
|
7
7
|
ipyvasp/cli.py,sha256=aWFEVhNmnW8eSOp5uh95JaDwLQ9K9nlCQcbnOSuhWgw,6844
|
|
8
8
|
ipyvasp/evals_dataframe.py,sha256=-sqxK7LPV6sYDO_XXmZ80FznOaXTkVdbqJKKvTUtMak,20637
|
|
@@ -15,11 +15,11 @@ ipyvasp/widgets.py,sha256=fZ2b7EYYxuaAVfklnLa0VJ00U9Uyd7SqXrzt0hbLOvI,45400
|
|
|
15
15
|
ipyvasp/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
ipyvasp/core/parser.py,sha256=C3CaZsJbPME_ttYlYy4DXeOdL7dnkXs-cHRwFZL6bio,38058
|
|
17
17
|
ipyvasp/core/plot_toolkit.py,sha256=cktbPZTJ4K0_6-vKYqtQ1xIIPZg-gHJY5793M9XoYQ0,35754
|
|
18
|
-
ipyvasp/core/serializer.py,sha256=
|
|
18
|
+
ipyvasp/core/serializer.py,sha256=OsnYhlwt8O6UeJQMKmjp1-hwRjhxiqobV6bybfDECUY,35777
|
|
19
19
|
ipyvasp/core/spatial_toolkit.py,sha256=8DBYTiBFWJ7OBKuvOPw7UoEVCyNjJhSW0OcudjYZvAw,14748
|
|
20
|
-
ipyvasp-0.8.
|
|
21
|
-
ipyvasp-0.8.
|
|
22
|
-
ipyvasp-0.8.
|
|
23
|
-
ipyvasp-0.8.
|
|
24
|
-
ipyvasp-0.8.
|
|
25
|
-
ipyvasp-0.8.
|
|
20
|
+
ipyvasp-0.8.4.dist-info/LICENSE,sha256=F3SO5RiAZOMfmMGf1KOuk2g_c4ObvuBJhd9iBLDgXoQ,1263
|
|
21
|
+
ipyvasp-0.8.4.dist-info/METADATA,sha256=kqxdZoEwpufVzOboGCLzNj_Q9y0I8cjcbWLz-FtSl-Q,2436
|
|
22
|
+
ipyvasp-0.8.4.dist-info/WHEEL,sha256=iYlv5fX357PQyRT2o6tw1bN-YcKFFHKqB_LwHO5wP-g,110
|
|
23
|
+
ipyvasp-0.8.4.dist-info/entry_points.txt,sha256=C7m0Sjmr14wFjflCkWXLzr5N6-cQj8uJC9n82mUtzt8,44
|
|
24
|
+
ipyvasp-0.8.4.dist-info/top_level.txt,sha256=ftziWlMWu_1VpDP1sRTFrkfBnWxAi393HYDVu4wRhUk,8
|
|
25
|
+
ipyvasp-0.8.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|