bandu 1.2.0__py3-none-any.whl → 1.3.0__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.
bandu/bandu.py CHANGED
@@ -123,7 +123,7 @@ class BandU():
123
123
  if self.grid:
124
124
  wfk = wfk.GridWFK()
125
125
  if self.fft:
126
- wfk = wfk.FFT()
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 = [0,total_states-1]
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((z,y,x))
271
+ wfk.wfk_coeffs = wfk.wfk_coeffs.reshape((x,y,z))
272
272
  wfk = wfk.XSFFormat()
273
273
  wfk.WriteXSF(xsf_file=file_name)
bandu/wfk_class.py CHANGED
@@ -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.ngfftz, self.ngffty, self.ngfftx), dtype=complex)
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[kz, ky, kx] = self.wfk_coeffs[band_index][k]
148
+ gridded_wfk[kx, ky, kz] = self.wfk_coeffs[band_index][k]
149
149
  else:
150
- gridded_wfk[kz, ky, kx] = self.wfk_coeffs[k]
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.ngfftz,self.ngffty,self.ngfftx):
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.ngfftz}, {self.ngffty}, {self.ngfftx})'
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.ngfftz, self.ngffty, self.ngfftx))
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 = np.array(reciprocal_coeffs).reshape((self.ngfftz,self.ngffty,self.ngfftx))
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.ngfftz, self.ngffty, self.ngfftx):
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.ngfftz}, {self.ngffty}, {self.ngfftx}),
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.ngffty, self.ngfftx)), axis=0)
442
- grid_wfk = np.append(grid_wfk, np.zeros((self.ngfftz+1, 1, self.ngfftx)), axis=1)
443
- grid_wfk = np.append(grid_wfk, np.zeros((self.ngfftz+1, self.ngffty+1, 1)), axis=2)
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[z][y][x] = grid_wfk[z][y][0]
448
+ grid_wfk[x,y,z] = grid_wfk[0,y,z]
449
449
  if y == self.ngffty:
450
- grid_wfk[z][y][x] = grid_wfk[z][0][x]
450
+ grid_wfk[x,y,z] = grid_wfk[x,0,z]
451
451
  if z == self.ngfftz:
452
- grid_wfk[z][y][x] = grid_wfk[0][x][y]
452
+ grid_wfk[x,y,z] = grid_wfk[x,y,0]
453
453
  if x == self.ngfftx and y == self.ngffty:
454
- grid_wfk[z][y][x] = grid_wfk[z][0][0]
454
+ grid_wfk[x,y,z] = grid_wfk[0,0,z]
455
455
  if x == self.ngfftx and z == self.ngfftz:
456
- grid_wfk[z][y][x] = grid_wfk[0][y][0]
456
+ grid_wfk[x,y,z] = grid_wfk[0,y,0]
457
457
  if z == self.ngfftz and y == self.ngffty:
458
- grid_wfk[z][y][x] = grid_wfk[0][0][x]
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[z][y][x] = grid_wfk[0][0][0]
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.ngfftz, self.ngfftx, self.ngffty), dtype=bool)
477
+ to_be_del = np.ones((self.ngfftx, self.ngffty, self.ngfftz), dtype=bool)
478
478
  for z in range(self.ngfftz):
479
- for x in range(self.ngffty):
480
- for y in range(self.ngfftx):
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[z,y,x] = False
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.ngfftz-1, self.ngffty-1, self.ngfftx-1))
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.dot(coord, self.lattice)
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.dot(coord, self.lattice)
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('BEGIN_BLOCK_DATAGRID3D', file=xsf)
532
+ print('BEGIN_BLOCK_DATAGRID_3D', file=xsf)
533
533
  print('datagrids', file=xsf)
534
- print('DATAGRID_3D_DENSITY', file=xsf)
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)
@@ -543,14 +543,14 @@ class WFK():
543
543
  for x in range(self.ngfftx):
544
544
  count += 1
545
545
  if _component:
546
- print(self.wfk_coeffs[z,y,x].real, file=xsf, end=' ')
546
+ print(self.wfk_coeffs[x,y,z].real, file=xsf, end=' ')
547
547
  else:
548
- print(self.wfk_coeffs[z,y,x].imag, file=xsf, end=' ')
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('END_BLOCK_DATAGRID3D', file=xsf)
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.2.0
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
@@ -1,14 +1,14 @@
1
1
  bandu/abinit_reader.py,sha256=U4HUUTnju9MpyGtWMOedUQLln90k2F0XIv0Q0zcP05c,47704
2
- bandu/bandu.py,sha256=-gahVb8Eqx33RzcbYngzjDHmbMib6grRXEQE_fTgLWg,12786
2
+ bandu/bandu.py,sha256=1B7FZb3eYNm9JhPzEwZoGCAUNZpPD9Oux79eVCwSopE,12785
3
3
  bandu/brillouin_zone.py,sha256=-SarCuvUthk5h_sFHM6KDHLns1eCWGk_v5fHngWFu08,7997
4
4
  bandu/colors.py,sha256=OcIBwVh9ieu04n1cruRgyoYslKsdfJKf-u4oWMd3CwQ,2316
5
5
  bandu/isosurface_class.py,sha256=M6XAuy89uyX3v_JX3wYd5VqAWel9JiMQ7wRBhFhhn3A,10236
6
6
  bandu/plotter.py,sha256=wSIA1TpwhioPUHpBe4_gc14e8K98fv3q0LwwD5NLboo,27725
7
7
  bandu/translate.py,sha256=YGTkwne4bdrw649OjRKBio7IBsCNVoa__rjkFZK6uRI,2217
8
- bandu/wfk_class.py,sha256=QchfEjqssSHbC3IcXrKNz3euFLR62WMj-ZPFd2m0mX0,26215
8
+ bandu/wfk_class.py,sha256=ANpGtdB5DUJsUjs9804t6Vmoh5wtWGmAzelE-b57pWo,26221
9
9
  bandu/xsf_reader.py,sha256=gfv7LsTofWw4PrcOeqltOREJD6RLDq8CeFSsnlfohEw,4778
10
- bandu-1.2.0.dist-info/licenses/LICENSE,sha256=jk_B-WYDiyH9RtxC45pO6JUtBxmfX5i240dVzv1okCg,1088
11
- bandu-1.2.0.dist-info/METADATA,sha256=abHRtBrAvc6Vos3f5SwcvdOilNA4pu90mEVhK3nxapU,8945
12
- bandu-1.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
13
- bandu-1.2.0.dist-info/top_level.txt,sha256=AxbMFU3BRdjCr75K9gAdblwlBMQ3qr9-AaCC-IS8OWs,6
14
- bandu-1.2.0.dist-info/RECORD,,
10
+ bandu-1.3.0.dist-info/licenses/LICENSE,sha256=jk_B-WYDiyH9RtxC45pO6JUtBxmfX5i240dVzv1okCg,1088
11
+ bandu-1.3.0.dist-info/METADATA,sha256=WivTIcB4CKkcOc5PySUPPT5f2RxhComT_qRhf2O_0fs,8945
12
+ bandu-1.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
13
+ bandu-1.3.0.dist-info/top_level.txt,sha256=AxbMFU3BRdjCr75K9gAdblwlBMQ3qr9-AaCC-IS8OWs,6
14
+ bandu-1.3.0.dist-info/RECORD,,
File without changes