bandu 1.1.1__tar.gz → 1.3.0__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.
- {bandu-1.1.1/src/bandu.egg-info → bandu-1.3.0}/PKG-INFO +1 -1
- {bandu-1.1.1 → bandu-1.3.0}/pyproject.toml +1 -1
- {bandu-1.1.1 → bandu-1.3.0}/src/bandu/bandu.py +3 -3
- {bandu-1.1.1 → bandu-1.3.0}/src/bandu/isosurface_class.py +32 -25
- {bandu-1.1.1 → bandu-1.3.0}/src/bandu/wfk_class.py +33 -33
- {bandu-1.1.1 → bandu-1.3.0/src/bandu.egg-info}/PKG-INFO +1 -1
- {bandu-1.1.1 → bandu-1.3.0}/LICENSE +0 -0
- {bandu-1.1.1 → bandu-1.3.0}/README.md +0 -0
- {bandu-1.1.1 → bandu-1.3.0}/setup.cfg +0 -0
- {bandu-1.1.1 → bandu-1.3.0}/src/bandu/abinit_reader.py +0 -0
- {bandu-1.1.1 → bandu-1.3.0}/src/bandu/brillouin_zone.py +0 -0
- {bandu-1.1.1 → bandu-1.3.0}/src/bandu/colors.py +0 -0
- {bandu-1.1.1 → bandu-1.3.0}/src/bandu/plotter.py +0 -0
- {bandu-1.1.1 → bandu-1.3.0}/src/bandu/translate.py +0 -0
- {bandu-1.1.1 → bandu-1.3.0}/src/bandu/xsf_reader.py +0 -0
- {bandu-1.1.1 → bandu-1.3.0}/src/bandu.egg-info/SOURCES.txt +0 -0
- {bandu-1.1.1 → bandu-1.3.0}/src/bandu.egg-info/dependency_links.txt +0 -0
- {bandu-1.1.1 → bandu-1.3.0}/src/bandu.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bandu
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: The BandU program constructs a rank ordered series of crystal orbitals using principal component analysis. These principal orbital components can then be projected on the Fermi surface and visualized
|
|
5
5
|
Author-email: Patrick Cross <pcross@wisc.edu>
|
|
6
6
|
Project-URL: Homepage, https://github.com/pcross0405/BandU
|
|
@@ -123,7 +123,7 @@ class BandU():
|
|
|
123
123
|
if self.grid:
|
|
124
124
|
wfk = wfk.GridWFK()
|
|
125
125
|
if self.fft:
|
|
126
|
-
wfk = wfk.
|
|
126
|
+
wfk = wfk.IFFT()
|
|
127
127
|
if self.norm:
|
|
128
128
|
wfk = wfk.Normalize()
|
|
129
129
|
yield wfk
|
|
@@ -244,7 +244,7 @@ class BandU():
|
|
|
244
244
|
):
|
|
245
245
|
total_states = self.found_states
|
|
246
246
|
if nums is []:
|
|
247
|
-
nums = [
|
|
247
|
+
nums = [1,total_states]
|
|
248
248
|
else:
|
|
249
249
|
# check if list has only 2 elements
|
|
250
250
|
if len(nums) != 2:
|
|
@@ -268,6 +268,6 @@ class BandU():
|
|
|
268
268
|
for i in range(nums[0]-1, nums[1]):
|
|
269
269
|
file_name = xsf_name + f'_{i+1}'
|
|
270
270
|
wfk = copy(self.bandu_fxns[i])
|
|
271
|
-
wfk.wfk_coeffs = wfk.wfk_coeffs.reshape((
|
|
271
|
+
wfk.wfk_coeffs = wfk.wfk_coeffs.reshape((x,y,z))
|
|
272
272
|
wfk = wfk.XSFFormat()
|
|
273
273
|
wfk.WriteXSF(xsf_file=file_name)
|
|
@@ -42,6 +42,10 @@ class Isosurface():
|
|
|
42
42
|
Default 0.05, this scales inversely with kpoint grid size (larger grids require smaller radius)
|
|
43
43
|
sym_ops : np.ndarray
|
|
44
44
|
Array of symmetry operations for generating points in Brillouin Zone
|
|
45
|
+
grid_stretch : float
|
|
46
|
+
Value that stretches grid that is used to interpolate bands
|
|
47
|
+
If portions of Brillouin Zone are cropped off, increase this value
|
|
48
|
+
Default is 0.15
|
|
45
49
|
|
|
46
50
|
Methods
|
|
47
51
|
-------
|
|
@@ -51,7 +55,8 @@ class Isosurface():
|
|
|
51
55
|
def __init__(
|
|
52
56
|
self, points:np.ndarray=np.zeros(1), values:np.ndarray=np.zeros(1), rec_latt:np.ndarray=np.zeros(1),
|
|
53
57
|
wfk_name:str='', grid_steps:tuple=(50,50,50), fermi_energy:float=0.0, energy_level:float=0.0,
|
|
54
|
-
width:float=0.005, radius:float=0.05, nbands:list[int]=[], sym_ops:np.ndarray=np.zeros(1),
|
|
58
|
+
width:float=0.005, radius:float=0.05, nbands:list[int]=[], sym_ops:np.ndarray=np.zeros(1),
|
|
59
|
+
grid_stretch:float=0.15
|
|
55
60
|
)->None:
|
|
56
61
|
# define attributes
|
|
57
62
|
self.points=points
|
|
@@ -64,9 +69,9 @@ class Isosurface():
|
|
|
64
69
|
self.radius=radius
|
|
65
70
|
self.nbands=nbands
|
|
66
71
|
self.sym_ops=sym_ops
|
|
67
|
-
self.
|
|
72
|
+
self.grid_stretch=grid_stretch
|
|
68
73
|
# check if enough information is provided to class to construct isosurfaces
|
|
69
|
-
if self.points.
|
|
74
|
+
if self.points.shape == (1,) and self.values.shape == (1,):
|
|
70
75
|
if wfk_name == '':
|
|
71
76
|
raise ValueError((
|
|
72
77
|
'Either the points and the values attributes must be defined or the wfk_name attribute '
|
|
@@ -126,8 +131,18 @@ class Isosurface():
|
|
|
126
131
|
dimy = self.grid_steps[1]
|
|
127
132
|
dimz = self.grid_steps[2]
|
|
128
133
|
grid = pv.ImageData()
|
|
129
|
-
|
|
130
|
-
|
|
134
|
+
stretch_factor = self.grid_stretch
|
|
135
|
+
dim_stretch = [2*stretch_factor/dim for dim in self.grid_steps]
|
|
136
|
+
grid.origin = (
|
|
137
|
+
xmin - 0.5*stretch_factor,
|
|
138
|
+
ymin - 0.5*stretch_factor,
|
|
139
|
+
zmin - 0.5*stretch_factor
|
|
140
|
+
)
|
|
141
|
+
grid.spacing = (
|
|
142
|
+
2*xmax/dimx + dim_stretch[0],
|
|
143
|
+
2*ymax/dimy + dim_stretch[1],
|
|
144
|
+
2*zmax/dimz + dim_stretch[2]
|
|
145
|
+
)
|
|
131
146
|
grid.dimensions = (dimx, dimy, dimz)
|
|
132
147
|
return grid
|
|
133
148
|
#-----------------------------------------------------------------------------------------------------------------#
|
|
@@ -185,22 +200,18 @@ class Isosurface():
|
|
|
185
200
|
nkpt = wfk.nkpt
|
|
186
201
|
self.fermi_energy = wfk.fermi
|
|
187
202
|
self.rec_latt = wc.WFK(lattice=wfk.real_lattice).Real2Reciprocal()
|
|
188
|
-
|
|
189
|
-
eigs
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
for eigval in eigs[:,i]:
|
|
201
|
-
if min_val <= eigval <= max_val:
|
|
202
|
-
band_num.append(i)
|
|
203
|
-
break
|
|
203
|
+
for wfk_obj in wfk.ReadEigenvalues():
|
|
204
|
+
eigs.append(wfk_obj.eigenvalues)
|
|
205
|
+
eigs = np.array(eigs).reshape((nkpt,nbands))
|
|
206
|
+
# look through eigenvalues to find which bands to contour
|
|
207
|
+
min_val = self.fermi_energy + self.energy_level - self.width/2
|
|
208
|
+
max_val = self.fermi_energy + self.energy_level + self.width/2
|
|
209
|
+
band_num = []
|
|
210
|
+
for i in range(nbands):
|
|
211
|
+
for eigval in eigs[:,i]:
|
|
212
|
+
if min_val <= eigval <= max_val:
|
|
213
|
+
band_num.append(i)
|
|
214
|
+
break
|
|
204
215
|
# return kpoints and bands of interest
|
|
205
216
|
bands = np.take(eigs, band_num, axis=1)
|
|
206
217
|
shifts = brlzn.BZ(self.rec_latt).GetShifts(kpoints)
|
|
@@ -222,8 +233,4 @@ class Isosurface():
|
|
|
222
233
|
kpoints = np.delete(all_kpts, 0, axis=0)
|
|
223
234
|
bands = np.delete(all_eigs, 0, axis=0)
|
|
224
235
|
kpoints = np.matmul(kpoints, self.rec_latt)
|
|
225
|
-
if self._debug:
|
|
226
|
-
print(kpoints.shape)
|
|
227
|
-
print(bands.shape)
|
|
228
|
-
raise SystemExit()
|
|
229
236
|
return kpoints, bands, band_num, ir_kpts
|
|
@@ -138,16 +138,16 @@ class WFK():
|
|
|
138
138
|
If nothing is passed, it is assumed the coefficients of a single band are supplied.
|
|
139
139
|
'''
|
|
140
140
|
# initialize 3D grid
|
|
141
|
-
gridded_wfk = np.zeros((self.
|
|
141
|
+
gridded_wfk = np.zeros((self.ngfftx, self.ngffty, self.ngfftz), dtype=complex)
|
|
142
142
|
# update grid with wfk coefficients
|
|
143
143
|
for k, kpt in enumerate(self.pw_indices):
|
|
144
144
|
kx = kpt[0]
|
|
145
145
|
ky = kpt[1]
|
|
146
146
|
kz = kpt[2]
|
|
147
147
|
if band_index >= 0:
|
|
148
|
-
gridded_wfk[
|
|
148
|
+
gridded_wfk[kx, ky, kz] = self.wfk_coeffs[band_index][k]
|
|
149
149
|
else:
|
|
150
|
-
gridded_wfk[
|
|
150
|
+
gridded_wfk[kx, ky, kz] = self.wfk_coeffs[k]
|
|
151
151
|
new_WFK = copy(self)
|
|
152
152
|
new_WFK.wfk_coeffs = gridded_wfk
|
|
153
153
|
return new_WFK
|
|
@@ -166,9 +166,9 @@ class WFK():
|
|
|
166
166
|
If nothing is passed, it is assumed the coefficients of a single band are supplied.
|
|
167
167
|
'''
|
|
168
168
|
# check if coefficients are gridded before undoing grid format
|
|
169
|
-
if self.wfk_coeffs.shape != (self.
|
|
169
|
+
if self.wfk_coeffs.shape != (self.ngfftx,self.ngffty,self.ngfftz):
|
|
170
170
|
raise ValueError((
|
|
171
|
-
f'Plane wave coefficients must be in 3D grid with shape ({self.
|
|
171
|
+
f'Plane wave coefficients must be in 3D grid with shape ({self.ngfftx}, {self.ngffty}, {self.ngfftz})'
|
|
172
172
|
' in order to remove the gridded format'
|
|
173
173
|
))
|
|
174
174
|
if band_index >= 0:
|
|
@@ -192,7 +192,7 @@ class WFK():
|
|
|
192
192
|
# Fourier transform reciprocal grid to real space grid
|
|
193
193
|
real_coeffs = fftn(self.wfk_coeffs, norm='ortho')
|
|
194
194
|
new_WFK = copy(self)
|
|
195
|
-
new_WFK.wfk_coeffs = np.array(real_coeffs).reshape((self.
|
|
195
|
+
new_WFK.wfk_coeffs = np.array(real_coeffs).reshape((self.ngfftx, self.ngffty, self.ngfftz))
|
|
196
196
|
return new_WFK
|
|
197
197
|
#-----------------------------------------------------------------------------------------------------------------#
|
|
198
198
|
# method transforming real space wfks to reciprocal space
|
|
@@ -206,7 +206,7 @@ class WFK():
|
|
|
206
206
|
# Fourier transform real space grid to reciprocal space grid
|
|
207
207
|
reciprocal_coeffs = ifftn(self.wfk_coeffs, norm='ortho')
|
|
208
208
|
new_WFK = copy(self)
|
|
209
|
-
new_WFK.wfk_coeffs = reciprocal_coeffs
|
|
209
|
+
new_WFK.wfk_coeffs = np.array(reciprocal_coeffs).reshape((self.ngfftx,self.ngffty,self.ngfftz))
|
|
210
210
|
return new_WFK
|
|
211
211
|
#-----------------------------------------------------------------------------------------------------------------#
|
|
212
212
|
# method for normalizing wfks
|
|
@@ -430,34 +430,34 @@ class WFK():
|
|
|
430
430
|
# append zeros to ends of all axes in grid_wfk
|
|
431
431
|
# zeros get replaced by values at beginning of each axis
|
|
432
432
|
# this repetition is required by XSF format
|
|
433
|
-
if np.shape(self.wfk_coeffs) != (self.
|
|
433
|
+
if np.shape(self.wfk_coeffs) != (self.ngfftx, self.ngffty, self.ngfftz):
|
|
434
434
|
raise ValueError(
|
|
435
435
|
f'''Passed array is not the correct shape:
|
|
436
|
-
Expected: ({self.
|
|
436
|
+
Expected: ({self.ngfftx}, {self.ngffty}, {self.ngfftz}),
|
|
437
437
|
Received: {np.shape(self.wfk_coeffs)}
|
|
438
438
|
''')
|
|
439
439
|
else:
|
|
440
440
|
grid_wfk = self.wfk_coeffs
|
|
441
|
-
grid_wfk = np.append(grid_wfk, np.zeros((1, self.
|
|
442
|
-
grid_wfk = np.append(grid_wfk, np.zeros((self.
|
|
443
|
-
grid_wfk = np.append(grid_wfk, np.zeros((self.
|
|
441
|
+
grid_wfk = np.append(grid_wfk, np.zeros((1, self.ngffty, self.ngfftz)), axis=0)
|
|
442
|
+
grid_wfk = np.append(grid_wfk, np.zeros((self.ngfftx+1, 1, self.ngfftz)), axis=1)
|
|
443
|
+
grid_wfk = np.append(grid_wfk, np.zeros((self.ngfftx+1, self.ngffty+1, 1)), axis=2)
|
|
444
444
|
for x in range(self.ngfftx+1):
|
|
445
445
|
for y in range(self.ngffty+1):
|
|
446
446
|
for z in range(self.ngfftz+1):
|
|
447
447
|
if x == self.ngfftx:
|
|
448
|
-
grid_wfk[
|
|
448
|
+
grid_wfk[x,y,z] = grid_wfk[0,y,z]
|
|
449
449
|
if y == self.ngffty:
|
|
450
|
-
grid_wfk[
|
|
450
|
+
grid_wfk[x,y,z] = grid_wfk[x,0,z]
|
|
451
451
|
if z == self.ngfftz:
|
|
452
|
-
grid_wfk[
|
|
452
|
+
grid_wfk[x,y,z] = grid_wfk[x,y,0]
|
|
453
453
|
if x == self.ngfftx and y == self.ngffty:
|
|
454
|
-
grid_wfk[
|
|
454
|
+
grid_wfk[x,y,z] = grid_wfk[0,0,z]
|
|
455
455
|
if x == self.ngfftx and z == self.ngfftz:
|
|
456
|
-
grid_wfk[
|
|
456
|
+
grid_wfk[x,y,z] = grid_wfk[0,y,0]
|
|
457
457
|
if z == self.ngfftz and y == self.ngffty:
|
|
458
|
-
grid_wfk[
|
|
458
|
+
grid_wfk[x,y,z] = grid_wfk[x,0,0]
|
|
459
459
|
if x == self.ngfftx and y == self.ngffty and z == self.ngfftz:
|
|
460
|
-
grid_wfk[
|
|
460
|
+
grid_wfk[x,y,z] = grid_wfk[0,0,0]
|
|
461
461
|
new_WFK = copy(self)
|
|
462
462
|
new_WFK.wfk_coeffs = grid_wfk
|
|
463
463
|
new_WFK.ngfftx += 1
|
|
@@ -474,18 +474,18 @@ class WFK():
|
|
|
474
474
|
'''
|
|
475
475
|
grid = self.wfk_coeffs
|
|
476
476
|
# to_be_del will be used to remove all extra data points added for XSF formatting
|
|
477
|
-
to_be_del = np.ones((self.
|
|
477
|
+
to_be_del = np.ones((self.ngfftx, self.ngffty, self.ngfftz), dtype=bool)
|
|
478
478
|
for z in range(self.ngfftz):
|
|
479
|
-
for
|
|
480
|
-
for
|
|
479
|
+
for y in range(self.ngffty):
|
|
480
|
+
for x in range(self.ngfftx):
|
|
481
481
|
# any time you reach the last density point it is a repeat of the first point
|
|
482
482
|
# remove the end points along each axis
|
|
483
483
|
if y == self.ngffty - 1 or x == self.ngfftx - 1 or z == self.ngfftz - 1:
|
|
484
|
-
to_be_del[
|
|
484
|
+
to_be_del[x,y,z] = False
|
|
485
485
|
# remove xsf entries from array
|
|
486
486
|
grid = grid[to_be_del]
|
|
487
487
|
# restore grid shape
|
|
488
|
-
grid = grid.reshape((self.
|
|
488
|
+
grid = grid.reshape((self.ngfftx-1, self.ngffty-1, self.ngfftz-1))
|
|
489
489
|
new_WFK = copy(self)
|
|
490
490
|
new_WFK.wfk_coeffs = grid
|
|
491
491
|
new_WFK.ngfftx -= 1
|
|
@@ -522,16 +522,16 @@ class WFK():
|
|
|
522
522
|
print(f'{self.natom} 1', file=xsf)
|
|
523
523
|
for i, coord in enumerate(self.xred):
|
|
524
524
|
atomic_num = int(self.znucltypat[self.typat[i] - 1])
|
|
525
|
-
cart_coord = np.
|
|
525
|
+
cart_coord = np.matmul(coord, self.lattice)
|
|
526
526
|
print(f'{atomic_num} {cart_coord[0]} {cart_coord[1]} {cart_coord[2]}', file=xsf)
|
|
527
527
|
print('ATOMS', file=xsf)
|
|
528
528
|
for i, coord in enumerate(self.xred):
|
|
529
529
|
atomic_num = int(self.znucltypat[self.typat[i] - 1])
|
|
530
|
-
cart_coord = np.
|
|
530
|
+
cart_coord = np.matmul(coord, self.lattice)
|
|
531
531
|
print(f'{atomic_num} {cart_coord[0]} {cart_coord[1]} {cart_coord[2]}', file=xsf)
|
|
532
|
-
print('
|
|
532
|
+
print('BEGIN_BLOCK_DATAGRID_3D', file=xsf)
|
|
533
533
|
print('datagrids', file=xsf)
|
|
534
|
-
print('
|
|
534
|
+
print('BEGIN_DATAGRID_3D_principal_orbital_component', file=xsf)
|
|
535
535
|
print(f'{self.ngfftx} {self.ngffty} {self.ngfftz}', file=xsf)
|
|
536
536
|
print('0.0 0.0 0.0', file=xsf)
|
|
537
537
|
print(f'{self.lattice[0,0]} {self.lattice[0,1]} {self.lattice[0,2]}', file=xsf)
|
|
@@ -539,18 +539,18 @@ class WFK():
|
|
|
539
539
|
print(f'{self.lattice[2,0]} {self.lattice[2,1]} {self.lattice[2,2]}', file=xsf)
|
|
540
540
|
count = 0
|
|
541
541
|
for z in range(self.ngfftz):
|
|
542
|
-
for
|
|
543
|
-
for
|
|
542
|
+
for y in range(self.ngffty):
|
|
543
|
+
for x in range(self.ngfftx):
|
|
544
544
|
count += 1
|
|
545
545
|
if _component:
|
|
546
|
-
print(self.wfk_coeffs[
|
|
546
|
+
print(self.wfk_coeffs[x,y,z].real, file=xsf, end=' ')
|
|
547
547
|
else:
|
|
548
|
-
print(self.wfk_coeffs[
|
|
548
|
+
print(self.wfk_coeffs[x,y,z].imag, file=xsf, end=' ')
|
|
549
549
|
if count == 6:
|
|
550
550
|
count = 0
|
|
551
551
|
print('\n', file=xsf, end='')
|
|
552
552
|
print('END_DATAGRID_3D', file=xsf)
|
|
553
|
-
print('
|
|
553
|
+
print('END_BLOCK_DATAGRID_3D', file=xsf)
|
|
554
554
|
# rerun method to write out imaginary part
|
|
555
555
|
if _component:
|
|
556
556
|
xsf_file = xsf_file.split('_real')[0]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bandu
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: The BandU program constructs a rank ordered series of crystal orbitals using principal component analysis. These principal orbital components can then be projected on the Fermi surface and visualized
|
|
5
5
|
Author-email: Patrick Cross <pcross@wisc.edu>
|
|
6
6
|
Project-URL: Homepage, https://github.com/pcross0405/BandU
|
|
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
|