bandu 1.3.2__tar.gz → 1.3.3__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.3.2/src/bandu.egg-info → bandu-1.3.3}/PKG-INFO +1 -1
- {bandu-1.3.2 → bandu-1.3.3}/pyproject.toml +1 -1
- {bandu-1.3.2 → bandu-1.3.3}/src/bandu/bandu.py +45 -4
- {bandu-1.3.2 → bandu-1.3.3}/src/bandu/xsf_reader.py +14 -7
- {bandu-1.3.2 → bandu-1.3.3/src/bandu.egg-info}/PKG-INFO +1 -1
- {bandu-1.3.2 → bandu-1.3.3}/LICENSE +0 -0
- {bandu-1.3.2 → bandu-1.3.3}/README.md +0 -0
- {bandu-1.3.2 → bandu-1.3.3}/setup.cfg +0 -0
- {bandu-1.3.2 → bandu-1.3.3}/src/bandu/abinit_reader.py +0 -0
- {bandu-1.3.2 → bandu-1.3.3}/src/bandu/brillouin_zone.py +0 -0
- {bandu-1.3.2 → bandu-1.3.3}/src/bandu/colors.py +0 -0
- {bandu-1.3.2 → bandu-1.3.3}/src/bandu/isosurface_class.py +0 -0
- {bandu-1.3.2 → bandu-1.3.3}/src/bandu/plotter.py +0 -0
- {bandu-1.3.2 → bandu-1.3.3}/src/bandu/translate.py +0 -0
- {bandu-1.3.2 → bandu-1.3.3}/src/bandu/wfk_class.py +0 -0
- {bandu-1.3.2 → bandu-1.3.3}/src/bandu.egg-info/SOURCES.txt +0 -0
- {bandu-1.3.2 → bandu-1.3.3}/src/bandu.egg-info/dependency_links.txt +0 -0
- {bandu-1.3.2 → bandu-1.3.3}/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.
|
|
3
|
+
Version: 1.3.3
|
|
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
|
|
@@ -8,7 +8,7 @@ from . import wfk_class as wc
|
|
|
8
8
|
class BandU():
|
|
9
9
|
def __init__(
|
|
10
10
|
self, wfks:Generator, energy_level:float, width:float, grid:bool=True, fft:bool=True, norm:bool=True,
|
|
11
|
-
sym:bool=True, low_mem:bool=False, plot:bool=True
|
|
11
|
+
sym:bool=True, low_mem:bool=False, plot:bool=True, real_imag_sep:bool=True
|
|
12
12
|
)->None:
|
|
13
13
|
'''
|
|
14
14
|
BandU object with methods for finding states and computing BandU functions from states.
|
|
@@ -56,7 +56,10 @@ class BandU():
|
|
|
56
56
|
self._FindStates(energy_level, width, wfks)
|
|
57
57
|
print(f'{self.found_states} states found within specified energy range')
|
|
58
58
|
# construct principal orbital components
|
|
59
|
-
|
|
59
|
+
if real_imag_sep:
|
|
60
|
+
principal_vals = self._RealImagPrnplComps()
|
|
61
|
+
else:
|
|
62
|
+
principal_vals = self._PrincipalComponents()
|
|
60
63
|
# plot eigenvalues from PCA
|
|
61
64
|
if plot:
|
|
62
65
|
self._PlotEigs(principal_vals)
|
|
@@ -64,7 +67,11 @@ class BandU():
|
|
|
64
67
|
for i in range(self.found_states):
|
|
65
68
|
self.bandu_fxns[i] = self.bandu_fxns[i].Normalize()
|
|
66
69
|
# compute ratios
|
|
67
|
-
|
|
70
|
+
if not real_imag_sep:
|
|
71
|
+
omega_vals, omega_check = self._CheckOmega()
|
|
72
|
+
else:
|
|
73
|
+
omega_vals = 0
|
|
74
|
+
omega_check = 0
|
|
68
75
|
# write output file
|
|
69
76
|
fermi = self.bandu_fxns[0].fermi_energy
|
|
70
77
|
with open('eigenvalues.out', 'w') as f:
|
|
@@ -163,7 +170,7 @@ class BandU():
|
|
|
163
170
|
dupes.extend(shifted_dupe)
|
|
164
171
|
self.duped_states += self.found_states
|
|
165
172
|
self.bandu_fxns.extend(dupes)
|
|
166
|
-
|
|
173
|
+
#-----------------------------------------------------------------------------------------------------------------#
|
|
167
174
|
# find principal components
|
|
168
175
|
def _PrincipalComponents(
|
|
169
176
|
self
|
|
@@ -191,6 +198,40 @@ class BandU():
|
|
|
191
198
|
self.bandu_fxns[i].wfk_coeffs = mat[i,:]
|
|
192
199
|
return principal_vals
|
|
193
200
|
#-----------------------------------------------------------------------------------------------------------------#
|
|
201
|
+
# find principal components with real and imaginary separated
|
|
202
|
+
def _RealImagPrnplComps(
|
|
203
|
+
self
|
|
204
|
+
)->np.ndarray:
|
|
205
|
+
x = self.bandu_fxns[0].ngfftx
|
|
206
|
+
y = self.bandu_fxns[0].ngffty
|
|
207
|
+
z = self.bandu_fxns[0].ngfftz
|
|
208
|
+
mat = np.zeros((2*self.found_states,x*y*z), dtype=complex)
|
|
209
|
+
for i in range(self.found_states):
|
|
210
|
+
ind = 2*i
|
|
211
|
+
real_coeffs = self.bandu_fxns[i].wfk_coeffs.real
|
|
212
|
+
imag_coeffs = self.bandu_fxns[i].wfk_coeffs.imag
|
|
213
|
+
mat[ind,:] = real_coeffs.reshape((1,x*y*z))
|
|
214
|
+
mat[ind+1,:] = imag_coeffs.reshape((1,x*y*z))
|
|
215
|
+
print('Computing overlap matrix')
|
|
216
|
+
overlap_mat = np.matmul(np.conj(mat),mat.T)
|
|
217
|
+
# diagonlize matrix
|
|
218
|
+
principal_vals, principal_vecs = np.linalg.eig(overlap_mat)
|
|
219
|
+
principal_vecs = principal_vecs.T
|
|
220
|
+
# organize eigenvectors and eigenvalues
|
|
221
|
+
sorted_inds = np.flip(principal_vals.argsort())
|
|
222
|
+
principal_vals = np.take(principal_vals, sorted_inds)
|
|
223
|
+
principal_vecs = np.take(principal_vecs, sorted_inds, axis=0)
|
|
224
|
+
mat = np.matmul(principal_vecs, mat)
|
|
225
|
+
for i in range(2*self.found_states):
|
|
226
|
+
if i < self.found_states:
|
|
227
|
+
self.bandu_fxns[i].wfk_coeffs = mat[i,:]
|
|
228
|
+
else:
|
|
229
|
+
new_coeffs = copy(self.bandu_fxns[0])
|
|
230
|
+
new_coeffs.wfk_coeffs = mat[i,:]
|
|
231
|
+
self.bandu_fxns.append(new_coeffs)
|
|
232
|
+
self.found_states *= 2
|
|
233
|
+
return principal_vals
|
|
234
|
+
#-----------------------------------------------------------------------------------------------------------------#
|
|
194
235
|
# find ratio of real and imaginary components
|
|
195
236
|
def _CheckOmega(
|
|
196
237
|
self
|
|
@@ -13,8 +13,20 @@ atom_labels = {1:'H', 2:'He', 3:'Li', 4:'Be', 5:'B', 6:'C', 7:'N', 8:'O', 9:'F',
|
|
|
13
13
|
class XSF():
|
|
14
14
|
def __init__(
|
|
15
15
|
self,
|
|
16
|
-
xsf_file:str='WFK.xsf'
|
|
16
|
+
xsf_file:str='WFK.xsf',
|
|
17
|
+
datagrid:str='BEGIN_DATAGRID_3D_principal_orbital_component'
|
|
17
18
|
)->None:
|
|
19
|
+
'''
|
|
20
|
+
Class for reading in XSF files
|
|
21
|
+
|
|
22
|
+
Parameters
|
|
23
|
+
----------
|
|
24
|
+
xsf_file : str
|
|
25
|
+
Path to XSF file
|
|
26
|
+
datagrid : str
|
|
27
|
+
Name of datagrid to be read in\n
|
|
28
|
+
Default is "BEGIN_DATAGRID_3D_principal_orbital_component"
|
|
29
|
+
'''
|
|
18
30
|
# if xsf file is supplied, read in parameters
|
|
19
31
|
self.xsf_file = xsf_file
|
|
20
32
|
with open(xsf_file, 'r') as xsf:
|
|
@@ -40,7 +52,7 @@ class XSF():
|
|
|
40
52
|
del coord[0]
|
|
41
53
|
self.coords[atom,:] = coord
|
|
42
54
|
# once density block is reached, get ngfft spacing and end init
|
|
43
|
-
if line.strip() ==
|
|
55
|
+
if line.strip() == datagrid:
|
|
44
56
|
ngfft_spacing = self.xsf_lines[i+1].strip().split(' ')
|
|
45
57
|
ngfft_spacing = [int(val) for val in ngfft_spacing]
|
|
46
58
|
self.ngfftx = ngfft_spacing[0]
|
|
@@ -54,11 +66,6 @@ class XSF():
|
|
|
54
66
|
)->np.ndarray:
|
|
55
67
|
'''
|
|
56
68
|
Method for reading in density grid from XSF file. Returns grid as N dimensional numpy array.
|
|
57
|
-
|
|
58
|
-
Parameters
|
|
59
|
-
----------
|
|
60
|
-
undo_xsf : bool
|
|
61
|
-
If True (which is the default), then the XSF formatting is undone by removing end points.
|
|
62
69
|
'''
|
|
63
70
|
density_lines:list|np.ndarray=[]
|
|
64
71
|
for i, line in enumerate(self.xsf_lines):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bandu
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.3
|
|
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
|
|
File without changes
|