exercises:common:bs
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
exercises:common:bs [2022/09/08 15:29] – jglan | exercises:common:bs [2023/01/17 20:39] (current) – jglan | ||
---|---|---|---|
Line 2: | Line 2: | ||
- | In this exercise, we will carry out band structure calculation using K-point sampling for Cubic lattice WO$_3$. The reference DOS and band structure you can find in [[http:// | + | In this exercise, we will carry out band structure calculation using K-point sampling for Cubic lattice WO$_3$. The reference DOS and band structure you can find in [[http:// |
{{: | {{: | ||
+ | <note important> | ||
+ | Band structure calculations using high-level electronic structure theory, such as hybrid functionals are not available in CP2K. | ||
+ | </ | ||
To get the band structure for < | To get the band structure for < | ||
Line 19: | Line 22: | ||
| | ||
& | & | ||
+ | UKS | ||
BASIS_SET_FILE_NAME | BASIS_SET_FILE_NAME | ||
POTENTIAL_FILE_NAME | POTENTIAL_FILE_NAME | ||
Line 178: | Line 182: | ||
gnuplot> | gnuplot> | ||
</ | </ | ||
- | <file python | + | <file python |
- | # | + | import |
- | """ | + | import |
- | Convert the CP2K band structure output to CSV files | + | |
- | """ | + | |
- | + | ||
- | import | + | |
- | import | + | |
- | + | ||
- | SET_MATCH = re.compile(r''' | + | |
- | [ ]* | + | |
- | SET: [ ]* (? | + | |
- | TOTAL [ ] POINTS: [ ]* (? | + | |
- | \n | + | |
- | (? | + | |
- | [\s\S]*? | + | |
- | ) | + | |
- | ''', | + | |
- | + | ||
- | SPOINTS_MATCH = re.compile(r''' | + | |
- | [ ]* | + | |
- | POINT [ ]+ (? | + | |
- | ''', | + | |
- | + | ||
- | POINTS_MATCH = re.compile(r''' | + | |
- | [ ]* | + | |
- | Nr\. [ ]+ (? | + | |
- | Spin [ ]+ (? | + | |
- | K-Point [ ]+ (? | + | |
- | \n | + | |
- | [ ]* (? | + | |
- | (? | + | |
- | [\s\S]*? | + | |
- | ) | + | |
- | ''', | + | |
- | if __name__ | + | file=np.genfromtxt('WO3.bs') |
- | parser = argparse.ArgumentParser(description=__doc__) | + | |
- | parser.add_argument('bsfilename', | + | |
- | help=" | + | |
- | args = parser.parse_args() | + | bs = open ('WO3.bs',' |
+ | line = bs.readline().split() | ||
+ | num_points, num_k_points, | ||
+ | sp=["" | ||
+ | i=0 | ||
+ | for i in range(num_points): | ||
+ | line = bs.readline().split() | ||
+ | sp[i] = line[7] | ||
- | with open(args.bsfilename, | ||
- | for kpoint_set in SET_MATCH.finditer(fhandle.read()): | ||
- | filename = " | ||
- | kpoint_set.group(' | ||
- | set_content = kpoint_set.group(' | ||
- | with open(filename, ' | + | new=np.resize(file, |
- | | + | ener=new[:,:,1:2] |
- | " | + | ener=np.resize(new[:,:, |
- | | + | num_homo = len(new[:,:, |
+ | num_lumo = len(new[:,:, | ||
- | print(" | + | for i in range(num_homo): |
- | for point in SPOINTS_MATCH.finditer(set_content): | + | plt.plot(ener[i,: |
- | | + | for i in range(num_lumo): |
- | **point.groupdict())) | + | plt.plot(ener[i+num_homo,:: |
- | for point in POINTS_MATCH.finditer(set_content): | + | #plt.ylim([-4,6]) |
- | | + | plt.xlim([0, |
- | results[' | + | plt.xticks(np.linspace(0, |
- | | + | plt.ylabel("Energy (eV)") |
+ | plt.show() | ||
</ | </ |
exercises/common/bs.txt · Last modified: 2023/01/17 20:39 by jglan