ipyvasp 0.8.3__tar.gz → 0.8.4__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.8.3 → ipyvasp-0.8.4}/PKG-INFO +1 -1
  2. ipyvasp-0.8.4/ipyvasp/_version.py +1 -0
  3. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/ipyvasp/core/serializer.py +46 -2
  4. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/ipyvasp.egg-info/PKG-INFO +1 -1
  5. ipyvasp-0.8.3/ipyvasp/_version.py +0 -1
  6. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/LICENSE +0 -0
  7. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/README.md +0 -0
  8. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/ipyvasp/__init__.py +0 -0
  9. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/ipyvasp/__main__.py +0 -0
  10. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/ipyvasp/_enplots.py +0 -0
  11. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/ipyvasp/_lattice.py +0 -0
  12. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/ipyvasp/bsdos.py +0 -0
  13. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/ipyvasp/cli.py +0 -0
  14. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/ipyvasp/core/__init__.py +0 -0
  15. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/ipyvasp/core/parser.py +0 -0
  16. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/ipyvasp/core/plot_toolkit.py +0 -0
  17. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/ipyvasp/core/spatial_toolkit.py +0 -0
  18. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/ipyvasp/evals_dataframe.py +0 -0
  19. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/ipyvasp/lattice.py +0 -0
  20. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/ipyvasp/misc.py +0 -0
  21. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/ipyvasp/potential.py +0 -0
  22. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/ipyvasp/utils.py +0 -0
  23. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/ipyvasp/widgets.py +0 -0
  24. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/ipyvasp.egg-info/SOURCES.txt +0 -0
  25. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/ipyvasp.egg-info/dependency_links.txt +0 -0
  26. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/ipyvasp.egg-info/entry_points.txt +0 -0
  27. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/ipyvasp.egg-info/requires.txt +0 -0
  28. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/ipyvasp.egg-info/top_level.txt +0 -0
  29. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/setup.cfg +0 -0
  30. {ipyvasp-0.8.3 → ipyvasp-0.8.4}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ipyvasp
3
- Version: 0.8.3
3
+ Version: 0.8.4
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
@@ -0,0 +1 @@
1
+ __version__ = "0.8.4"
@@ -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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ipyvasp
3
- Version: 0.8.3
3
+ Version: 0.8.4
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
@@ -1 +0,0 @@
1
- __version__ = "0.8.3"
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