-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de22f6e
commit a07d27d
Showing
6 changed files
with
121 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,51 @@ | ||
import sys | ||
|
||
import numpy as np | ||
from h5 import HDFArchive | ||
from scipy.constants import physical_constants | ||
|
||
### | ||
# This script read bdft output and dump g0w0 eigenvalues to si.eig for wannier90 interpolation | ||
### | ||
|
||
# first arg is the h5 to use | ||
if len(sys.argv) < 2: | ||
print ("Usage: python qp_evs_to_eig.py <h5>") | ||
quit() | ||
print('h5 archive:', str(sys.argv[1])) | ||
bdft_output = str(sys.argv[1]) | ||
|
||
Hartree_eV = physical_constants['Hartree energy in eV'][0] | ||
|
||
###### params ###### | ||
# bdft output is defined by "ouptut" in "evgw0" block. | ||
# number of bands used in wannier90. | ||
# It should be consistent with "num_bands" in si.win | ||
nbnd_pp = 3 | ||
# number of bands to include in the beginning | ||
excl = 20 | ||
# iteration of evGW0 | ||
it = None | ||
# seed for w90 | ||
seed = 'svo' | ||
|
||
############ | ||
############ | ||
|
||
# Read evGW0 eigenvalues | ||
with HDFArchive(bdft_output, 'r') as ar: | ||
if not it: | ||
it = ar['scf']['final_iter'] | ||
eig = ar[f'scf/iter{it}/E_ska'].real * Hartree_eV | ||
|
||
|
||
# Write eigenvalues in the format of Quantum Espresso .eig file | ||
ns, nkpts, nbnd_gw = eig.shape | ||
with open(f'{seed}.eig', 'w') as f: | ||
for k in range(1, nkpts+1): | ||
for i in range(excl+1, excl+nbnd_pp+1): | ||
f.write(" {} {} {}\n".format(i-excl, k, eig[0, k-1, i-1])) | ||
|
||
def extract_qp_eig(): | ||
r""" | ||
This script read bdft output and dump g0w0 eigenvalues to si.eig for wannier90 interpolation | ||
""" | ||
|
||
# first arg is the h5 to use | ||
if len(sys.argv) < 2: | ||
print('Usage: python qp_evs_to_eig.py <h5>') | ||
quit() | ||
print('h5 archive:', str(sys.argv[1])) | ||
bdft_output = str(sys.argv[1]) | ||
|
||
Hartree_eV = physical_constants['Hartree energy in eV'][0] | ||
|
||
###### params ###### | ||
# bdft output is defined by "ouptut" in "evgw0" block. | ||
# number of bands used in wannier90. | ||
# It should be consistent with "num_bands" in si.win | ||
nbnd_pp = 3 | ||
# number of bands to include in the beginning | ||
excl = 20 | ||
# iteration of evGW0 | ||
it = None | ||
# seed for w90 | ||
seed = 'svo' | ||
|
||
############ | ||
############ | ||
|
||
# Read evGW0 eigenvalues | ||
with HDFArchive(bdft_output, 'r') as ar: | ||
if not it: | ||
it = ar['scf']['final_iter'] | ||
eig = ar[f'scf/iter{it}/E_ska'].real * Hartree_eV | ||
|
||
# Write eigenvalues in the format of Quantum Espresso .eig file | ||
ns, nkpts, nbnd_gw = eig.shape | ||
with open(f'{seed}.eig', 'w') as f: | ||
for k in range(1, nkpts + 1): | ||
for i in range(excl + 1, excl + nbnd_pp + 1): | ||
f.write(' {} {} {}\n'.format(i - excl, k, eig[0, k - 1, i - 1])) | ||
|
||
|
||
if __name__ == '__main__': | ||
extract_qp_eig() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters