bandu 1.0.0__py3-none-any.whl → 1.1.1__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/abinit_reader.py +108 -20
- bandu/bandu.py +5 -6
- bandu/plotter.py +14 -3
- bandu/wfk_class.py +0 -2
- {bandu-1.0.0.dist-info → bandu-1.1.1.dist-info}/METADATA +59 -9
- bandu-1.1.1.dist-info/RECORD +14 -0
- bandu-1.0.0.dist-info/RECORD +0 -14
- {bandu-1.0.0.dist-info → bandu-1.1.1.dist-info}/WHEEL +0 -0
- {bandu-1.0.0.dist-info → bandu-1.1.1.dist-info}/licenses/LICENSE +0 -0
- {bandu-1.0.0.dist-info → bandu-1.1.1.dist-info}/top_level.txt +0 -0
bandu/abinit_reader.py
CHANGED
|
@@ -193,9 +193,23 @@ class Abinit7WFK():
|
|
|
193
193
|
print('WFK header read')
|
|
194
194
|
wfk.close()
|
|
195
195
|
#-----------------------------------------------------------------------------------------------------------------#
|
|
196
|
+
# check for time reversal symmetry
|
|
197
|
+
def _CheckTimeRev(
|
|
198
|
+
self
|
|
199
|
+
):
|
|
200
|
+
# if system is centrosymmetric, do not double reciprocal symmetry operations
|
|
201
|
+
if True in [np.array_equal(-np.identity(3),mat) for mat in self.symrel]:
|
|
202
|
+
self.time_reversal = False
|
|
203
|
+
else:
|
|
204
|
+
self.time_reversal = True
|
|
205
|
+
print((
|
|
206
|
+
'Noncentrosymmetric system identified, assuming time reversal symmetry\n'
|
|
207
|
+
'To change this, set "check_time_rev" keyword to False when calling ReadWFK() or ReadEigenvalues()'
|
|
208
|
+
))
|
|
209
|
+
#-----------------------------------------------------------------------------------------------------------------#
|
|
196
210
|
# method to read entire body of abinit version 7 wavefunction file
|
|
197
211
|
def ReadWFK(
|
|
198
|
-
self, energy_level=np.nan, width=np.nan
|
|
212
|
+
self, energy_level=np.nan, width=np.nan, check_time_rev:bool=True
|
|
199
213
|
)->Generator[wc.WFK, None, None]:
|
|
200
214
|
'''
|
|
201
215
|
Method that constructs WFK objects from ABINIT v7 WFK file
|
|
@@ -212,6 +226,12 @@ class Abinit7WFK():
|
|
|
212
226
|
Total range is equal to width, so look width/2 above and below energy_level
|
|
213
227
|
If not defined but energy_level is defined, default is 0.005 Hartree
|
|
214
228
|
'''
|
|
229
|
+
# check for time reversal symmetry
|
|
230
|
+
if check_time_rev:
|
|
231
|
+
self._CheckTimeRev()
|
|
232
|
+
else:
|
|
233
|
+
self.time_reversal = False
|
|
234
|
+
# read wfk file
|
|
215
235
|
wfk = open(self.filename, 'rb')
|
|
216
236
|
skip = True
|
|
217
237
|
if energy_level is np.nan:
|
|
@@ -322,16 +342,23 @@ class Abinit7WFK():
|
|
|
322
342
|
typat=self.typat,
|
|
323
343
|
znucltypat=self.znucltypat,
|
|
324
344
|
fermi_energy=self.fermi,
|
|
325
|
-
non_symm_vecs=np.array(self.tnons)
|
|
345
|
+
non_symm_vecs=np.array(self.tnons),
|
|
346
|
+
time_reversal=self.time_reversal
|
|
326
347
|
)
|
|
327
348
|
#-----------------------------------------------------------------------------------------------------------------#
|
|
328
349
|
# method to read only eigenvalues from body of abinit version 7 wavefunction file
|
|
329
350
|
def ReadEigenvalues(
|
|
330
|
-
self
|
|
351
|
+
self, check_time_rev:bool=True
|
|
331
352
|
)->Generator[wc.WFK, None, None]:
|
|
332
353
|
'''
|
|
333
354
|
Method that constructs WFK objects from ABINIT v7 WFK file.
|
|
334
355
|
'''
|
|
356
|
+
# check for time reversal symmetry
|
|
357
|
+
if check_time_rev:
|
|
358
|
+
self._CheckTimeRev()
|
|
359
|
+
else:
|
|
360
|
+
self.time_reversal = False
|
|
361
|
+
# read wfk
|
|
335
362
|
wfk = open(self.filename, 'rb')
|
|
336
363
|
#-----------#
|
|
337
364
|
# skip header
|
|
@@ -378,7 +405,8 @@ class Abinit7WFK():
|
|
|
378
405
|
typat=self.typat,
|
|
379
406
|
znucltypat=self.znucltypat,
|
|
380
407
|
fermi_energy=self.fermi,
|
|
381
|
-
non_symm_vecs=np.array(self.tnons)
|
|
408
|
+
non_symm_vecs=np.array(self.tnons),
|
|
409
|
+
time_reversal=self.time_reversal
|
|
382
410
|
)
|
|
383
411
|
print('WFK body read')
|
|
384
412
|
wfk.close()
|
|
@@ -648,9 +676,23 @@ class Abinit10WFK():
|
|
|
648
676
|
print('WFK header read')
|
|
649
677
|
wfk.close()
|
|
650
678
|
#-----------------------------------------------------------------------------------------------------------------#
|
|
679
|
+
# check for time reversal symmetry
|
|
680
|
+
def _CheckTimeRev(
|
|
681
|
+
self
|
|
682
|
+
):
|
|
683
|
+
# if system is centrosymmetric, do not double reciprocal symmetry operations
|
|
684
|
+
if True in [np.array_equal(-np.identity(3),mat) for mat in self.symrel]:
|
|
685
|
+
self.time_reversal = False
|
|
686
|
+
else:
|
|
687
|
+
self.time_reversal = True
|
|
688
|
+
print((
|
|
689
|
+
'Noncentrosymmetric system identified, assuming time reversal symmetry\n'
|
|
690
|
+
'To change this, set "check_time_rev" keyword to False when calling ReadWFK() or ReadEigenvalues()'
|
|
691
|
+
))
|
|
692
|
+
#-----------------------------------------------------------------------------------------------------------------#
|
|
651
693
|
# method to read entire body of abinit version 7 wavefunction file
|
|
652
694
|
def ReadWFK(
|
|
653
|
-
self, energy_level=np.nan, width=np.nan
|
|
695
|
+
self, energy_level=np.nan, width=np.nan, check_time_rev:bool=True
|
|
654
696
|
)->Generator[wc.WFK, None, None]:
|
|
655
697
|
'''
|
|
656
698
|
Method that constructs WFK objects from ABINIT v10 WFK file.
|
|
@@ -667,6 +709,12 @@ class Abinit10WFK():
|
|
|
667
709
|
Total range is equal to width, so look width/2 above and below energy_level
|
|
668
710
|
If not defined but energy_level is defined, default is 0.005 Hartree
|
|
669
711
|
'''
|
|
712
|
+
# check for time reversal symmetry
|
|
713
|
+
if check_time_rev:
|
|
714
|
+
self._CheckTimeRev()
|
|
715
|
+
else:
|
|
716
|
+
self.time_reversal = False
|
|
717
|
+
# read wfk
|
|
670
718
|
wfk = open(self.filename, 'rb')
|
|
671
719
|
skip = True
|
|
672
720
|
if energy_level is np.nan:
|
|
@@ -798,16 +846,23 @@ class Abinit10WFK():
|
|
|
798
846
|
typat=self.typat,
|
|
799
847
|
znucltypat=self.znucltypat,
|
|
800
848
|
fermi_energy=self.fermi,
|
|
801
|
-
non_symm_vecs=np.array(self.tnons)
|
|
849
|
+
non_symm_vecs=np.array(self.tnons),
|
|
850
|
+
time_reversal=self.time_reversal
|
|
802
851
|
)
|
|
803
852
|
#-----------------------------------------------------------------------------------------------------------------#
|
|
804
853
|
# method to read only eigenvalues from body of abinit version 10 wavefunction file
|
|
805
854
|
def ReadEigenvalues(
|
|
806
|
-
self
|
|
855
|
+
self, check_time_rev:bool=True
|
|
807
856
|
)->Generator[wc.WFK, None, None]:
|
|
808
857
|
'''
|
|
809
858
|
Method that constructs WFK objects from ABINIT v10 WFK file.
|
|
810
859
|
'''
|
|
860
|
+
# check for time reversal symmetry
|
|
861
|
+
if check_time_rev:
|
|
862
|
+
self._CheckTimeRev()
|
|
863
|
+
else:
|
|
864
|
+
self.time_reversal = False
|
|
865
|
+
# read wfk
|
|
811
866
|
wfk = open(self.filename, 'rb')
|
|
812
867
|
#-----------#
|
|
813
868
|
# skip header
|
|
@@ -874,7 +929,8 @@ class Abinit10WFK():
|
|
|
874
929
|
typat=self.typat,
|
|
875
930
|
znucltypat=self.znucltypat,
|
|
876
931
|
fermi_energy=self.fermi,
|
|
877
|
-
non_symm_vecs=np.array(self.tnons)
|
|
932
|
+
non_symm_vecs=np.array(self.tnons),
|
|
933
|
+
time_reversal=self.time_reversal
|
|
878
934
|
)
|
|
879
935
|
print('WFK body read')
|
|
880
936
|
wfk.close()
|
|
@@ -907,7 +963,11 @@ class AbinitNetCDF():
|
|
|
907
963
|
self.nband:int = int(self.dataset.dimensions['bantot'].size / self.nkpt)
|
|
908
964
|
self.typat:list = self.dataset.variables['atom_species'][:].tolist()
|
|
909
965
|
self.zion:np.ndarray = self.dataset.variables['atomic_numbers'][:]
|
|
910
|
-
|
|
966
|
+
_all_ions = [int(self.zion[i-1]) for i in self.typat]
|
|
967
|
+
self.znucltypat:list = []
|
|
968
|
+
for i in _all_ions:
|
|
969
|
+
if i not in self.znucltypat:
|
|
970
|
+
self.znucltypat.append(i)
|
|
911
971
|
self.bands = [self.nband]
|
|
912
972
|
#---------------------------------------------------------------------------------------------------------------------#
|
|
913
973
|
#------------------------------------------------------ METHODS ------------------------------------------------------#
|
|
@@ -919,31 +979,52 @@ class AbinitNetCDF():
|
|
|
919
979
|
from netCDF4 import Dataset
|
|
920
980
|
return Dataset(self.filename,format='NETCDF4')
|
|
921
981
|
#-----------------------------------------------------------------------------------------------------------------#
|
|
982
|
+
# check for time reversal symmetry
|
|
983
|
+
def _CheckTimeRev(
|
|
984
|
+
self
|
|
985
|
+
):
|
|
986
|
+
# if system is centrosymmetric, do not double reciprocal symmetry operations
|
|
987
|
+
if True in [np.array_equal(-np.identity(3),mat) for mat in self.symrel]:
|
|
988
|
+
self.time_reversal = False
|
|
989
|
+
else:
|
|
990
|
+
self.time_reversal = True
|
|
991
|
+
print((
|
|
992
|
+
'Noncentrosymmetric system identified, assuming time reversal symmetry\n'
|
|
993
|
+
'To change this, set "check_time_rev" keyword to False when calling ReadWFK() or ReadEigenvalues()'
|
|
994
|
+
))
|
|
995
|
+
#-----------------------------------------------------------------------------------------------------------------#
|
|
922
996
|
# fetch wavefunction coefficients from netcdf dataset
|
|
923
997
|
def ReadWFK(
|
|
924
|
-
self, energy_level:float=np.nan, width:float=np.nan
|
|
998
|
+
self, energy_level:float=np.nan, width:float=np.nan, check_time_rev:bool=True
|
|
925
999
|
)->Generator[wc.WFK, None, None]:
|
|
1000
|
+
# check for time reversal symmetry
|
|
1001
|
+
if check_time_rev:
|
|
1002
|
+
self._CheckTimeRev()
|
|
1003
|
+
else:
|
|
1004
|
+
self.time_reversal = False
|
|
926
1005
|
eigs:np.ndarray = self.dataset.variables['eigenvalues'][:][0]
|
|
927
1006
|
pw_inds:np.ndarray = self.dataset.variables['reduced_coordinates_of_plane_waves'][:]
|
|
928
1007
|
# restructure wavefunction coefficients
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
print(f'Reading kpoint {i+1} of {self.nkpt}', end='\r')
|
|
1008
|
+
for kpt in range(self.nkpt):
|
|
1009
|
+
print(f'Reading kpoint {kpt+1} of {self.nkpt}', end='\r')
|
|
932
1010
|
kpt_coeffs = []
|
|
933
1011
|
# format plane wave indices
|
|
934
|
-
kpt_pw_inds = pw_inds[
|
|
1012
|
+
kpt_pw_inds = pw_inds[kpt]
|
|
935
1013
|
kpt_pw_inds = kpt_pw_inds[~kpt_pw_inds.mask]
|
|
936
1014
|
kpt_pw_inds = kpt_pw_inds.reshape((-1,3))
|
|
937
|
-
|
|
1015
|
+
kpt_pw_inds = np.ma.getdata(kpt_pw_inds)
|
|
1016
|
+
coeffs = self.dataset.variables['coefficients_of_wavefunctions'][0,kpt]
|
|
1017
|
+
for band in coeffs:
|
|
938
1018
|
band = band[0]
|
|
939
1019
|
band = band[~band.mask]
|
|
940
1020
|
band = band.reshape((-1,2))
|
|
1021
|
+
band = np.ma.getdata(band)
|
|
941
1022
|
kpt_coeffs.append(band[:,0] + 1j*band[:,1])
|
|
942
1023
|
yield wc.WFK(
|
|
943
|
-
eigenvalues=eigs[
|
|
1024
|
+
eigenvalues=eigs[kpt,:],
|
|
944
1025
|
wfk_coeffs=np.array(kpt_coeffs),
|
|
945
1026
|
pw_indices=kpt_pw_inds,
|
|
946
|
-
kpoints=self.kpts[
|
|
1027
|
+
kpoints=self.kpts[kpt],
|
|
947
1028
|
nkpt=self.nkpt,
|
|
948
1029
|
nbands=self.nband,
|
|
949
1030
|
ngfftx=self.ngfftx,
|
|
@@ -957,13 +1038,19 @@ class AbinitNetCDF():
|
|
|
957
1038
|
typat=self.typat,
|
|
958
1039
|
znucltypat=self.znucltypat,
|
|
959
1040
|
fermi_energy=self.fermi,
|
|
960
|
-
non_symm_vecs=self.tnons
|
|
1041
|
+
non_symm_vecs=self.tnons,
|
|
1042
|
+
time_reversal=self.time_reversal
|
|
961
1043
|
)
|
|
962
1044
|
#-----------------------------------------------------------------------------------------------------------------#
|
|
963
1045
|
# fetch eigenvalues from netcdf dataset
|
|
964
1046
|
def ReadEigenvalues(
|
|
965
|
-
self, energy_level:float=np.nan, width:float=np.nan
|
|
1047
|
+
self, energy_level:float=np.nan, width:float=np.nan, check_time_rev:bool=True
|
|
966
1048
|
)->Generator[wc.WFK, None, None]:
|
|
1049
|
+
# check for time reversal symmetry
|
|
1050
|
+
if check_time_rev:
|
|
1051
|
+
self._CheckTimeRev()
|
|
1052
|
+
else:
|
|
1053
|
+
self.time_reversal = False
|
|
967
1054
|
eigs:np.ndarray = self.dataset.variables['eigenvalues'][:][0]
|
|
968
1055
|
for i, kpt in enumerate(self.kpts):
|
|
969
1056
|
print(f'Reading kpoint {i+1} of {self.nkpt}', end='\r')
|
|
@@ -983,7 +1070,8 @@ class AbinitNetCDF():
|
|
|
983
1070
|
typat=self.typat,
|
|
984
1071
|
znucltypat=self.znucltypat,
|
|
985
1072
|
fermi_energy=self.fermi,
|
|
986
|
-
non_symm_vecs=self.tnons
|
|
1073
|
+
non_symm_vecs=self.tnons,
|
|
1074
|
+
time_reversal=self.time_reversal
|
|
987
1075
|
)
|
|
988
1076
|
|
|
989
1077
|
#---------------------------------------------------------------------------------------------------------------------#
|
bandu/bandu.py
CHANGED
|
@@ -51,7 +51,6 @@ class BandU():
|
|
|
51
51
|
self.low_mem:bool=low_mem
|
|
52
52
|
self.found_states:int=0
|
|
53
53
|
self.bandu_fxns:list[wc.WFK]=[]
|
|
54
|
-
self.duped_states:int=0
|
|
55
54
|
self.plot=plot
|
|
56
55
|
# find all states within width
|
|
57
56
|
self._FindStates(energy_level, width, wfks)
|
|
@@ -62,7 +61,7 @@ class BandU():
|
|
|
62
61
|
if plot:
|
|
63
62
|
self._PlotEigs(principal_vals)
|
|
64
63
|
# normalize bandu functions
|
|
65
|
-
for i in range(self.found_states
|
|
64
|
+
for i in range(self.found_states):
|
|
66
65
|
self.bandu_fxns[i] = self.bandu_fxns[i].Normalize()
|
|
67
66
|
# compute ratios
|
|
68
67
|
omega_vals, omega_check = self._CheckOmega()
|
|
@@ -169,7 +168,7 @@ class BandU():
|
|
|
169
168
|
def _PrincipalComponents(
|
|
170
169
|
self
|
|
171
170
|
)->np.ndarray:
|
|
172
|
-
total_states = self.found_states
|
|
171
|
+
total_states = self.found_states
|
|
173
172
|
# organize wfk coefficients
|
|
174
173
|
x = self.bandu_fxns[0].ngfftx
|
|
175
174
|
y = self.bandu_fxns[0].ngffty
|
|
@@ -196,7 +195,7 @@ class BandU():
|
|
|
196
195
|
def _CheckOmega(
|
|
197
196
|
self
|
|
198
197
|
)->tuple[np.ndarray, np.ndarray]:
|
|
199
|
-
total_states = self.found_states
|
|
198
|
+
total_states = self.found_states
|
|
200
199
|
omega_vals = np.zeros((total_states, 3), dtype=float)
|
|
201
200
|
vals = np.linspace(start=-0.01, stop=0.01, num=3)
|
|
202
201
|
for i, val in enumerate(vals):
|
|
@@ -209,7 +208,7 @@ class BandU():
|
|
|
209
208
|
omega_diff1 = (omega_vals[:,1] - omega_vals[:,0])
|
|
210
209
|
omega_diff2 = (omega_vals[:,2] - omega_vals[:,1])
|
|
211
210
|
omega_check = np.sign(omega_diff1) + np.sign(omega_diff2)
|
|
212
|
-
return omega_vals, omega_check
|
|
211
|
+
return omega_vals[:,1], omega_check
|
|
213
212
|
#-----------------------------------------------------------------------------------------------------------------#
|
|
214
213
|
# plot eigenvalues from PCA
|
|
215
214
|
def _PlotEigs(
|
|
@@ -243,7 +242,7 @@ class BandU():
|
|
|
243
242
|
def ToXSF(
|
|
244
243
|
self, nums:list[int]=[], xsf_name:str='Principal_orbital_component'
|
|
245
244
|
):
|
|
246
|
-
total_states = self.found_states
|
|
245
|
+
total_states = self.found_states
|
|
247
246
|
if nums is []:
|
|
248
247
|
nums = [0,total_states-1]
|
|
249
248
|
else:
|
bandu/plotter.py
CHANGED
|
@@ -462,9 +462,20 @@ class Plotter():
|
|
|
462
462
|
symrel = fermi_wfk.symrel
|
|
463
463
|
nsym = fermi_wfk.nsym
|
|
464
464
|
kpts = fermi_wfk.kpts
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
465
|
+
all_kpts = np.zeros((1,3))
|
|
466
|
+
all_overlaps = np.zeros((1,nband))
|
|
467
|
+
new_wfk = wc.WFK(symrel=np.array(symrel), nsym=nsym, nbands=nband)
|
|
468
|
+
for i, kpt in enumerate(kpts):
|
|
469
|
+
unique_kpts, _ = new_wfk.Symmetrize(
|
|
470
|
+
points=kpt,
|
|
471
|
+
reciprocal=True
|
|
472
|
+
)
|
|
473
|
+
all_kpts = np.concatenate((all_kpts, unique_kpts), axis=0)
|
|
474
|
+
new_overlaps = np.repeat(overlaps[i,:].reshape((1,-1)), unique_kpts.shape[0], axis=0)
|
|
475
|
+
all_overlaps = np.concatenate((all_overlaps, new_overlaps), axis=0)
|
|
476
|
+
kpts = np.delete(all_kpts, 0, axis=0)
|
|
477
|
+
overlaps = np.delete(all_overlaps, 0, axis=0)
|
|
478
|
+
self.isosurface.points = np.matmul(kpts, self.isosurface.rec_latt)
|
|
468
479
|
# interpolate overlap values for smooth coloration
|
|
469
480
|
scalars = []
|
|
470
481
|
for i in range(overlaps.shape[1]):
|
bandu/wfk_class.py
CHANGED
|
@@ -376,8 +376,6 @@ class WFK():
|
|
|
376
376
|
Choose which band to pull coefficients from (indexed starting from zero).
|
|
377
377
|
Default assumes coefficients from a single band are provided (-1).
|
|
378
378
|
'''
|
|
379
|
-
# first check for time reversal symmetry
|
|
380
|
-
self._CheckTimeRevSym()
|
|
381
379
|
# find symmetric kpoints
|
|
382
380
|
kpoint = kpoint.reshape((1,3))
|
|
383
381
|
sym_kpoints, _ = self.Symmetrize(kpoint, unique=False, reciprocal=True)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bandu
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1.1
|
|
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
|
|
@@ -31,6 +31,8 @@ BandU projections, if provided with the necessary k-point and eigenvalue data.</
|
|
|
31
31
|
-------------------------------------------------------------------------------------------------------
|
|
32
32
|
<h1><p align="center">INSTALLATION INSTRUCTIONS</p></h1>
|
|
33
33
|
|
|
34
|
+
<h2><p align="center">THROUGH GITHUB</p></h2>
|
|
35
|
+
|
|
34
36
|
1) Inside that directory type on the command line
|
|
35
37
|
"git clone https://github.com/pcross0405/BandU.git"
|
|
36
38
|
|
|
@@ -46,6 +48,10 @@ BandU projections, if provided with the necessary k-point and eigenvalue data.</
|
|
|
46
48
|
|
|
47
49
|
6) On the command line type
|
|
48
50
|
"pip install dist/*.whl"
|
|
51
|
+
|
|
52
|
+
<h2><p align="center">THROUGH PIP</p></h2>
|
|
53
|
+
|
|
54
|
+
pip install bandu
|
|
49
55
|
|
|
50
56
|
-------------------------------------------------------------------------------------------------------
|
|
51
57
|
<h1><p align="center">DEPENDENCIES</p></h1>
|
|
@@ -93,9 +99,19 @@ xsf_path = f'path\to\XSF\file\{root_name}_bandu_{xsf_number}'
|
|
|
93
99
|
bandu_name = f'{root_name}_bandu'
|
|
94
100
|
|
|
95
101
|
def main(
|
|
96
|
-
|
|
102
|
+
principal_orbital_components:bool,
|
|
103
|
+
fermi_surface:bool,
|
|
104
|
+
fermi_surface_projection:bool,
|
|
105
|
+
load_fermi_surface:bool
|
|
97
106
|
)->None:
|
|
98
|
-
|
|
107
|
+
# this option will generate the principal orbital components 1 through 10
|
|
108
|
+
# to generate more or less, adjust the range of the "nums" keyword in the ToXSF() function
|
|
109
|
+
# the energy sampled can be set, relative to the Fermi energy, by changing the the "energy_level" global variable
|
|
110
|
+
# states are included in the analysis if they are within +/- 1/2*width of the set energy_level
|
|
111
|
+
# to get fewer or more states, decrease or increase, respectively, the "width" global variable
|
|
112
|
+
# by default, the prinicipal orbital components are generated from an irreducible wedge of the Brillouin Zone
|
|
113
|
+
# to generate from the full BZ, change the "sym" attribute in the BandU class from "False" to "True"
|
|
114
|
+
if principal_orbital_components:
|
|
99
115
|
wfk_gen = AbinitWFK(wfk_path).ReadWFK(
|
|
100
116
|
energy_level = energy_level,
|
|
101
117
|
width=width
|
|
@@ -104,13 +120,39 @@ def main(
|
|
|
104
120
|
wfks = wfk_gen,
|
|
105
121
|
energy_level = energy_level,
|
|
106
122
|
width = width,
|
|
107
|
-
sym =
|
|
123
|
+
sym = False
|
|
108
124
|
)
|
|
109
125
|
wfk.ToXSF(
|
|
110
126
|
xsf_name = bandu_name,
|
|
111
127
|
nums = [1,10]
|
|
112
128
|
)
|
|
113
|
-
|
|
129
|
+
# this option will only generate an energy isosurface and will not project principal component overlap onto the surface
|
|
130
|
+
# the "energy_level" global variable is the energy at which the isosurface will be be generated, relative to the Fermi energy
|
|
131
|
+
# so energy_level = 0.0 will generate the Fermi surface
|
|
132
|
+
# the "width" global variable determines how many states are included in the generation of the isosurface
|
|
133
|
+
# a small width (~10 meV or ~0.5 mHa) is best here as larger widths may introduce bands that do not cross the Fermi energy
|
|
134
|
+
# the color of the surface can be changed to any string compatible with the matplotlib colors
|
|
135
|
+
# see named colors here: https://matplotlib.org/stable/gallery/color/named_colors.html
|
|
136
|
+
# the Plot function has many other keywords to customize the visuals to the users liking, see the docstring for more
|
|
137
|
+
elif fermi_surface:
|
|
138
|
+
contours = Isosurface(
|
|
139
|
+
wfk_name = wfk_path,
|
|
140
|
+
energy_level = energy_level,
|
|
141
|
+
width = width
|
|
142
|
+
)
|
|
143
|
+
contours.Contour() # make contours
|
|
144
|
+
plot = Plotter(
|
|
145
|
+
isosurface = contours,
|
|
146
|
+
save_file=f'{root_name}_bandu_{xsf_number}_fermi_surf.pkl'
|
|
147
|
+
) # create plotter object
|
|
148
|
+
plot.Plot(
|
|
149
|
+
color = 'silver',
|
|
150
|
+
) # plot contours
|
|
151
|
+
# this option will generate an energy isosurface as well as project the overlap of a principal orbital component onto the surface
|
|
152
|
+
# everything remains the same as the previous option, except now the principal orbtial component XSF file is needed
|
|
153
|
+
# also the color of the surface is done with the Colors module by default
|
|
154
|
+
# other colors can be made with the Colors module, also any matplotlib colormap works
|
|
155
|
+
elif fermi_surface_projection:
|
|
114
156
|
contours = Isosurface(
|
|
115
157
|
wfk_name = wfk_path,
|
|
116
158
|
energy_level = energy_level,
|
|
@@ -129,14 +171,22 @@ def main(
|
|
|
129
171
|
surface_vals = overlap_vals,
|
|
130
172
|
colormap = Colors().blues,
|
|
131
173
|
) # plot contours
|
|
132
|
-
|
|
174
|
+
# this option will load a previously generated and saved fermi surface file
|
|
175
|
+
# update the "save_path" keyword to match the path and name of your save file
|
|
176
|
+
elif load_fermi_surface:
|
|
133
177
|
Plotter().Load(
|
|
134
178
|
save_path='{root_name}_bandu_{xsf_number}_fermi_surf.pkl',
|
|
135
179
|
)
|
|
180
|
+
# to run any of the options above, make sure to set that option to "True"
|
|
181
|
+
# also be sure that the other options (or at least all options that come before) are set to "False"
|
|
182
|
+
# the main function will only run which ever option is the first found to be "True" in top to bottom order
|
|
183
|
+
# in other words, the priority follows as most to least in the order:
|
|
184
|
+
# principal_orbital_components -> fermi_surface -> fermi_surface_projection -> load_fermi_surface
|
|
136
185
|
if __name__ == '__main__':
|
|
137
186
|
main(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
187
|
+
principal_orbital_components=True,
|
|
188
|
+
fermi_surface=True,
|
|
189
|
+
fermi_surface_projection=True,
|
|
190
|
+
load_fermi_surface=True
|
|
141
191
|
)
|
|
142
192
|
<pre>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
bandu/abinit_reader.py,sha256=U4HUUTnju9MpyGtWMOedUQLln90k2F0XIv0Q0zcP05c,47704
|
|
2
|
+
bandu/bandu.py,sha256=EA8AsM517NrnUL6Za5q4W0NAklOCbLomvY_7v51jQ48,12786
|
|
3
|
+
bandu/brillouin_zone.py,sha256=-SarCuvUthk5h_sFHM6KDHLns1eCWGk_v5fHngWFu08,7997
|
|
4
|
+
bandu/colors.py,sha256=OcIBwVh9ieu04n1cruRgyoYslKsdfJKf-u4oWMd3CwQ,2316
|
|
5
|
+
bandu/isosurface_class.py,sha256=o9VqcZ8b1tqkSQN6oJp7PSPkt-QNZg1V_IUbhAsFcgA,10018
|
|
6
|
+
bandu/plotter.py,sha256=wSIA1TpwhioPUHpBe4_gc14e8K98fv3q0LwwD5NLboo,27725
|
|
7
|
+
bandu/translate.py,sha256=YGTkwne4bdrw649OjRKBio7IBsCNVoa__rjkFZK6uRI,2217
|
|
8
|
+
bandu/wfk_class.py,sha256=zsgC17OcWTLan4riaGW2ObBvFHICmZqbizClJV8hsmI,26158
|
|
9
|
+
bandu/xsf_reader.py,sha256=gfv7LsTofWw4PrcOeqltOREJD6RLDq8CeFSsnlfohEw,4778
|
|
10
|
+
bandu-1.1.1.dist-info/licenses/LICENSE,sha256=jk_B-WYDiyH9RtxC45pO6JUtBxmfX5i240dVzv1okCg,1088
|
|
11
|
+
bandu-1.1.1.dist-info/METADATA,sha256=hLKKV7kP7l0lo6CKnUvHxHXH1_MozcRGG7ck98O1NDw,8945
|
|
12
|
+
bandu-1.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
13
|
+
bandu-1.1.1.dist-info/top_level.txt,sha256=AxbMFU3BRdjCr75K9gAdblwlBMQ3qr9-AaCC-IS8OWs,6
|
|
14
|
+
bandu-1.1.1.dist-info/RECORD,,
|
bandu-1.0.0.dist-info/RECORD
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
bandu/abinit_reader.py,sha256=T_GjUi4MOUqhr41wMg5bAgP6tqbhwf0TduC9CLKSTOI,43836
|
|
2
|
-
bandu/bandu.py,sha256=RmaJDdbMEechutwUKoOQSuUBYjIP8RUCx5ElqRekwkE,12894
|
|
3
|
-
bandu/brillouin_zone.py,sha256=-SarCuvUthk5h_sFHM6KDHLns1eCWGk_v5fHngWFu08,7997
|
|
4
|
-
bandu/colors.py,sha256=OcIBwVh9ieu04n1cruRgyoYslKsdfJKf-u4oWMd3CwQ,2316
|
|
5
|
-
bandu/isosurface_class.py,sha256=o9VqcZ8b1tqkSQN6oJp7PSPkt-QNZg1V_IUbhAsFcgA,10018
|
|
6
|
-
bandu/plotter.py,sha256=Ae0fCSwsbxWlmJ1vnK22pbxt_igjffNuR4a9J587Kzw,27169
|
|
7
|
-
bandu/translate.py,sha256=YGTkwne4bdrw649OjRKBio7IBsCNVoa__rjkFZK6uRI,2217
|
|
8
|
-
bandu/wfk_class.py,sha256=Bbyf8OKocEQde3mda-sd2F-l9Pd9hrvPMSESycv9wto,26241
|
|
9
|
-
bandu/xsf_reader.py,sha256=gfv7LsTofWw4PrcOeqltOREJD6RLDq8CeFSsnlfohEw,4778
|
|
10
|
-
bandu-1.0.0.dist-info/licenses/LICENSE,sha256=jk_B-WYDiyH9RtxC45pO6JUtBxmfX5i240dVzv1okCg,1088
|
|
11
|
-
bandu-1.0.0.dist-info/METADATA,sha256=Cy1aP_MxQnm3piKcy0729_i5Y4ITNv_52cQaRbSHIOg,5611
|
|
12
|
-
bandu-1.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
13
|
-
bandu-1.0.0.dist-info/top_level.txt,sha256=AxbMFU3BRdjCr75K9gAdblwlBMQ3qr9-AaCC-IS8OWs,6
|
|
14
|
-
bandu-1.0.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|