-
Notifications
You must be signed in to change notification settings - Fork 0
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
Woochang Kim
committed
Jun 29, 2023
1 parent
4ede94b
commit 0595a00
Showing
175 changed files
with
172,479 additions
and
27 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
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import numpy as np | ||
from fft_mod import put_FFTbox2, ifft_g2r | ||
|
||
data_g = np.load('./vxc_pw2bgw.npy') | ||
gvec = np.loadtxt('./vxc_gvec.txt',dtype=np.int32) | ||
fn = 'vxc_pw2bgw_FFTbox' | ||
n1, n2, n3 = 18, 18, 135 | ||
data_g_FFTbox = put_FFTbox2(data_g, gvec, [n1,n2,n3], noncolin=False) | ||
data_r_FFTbox = ifft_g2r(data_g_FFTbox) | ||
np.save(fn, data_r_FFTbox) |
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
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
1,226 changes: 1,226 additions & 0 deletions
1,226
WS2/LDA_SG15/2.1-wfn/zerocore/WS2.save/data-file-schema.xml
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#!/usr/bin/env python | ||
import h5py | ||
from numpy import * | ||
import os | ||
from os.path import exists | ||
from scipy.spatial import KDTree | ||
bohr = 0.529177211 #Angstrom | ||
|
||
|
||
def main(): | ||
ibnd_lst = list(range(1, 20+1)) | ||
ik_lst = list(range(1,36+1)) | ||
savedir = './npy.save' | ||
for ik in ik_lst: | ||
print('Working on ik:',ik) | ||
unkg_blst, miller_ids = h5tonpy(ik, ibnd_lst) | ||
save(savedir+f'/Gvecs_k{ik}.npy', miller_ids) | ||
save(savedir+f'/Unkg_k{ik}.npy', unkg_blst) | ||
return None | ||
|
||
|
||
def h5tonpy(ik, ibnd_lst): | ||
wfc_fn = 'WS2.save/wfc'+str(ik)+'.hdf5'.format(ik) | ||
unkg_set, miller_ids, npol = read_wfc(wfc_fn) | ||
|
||
return unkg_set[ibnd_lst[0]-1:ibnd_lst[-1],:], miller_ids | ||
|
||
|
||
|
||
def read_wfc(fn): | ||
|
||
#Read wfc file | ||
print("Read ",fn) | ||
f = h5py.File(fn) | ||
|
||
gamma_only = f.attrs['gamma_only'] # bool | ||
igwx = f.attrs['igwx'] # int | ||
ik = f.attrs['ik'] # int k-point index | ||
ispin = f.attrs['ispin'] # int | ||
nbnd = f.attrs['nbnd'] # int | ||
ngw = f.attrs['ngw'] # int | ||
npol = f.attrs['npol'] # int | ||
scale_factor = f.attrs['scale_factor'] #float | ||
xk = f.attrs['xk'] # 3 components array in Bohr^-1? | ||
|
||
miller_ids = array(f['MillerIndices']) # (3 x 3) | ||
# savetxt('miller_ids.{0:03d}.txt'.format(ik),miller_ids) | ||
print("\nMiller indices are saved in a text file") | ||
rec_latt = zeros((3,3)) | ||
rec_latt[0,:] = array(f['MillerIndices'].attrs['bg1']) | ||
rec_latt[1,:] = array(f['MillerIndices'].attrs['bg2']) | ||
rec_latt[2,:] = array(f['MillerIndices'].attrs['bg3']) | ||
|
||
#rec_latt = (2*pi/alat)*rec_latt | ||
|
||
|
||
evc = array(f['evc']) | ||
if npol == 2: | ||
print('\nReading non-colinear spinor wavefunction') | ||
unkg_set = read_evc_non_colinear(evc, igwx, nbnd) | ||
else: | ||
unkg_set = read_evc(evc, igwx, nbnd) | ||
# savetxt('unkg.{0:03d}.txt'.format(ik),unkg_set) | ||
# print("\nWavefunctions are saved in a text file") | ||
return unkg_set, miller_ids, npol | ||
|
||
|
||
def read_evc(evc, igwx, nbnd): | ||
|
||
print('converting the wavefunction coefficents to numpy format') | ||
psi_k_set = zeros((nbnd,igwx), dtype=complex64) | ||
for n, row in enumerate(evc): | ||
psi = add(row[::2], 1j*row[1::2]) | ||
psi_k_set[n,:] = psi | ||
|
||
print('converting a wavefunction file is done') | ||
|
||
return psi_k_set | ||
|
||
|
||
def read_evc_non_colinear(evc, igwx, nbnd): | ||
#if npol == 2 the len of array will be doulbed | ||
|
||
print('converting the wavefunction coefficents to numpy format') | ||
psi_k_set = zeros((nbnd,igwx*2), dtype=complex64) | ||
for n, row in enumerate(evc): | ||
psi = add(row[::2], 1j*row[1::2]) | ||
psi_k_set[n,:] = psi | ||
|
||
print('converting a wavefunction file is done') | ||
|
||
return psi_k_set | ||
|
||
|
||
|
||
if __name__=='__main__': | ||
main() |
Oops, something went wrong.