bandstructureplots
bandstructureplots copied to clipboard
BandStructure of complex compounds include more than one branch
Hi I'm currently trying to plot bandstructures of compounds that have at least 3 branches in their HighSymmKPath. Your code relies on the fact that you have only one branch and that the highSymmetry Kpoints are evenly spaced. I developped the following addition to your code : although it does not renders as beautifully as yours, it has the advantage of providing labels and index of all the Kpoints in all the branches :
(as i am new to git hub, i don't know exactly how to submit a pull that is not fully finished so i post it here) : I would replace the following lines :
labels
nlabs = len(labels) step = len(bands.kpoints) / (nlabs - 1) for i, lab in enumerate(labels): ax1.vlines(i * step, emin, emax, "k") ax1.set_xticks([i * step for i in range(nlabs)]) ax1.set_xticklabels(labels)
ax1.set_xlim(0, len(bands.kpoints))
With this code :
#Scanning the branches in the HighSymmKpath index=0 branch_list=[] while index < len(bands.kpoints) : branch=bands.get_branch(index)[0] branch_list.append(branch) index=branch['end_index']+2
print(branch_list)
#Scanning the branch_list to extract start and end points of those branches point_list=[] for i,branch in enumerate(branch_list) : pt=[branch['start_index'] , branch['name'].split("-")[0]] # print(pt,i) #if the previous end point is the same as the current start one, we dont ass it if i==0 or (pt[1] != point_list[-1][1]) : point_list.append(pt) point_list.append([branch['end_index'] , branch['name'].split("-")[-1]])
print(point_list)
#adding the HighSymm Kpoints through their labels and index for point in point_list : p=ax.vlines(point[0],emin, emax,"k")
Xticks=ax.set_xticks([point_list[i][0] for i in range(len(point_list))]) Xtickslabel=ax.set_xticklabels([point_list[i][1] for i in range(len(point_list))])
Thanks
(See You in January !)
Hello, It's been a long time but did you finally use this ? If you can provide me a complete script example I can integrate it to the repository. See you germain