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:32] – jglan | exercises:common:bs [2023/01/17 20:39] (current) – jglan | ||
|---|---|---|---|
| Line 22: | Line 22: | ||
| | | ||
| & | & | ||
| + | UKS | ||
| BASIS_SET_FILE_NAME | BASIS_SET_FILE_NAME | ||
| POTENTIAL_FILE_NAME | POTENTIAL_FILE_NAME | ||
| Line 181: | Line 182: | ||
| gnuplot> | gnuplot> | ||
| </ | </ | ||
| - | <file python | + | <file python |
| - | # | + | import numpy as np |
| - | """ | + | import matplotlib.pyplot as plt |
| - | Convert the CP2K band structure output to CSV files | + | |
| - | """ | + | |
| - | import re | + | file=np.genfromtxt(' |
| - | import argparse | + | |
| - | SET_MATCH | + | bs = open ('WO3.bs','r') |
| - | [ ]* | + | line = bs.readline().split() |
| - | SET: [ ]* (? | + | num_points, num_k_points, |
| - | | + | sp=["" |
| - | \n | + | i=0 |
| - | (? | + | for i in range(num_points): |
| - | | + | |
| - | ) | + | sp[i] = line[7] |
| - | ''', | + | |
| - | SPOINTS_MATCH = re.compile(r''' | ||
| - | [ ]* | ||
| - | POINT [ ]+ (? | ||
| - | ''', | ||
| - | POINTS_MATCH | + | new=np.resize(file, |
| - | [ ]* | + | ener=new[:,:,1:2] |
| - | Nr\. [ ]+ (? | + | ener=np.resize(new[:,:,1:2],(num_k_points*2, |
| - | Spin [ ]+ (? | + | num_homo = len(new[:,:,2][1][new[:,:,2][1]==1]) |
| - | K-Point | + | num_lumo = len(new[:,:,2][1][new[:,:,2][1]==0]) |
| - | \n | + | |
| - | [ ]* (? | + | |
| - | (? | + | |
| - | | + | |
| - | ) | + | |
| - | ''', | + | |
| - | if __name__ == ' | + | for i in range(num_homo): |
| - | | + | |
| - | | + | for i in range(num_lumo): |
| - | help=" | + | |
| - | args = parser.parse_args() | + | #plt.ylim([-4,6]) |
| - | + | plt.xlim([0, | |
| - | with open(args.bsfilename, ' | + | plt.xticks(np.linspace(0,num_k_points-1, |
| - | for kpoint_set in SET_MATCH.finditer(fhandle.read()): | + | plt.ylabel("Energy |
| - | | + | plt.show() |
| - | kpoint_set.group(' | + | |
| - | set_content = kpoint_set.group(' | + | |
| - | + | ||
| - | with open(filename, ' | + | |
| - | print((" | + | |
| - | " | + | |
| - | | + | |
| - | + | ||
| - | print(" | + | |
| - | for point in SPOINTS_MATCH.finditer(set_content): | + | |
| - | print(" | + | |
| - | **point.groupdict())) | + | |
| - | + | ||
| - | for point in POINTS_MATCH.finditer(set_content): | + | |
| - | results = point.groupdict() | + | |
| - | results[' | + | |
| - | | + | |
| </ | </ | ||
exercises/common/bs.1662651133.txt.gz · Last modified: by jglan
