Skip to content

Commit

Permalink
QE tutorial (#33)
Browse files Browse the repository at this point in the history
* added new FAQs
* Added Quantum Espresso tutorial
* Improving collect_bandstr_data_only_in_energy_window() functionality 
* Upgraded return of band_ceneter_determination() function
* Added effective mass error estimation from fitting error

---------

Co-authored-by: Badal Mondal <[email protected]>
  • Loading branch information
bmondal94 and Badal Mondal authored Oct 14, 2024
1 parent b88180a commit fdaebb7
Show file tree
Hide file tree
Showing 19 changed files with 3,086 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ If you use `BandUPpy` in your work, please:

* **State EXPLICITLY that you have used the BandUP code** (or a modified version of it, if this is the case), for instance, adding a sentence like:

"The unfolding has been performed using the BandUP(py) code"
"The unfolding is performed using the BandUP(py) code"

* **Read and cite the following papers** (and the appropriate references therein):

Expand Down
16 changes: 11 additions & 5 deletions banduppy/BasicFunctions/general_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def _save_2_file(data=None, save_dir='.', file_name:str='', file_name_suffix:str
Directory to save the file. The default is current directory.
file_name : str, optional
Name of the file. The default is ''.
If file_format is vasp, file_name=KPOINTS_<file_name_suffix>
If file_format is vasp/qe, file_name=KPOINTS_<file_name_suffix>
file_name_suffix : str, optional
Suffix to add after the file_name. The default is ''.
header_txt : str, optional
Expand Down Expand Up @@ -144,16 +144,16 @@ def _save_sc_kpts_2_file(data=None, save_dir='.', file_name:str='',
Directory to save the file. The default is current directory.
file_name : str, optional
Name of the file. The default is ''.
If file_format is vasp, file_name=KPOINTS_<file_name_suffix>
If file_format is vasp/qe, file_name=KPOINTS_<file_name_suffix>
file_name_suffix : str, optional
Suffix to add after the file_name. The default is ''.
file_format : ['vasp'], optional
file_format : ['vasp', 'qe'], optional
Format of the file. The default is 'vasp'.
If file_format is vasp, file_name=KPOINTS_<file_name_suffix>
If file_format is vasp/qe, file_name=KPOINTS_<file_name_suffix>
header_txt : str, optional
String that will be written at the beginning of the file. The default is None.
footer_txt : str, optional
String that will be written at the end of the file.. The default is None.
String that will be written at the end of the file. The default is None.
comments_symbol : str, optional
String that will be prepended to the header and footer strings,
to mark them as comments. The default is ‘!‘.
Expand All @@ -171,6 +171,12 @@ def _save_sc_kpts_2_file(data=None, save_dir='.', file_name:str='',
if file_format == 'vasp':
file_name = 'KPOINTS'
comments_symbol = ''
elif file_format in ['qe', 'espresso', 'quantum_espresso']:
file_name = 'KPOINTS'
comments_symbol = ''
tmp_header = header_txt.split('\n')
if tmp_header[-1] == 'reciprocal':
header_txt = f'!{tmp_header[0]}\nK_POINTS crystal\n{tmp_header[1]}'

if print_log: print(f"{'='*_draw_line_length}\n- {print_msg}.")

Expand Down
10 changes: 5 additions & 5 deletions banduppy/src/folding.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def _generate_header_text(self, save_all_kpts:bool=False):
header_msg['SC'] += f"\n{len(self.SBZ_kpts_list)}\nreciprocal"

header_msg['SpecialKpoints'] = f"Special SC kpoints indices generated using banduppy-{__version__} package"
header_msg['SpecialKpoints'] += "Kpoints index: Kpoints lebel"
header_msg['SpecialKpoints'] += "\nKpoints index: Kpoints label"

# Generate header text for PC kpoints, SC-PC kpoints mapping, and special kpoints
if save_all_kpts:
Expand All @@ -383,7 +383,7 @@ def _generate_header_text(self, save_all_kpts:bool=False):
header_msg['PC'] += f"\n{len(self.PBZ_kpts_list_org)}\nreciprocal"

header_msg['SCPC_map'] = f"Mapping for SC Kpoints to PC kpoints indices generated using banduppy-{__version__} package"
header_msg['SCPC_map'] += "K-k relation: (K index: K -> k index unique: k unique -> k index: k)"
header_msg['SCPC_map'] += "\nK-k relation: (K index: K -> k index unique: k unique -> k index: k)"

return header_msg

Expand Down Expand Up @@ -652,12 +652,12 @@ def _generate_K_from_k(self, kpointsPBZ=None, kpts_weights=None,
Directory to save the file. The default is current directory.
file_name : str, optional
Name of the file. The default is ''.
If file_format is vasp, file_name=KPOINTS_<file_name_suffix>
If file_format is vasp/qe, file_name=KPOINTS_<file_name_suffix>
file_name_suffix : str, optional
Suffix to add after the file_name. The default is ''.
file_format : ['vasp'], optional
file_format : ['vasp','qe'], optional
Format of the file. The default is 'vasp'.
If file_format is vasp, file_name=KPOINTS_<file_name_suffix>
If file_format is vasp/qe, file_name=KPOINTS_<file_name_suffix>
footer_msg : str, optional
String that will be written at the end of the file. The default is PC kpoints list.
special_kpoints_pos_labels : dictionary, optional
Expand Down
12 changes: 6 additions & 6 deletions banduppy/unfolding.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ def generate_SC_Kpts_from_pc_k_path(self, pathPBZ=None, nk=11, labels=None, kpts
Directory to save the file. The default is current directory.
file_name : str, optional
Name of the file. The default is ''.
If file_format is vasp, file_name=KPOINTS_<file_name_suffix>
If file_format is vasp/qe, file_name=KPOINTS_<file_name_suffix>
file_name_suffix : str, optional
Suffix to add after the file_name. The default is ''.
file_format : ['vasp'], optional
file_format : ['vasp', 'qe'], optional
Format of the file. The default is 'vasp'.
If file_format is vasp, file_name=KPOINTS_<file_name_suffix>
If file_format is vasp/qe, file_name=KPOINTS_<file_name_suffix>
Returns
-------
Expand Down Expand Up @@ -182,12 +182,12 @@ def generate_SC_Kpts_from_pc_kpts(self, kpointsPBZ=None, kpts_weights=None,
Directory to save the file. The default is current directory.
file_name : str, optional
Name of the file. The default is ''.
If file_format is vasp, file_name=KPOINTS_<file_name_suffix>
If file_format is vasp/qe, file_name=KPOINTS_<file_name_suffix>
file_name_suffix : str, optional
Suffix to add after the file_name. The default is ''.
file_format : ['vasp'], optional
file_format : ['vasp', 'qe'], optional
Format of the file. The default is 'vasp'.
If file_format is vasp, file_name=KPOINTS_<file_name_suffix>
If file_format is vasp/qe, file_name=KPOINTS_<file_name_suffix>
footer_msg : str, optional
String that will be written at the end of the file. The default is PC kpoints list.
special_kpoints_pos_labels : dictionary, optional
Expand Down
14 changes: 14 additions & 0 deletions docs/FAQs.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ The information required is essentially the same for BandUP and BandUPpy, only a

Regarding the necessary modifications for different reference primitive unit cell calculations: you need to adjust the `super_cell_size` parameter in for example the `run_banduppy_vasp.py`, which is the primitive-to-supercell transformation matrix.

__Question:__ How can I write the label Gamma (Greek letter) instead of G in the plots?

__Answer:__ You have to use the list.

`special_k_points = ["L","G","X","U","K",r'$\Gamma$'] #instead of "LGXUKG"`

__Question:__ How one can remove the text with 'supercell and unfolded' that is displayed over the bands in the figure?

__Answer:__ To turn off the legends, you can use 'show_legend=False' in banduppy.Plotting.plot_ebs() function.

__Question:__ How can change the color of the gray supercell points to a different color or lighter shade?

__Answer:__ Unfortunately, at the moment, the supercell points color can not be changed from banduppy.Plotting.plot_ebs().


##
__If you are not satisfied with the answers, cannot find an answer to your question, or have new suggestions, please feel free to reach out to us. We are committed to providing the best experience for our users and greatly value your feedback.__
Expand Down
3 changes: 2 additions & 1 deletion docs/RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ __Latest release: v0.3.4__

__v0.3.4__

* Added Quantum Espresso tutorial
* Improving collect_bandstr_data_only_in_energy_window() functionality
* Upgraded return of band_ceneter_determination function
* Upgraded return of band_ceneter_determination() function
* Added effective mass error estimation from fitting error

__v0.3.3__
Expand Down
105 changes: 105 additions & 0 deletions tutorials/QuantumEspresso/input/KPOINTS_PC
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
!k-points for PC bandstructure generated using banduppy-0.3.4 package
K_POINTS crystal
88
0.50000000 0.50000000 0.50000000
0.47727273 0.47727273 0.47727273
0.45454545 0.45454545 0.45454545
0.43181818 0.43181818 0.43181818
0.40909091 0.40909091 0.40909091
0.38636364 0.38636364 0.38636364
0.36363636 0.36363636 0.36363636
0.34090909 0.34090909 0.34090909
0.31818182 0.31818182 0.31818182
0.29545455 0.29545455 0.29545455
0.27272727 0.27272727 0.27272727
0.25000000 0.25000000 0.25000000
0.22727273 0.22727273 0.22727273
0.20454545 0.20454545 0.20454545
0.18181818 0.18181818 0.18181818
0.15909091 0.15909091 0.15909091
0.13636364 0.13636364 0.13636364
0.11363636 0.11363636 0.11363636
0.09090909 0.09090909 0.09090909
0.06818182 0.06818182 0.06818182
0.04545455 0.04545455 0.04545455
0.02272727 0.02272727 0.02272727
0.00000000 0.00000000 0.00000000
0.00000000 0.00000000 0.00000000
0.01923077 0.00000000 0.01923077
0.03846154 0.00000000 0.03846154
0.05769231 0.00000000 0.05769231
0.07692308 0.00000000 0.07692308
0.09615385 0.00000000 0.09615385
0.11538462 0.00000000 0.11538462
0.13461538 0.00000000 0.13461538
0.15384615 0.00000000 0.15384615
0.17307692 0.00000000 0.17307692
0.19230769 0.00000000 0.19230769
0.21153846 0.00000000 0.21153846
0.23076923 0.00000000 0.23076923
0.25000000 0.00000000 0.25000000
0.26923077 0.00000000 0.26923077
0.28846154 0.00000000 0.28846154
0.30769231 0.00000000 0.30769231
0.32692308 0.00000000 0.32692308
0.34615385 0.00000000 0.34615385
0.36538462 0.00000000 0.36538462
0.38461538 0.00000000 0.38461538
0.40384615 0.00000000 0.40384615
0.42307692 0.00000000 0.42307692
0.44230769 0.00000000 0.44230769
0.46153846 0.00000000 0.46153846
0.48076923 0.00000000 0.48076923
0.50000000 0.00000000 0.50000000
0.50000000 0.00000000 0.50000000
0.51562500 0.03125000 0.51562500
0.53125000 0.06250000 0.53125000
0.54687500 0.09375000 0.54687500
0.56250000 0.12500000 0.56250000
0.57812500 0.15625000 0.57812500
0.59375000 0.18750000 0.59375000
0.60937500 0.21875000 0.60937500
0.62500000 0.25000000 0.62500000
0.37500000 0.37500000 0.75000000
0.36160714 0.36160714 0.72321429
0.34821429 0.34821429 0.69642857
0.33482143 0.33482143 0.66964286
0.32142857 0.32142857 0.64285714
0.30803571 0.30803571 0.61607143
0.29464286 0.29464286 0.58928571
0.28125000 0.28125000 0.56250000
0.26785714 0.26785714 0.53571429
0.25446429 0.25446429 0.50892857
0.24107143 0.24107143 0.48214286
0.22767857 0.22767857 0.45535714
0.21428571 0.21428571 0.42857143
0.20089286 0.20089286 0.40178571
0.18750000 0.18750000 0.37500000
0.17410714 0.17410714 0.34821429
0.16071429 0.16071429 0.32142857
0.14732143 0.14732143 0.29464286
0.13392857 0.13392857 0.26785714
0.12053571 0.12053571 0.24107143
0.10714286 0.10714286 0.21428571
0.09375000 0.09375000 0.18750000
0.08035714 0.08035714 0.16071429
0.06696429 0.06696429 0.13392857
0.05357143 0.05357143 0.10714286
0.04017857 0.04017857 0.08035714
0.02678571 0.02678571 0.05357143
0.01339286 0.01339286 0.02678571
0.00000000 0.00000000 0.00000000


! The above SCKPTS (and/or some other SCKPTS related to them by symm. ops. of the SCBZ)
! unfold onto the pckpts listed below (selected by you):
! k-points for PC bandstructure L-G-X-U,K-G
! 23 27 9 29
! reciprocal
! 0.50000000 0.50000000 0.50000000 L
! 0.00000000 0.00000000 0.00000000 G
! 0.50000000 0.00000000 0.50000000 X
! 0.62500000 0.25000000 0.62500000 U
!
! 0.37500000 0.37500000 0.75000000 K
! 0.00000000 0.00000000 0.00000000 G
101 changes: 101 additions & 0 deletions tutorials/QuantumEspresso/input/KPOINTS_SC
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
!K-points for SC bandstructure generated using banduppy-0.3.4 package
K_POINTS crystal
84
0.00000000 0.00000000 0.00000000 1.00000000
0.00000000 0.03846154 0.00000000 1.00000000
0.00000000 0.07692308 0.00000000 1.00000000
0.00000000 0.11538462 0.00000000 1.00000000
0.00000000 0.15384615 0.00000000 1.00000000
0.00000000 0.19230769 0.00000000 1.00000000
0.00000000 0.23076923 0.00000000 1.00000000
0.00000000 0.26923077 0.00000000 1.00000000
0.00000000 0.30769231 0.00000000 1.00000000
0.00000000 0.34615385 0.00000000 1.00000000
0.00000000 0.38461538 0.00000000 1.00000000
0.00000000 0.42307692 0.00000000 1.00000000
0.00000000 0.46153846 0.00000000 1.00000000
0.00000000 0.50000000 0.00000000 1.00000000
0.00000000 0.53846154 0.00000000 1.00000000
0.00000000 0.57692308 0.00000000 1.00000000
0.00000000 0.61538462 0.00000000 1.00000000
0.00000000 0.65384615 0.00000000 1.00000000
0.00000000 0.69230769 0.00000000 1.00000000
0.00000000 0.73076923 0.00000000 1.00000000
0.00000000 0.76923077 0.00000000 1.00000000
0.00000000 0.80769231 0.00000000 1.00000000
0.00000000 0.84615385 0.00000000 1.00000000
0.00000000 0.88461538 0.00000000 1.00000000
0.00000000 0.92307692 0.00000000 1.00000000
0.00000000 0.96153846 0.00000000 1.00000000
0.02272727 0.02272727 0.02272727 1.00000000
0.02678571 0.02678571 1.00000000 1.00000000
0.03125000 0.00000000 0.03125000 1.00000000
0.04545455 0.04545455 0.04545455 1.00000000
0.05357143 0.05357143 0.00000000 1.00000000
0.06250000 0.00000000 0.06250000 1.00000000
0.06818182 0.06818182 0.06818182 1.00000000
0.08035714 0.08035714 1.00000000 1.00000000
0.09090909 0.09090909 0.09090909 1.00000000
0.09375000 0.00000000 0.09375000 1.00000000
0.10714286 0.10714286 0.00000000 1.00000000
0.11363636 0.11363636 0.11363636 1.00000000
0.12500000 0.00000000 0.12500000 1.00000000
0.13392857 0.13392857 0.00000000 1.00000000
0.13636364 0.13636364 0.13636364 1.00000000
0.15625000 0.00000000 0.15625000 1.00000000
0.15909091 0.15909091 0.15909091 1.00000000
0.16071429 0.16071429 0.00000000 1.00000000
0.18181818 0.18181818 0.18181818 1.00000000
0.18750000 0.00000000 0.18750000 1.00000000
0.18750000 0.18750000 0.00000000 1.00000000
0.20454545 0.20454545 0.20454545 1.00000000
0.21428571 0.21428571 1.00000000 1.00000000
0.21875000 0.00000000 0.21875000 1.00000000
0.22727273 0.22727273 0.22727273 1.00000000
0.24107143 0.24107143 0.00000000 1.00000000
0.25000000 0.00000000 0.25000000 1.00000000
0.25000000 0.25000000 0.25000000 1.00000000
0.26785714 0.26785714 1.00000000 1.00000000
0.27272727 0.27272727 0.27272727 1.00000000
0.29464286 0.29464286 0.00000000 1.00000000
0.29545455 0.29545455 0.29545455 1.00000000
0.31818182 0.31818182 0.31818182 1.00000000
0.32142857 0.32142857 0.00000000 1.00000000
0.34090909 0.34090909 0.34090909 1.00000000
0.34821429 0.34821429 0.00000000 1.00000000
0.36363636 0.36363636 0.36363636 1.00000000
0.37500000 0.37500000 0.00000000 1.00000000
0.38636364 0.38636364 0.38636364 1.00000000
0.40178571 0.40178571 1.00000000 1.00000000
0.40909091 0.40909091 0.40909091 1.00000000
0.42857143 0.42857143 0.00000000 1.00000000
0.43181818 0.43181818 0.43181818 1.00000000
0.45454545 0.45454545 0.45454545 1.00000000
0.45535714 0.45535714 1.00000000 1.00000000
0.47727273 0.47727273 0.47727273 1.00000000
0.48214286 0.48214286 0.00000000 1.00000000
0.50000000 0.50000000 0.50000000 1.00000000
0.50892857 0.50892857 0.00000000 1.00000000
0.53571429 0.53571429 0.00000000 1.00000000
0.56250000 0.56250000 0.00000000 1.00000000
0.58928571 0.58928571 1.00000000 1.00000000
0.61607143 0.61607143 0.00000000 1.00000000
0.64285714 0.64285714 1.00000000 1.00000000
0.66964286 0.66964286 0.00000000 1.00000000
0.69642857 0.69642857 0.00000000 1.00000000
0.72321429 0.72321429 0.00000000 1.00000000
0.75000000 0.75000000 0.00000000 1.00000000


! The above SCKPTS (and/or some other SCKPTS related to them by symm. ops. of the SCBZ)
! unfold onto the pckpts listed below (selected by you):
! k-points for PC bandstructure L-G-X-U,K-G
! 23 27 9 29
! reciprocal
! 0.50000000 0.50000000 0.50000000 L
! 0.00000000 0.00000000 0.00000000 G
! 0.50000000 0.00000000 0.50000000 X
! 0.62500000 0.25000000 0.62500000 U
!
! 0.37500000 0.37500000 0.75000000 K
! 0.00000000 0.00000000 0.00000000 G
Binary file not shown.
Binary file not shown.
41 changes: 41 additions & 0 deletions tutorials/QuantumEspresso/input/bulk_Si_nscf.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
! SYSTEM = Bulk Silicon - Self Consistent calculation
! Non-SCF calculation to generate supercell wave function file

&control
title = 'Silicon Supercell SCF',
calculation = 'bands',
restart_mode = 'restart',
prefix = 'bulk_Si', ! Output files will have this prefix
pseudo_dir = './', ! Directory where pseudopotentials are stored
disk_io = 'default'
wf_collect = .TRUE.,
/
&system
smearing = 'gaussian',
occupations = 'smearing',
lspinorb = .false.,
noncolin = .false.,
degauss = 0.005,
ibrav = 1,
A = 5.43,
nat = 8,
ntyp = 1,
ecutwfc = 35,
ecutrho = 350,
nbnd = 48
/
&electrons
conv_thr = 1.0D-6, ! Convergence threshold
mixing_beta = 0.7, ! Mixing factor for electron density
/
ATOMIC_SPECIES
Si 28.0855 Si.pbe-rrkj.UPF ! Silicon pseudopotential
ATOMIC_POSITIONS alat
Si 0.000000000 0.000000000 0.000000000
Si 0.000000000 0.500000000 0.500000000
Si 0.500000000 0.500000000 0.000000000
Si 0.500000000 0.000000000 0.500000000
Si 0.750000000 0.250000000 0.750000000
Si 0.250000000 0.250000000 0.250000000
Si 0.250000000 0.750000000 0.750000000
Si 0.750000000 0.750000000 0.250000000
Loading

0 comments on commit fdaebb7

Please sign in to comment.