GithubHelp home page GithubHelp logo

gvallverdu / bandstructureplots Goto Github PK

View Code? Open in Web Editor NEW
47.0 11.0 41.0 7.3 MB

Band structure plots using pymatgen and a rgb scale to look at atomic or orbital contributions.

License: MIT License

Python 96.94% Shell 3.06%

bandstructureplots's Introduction

pymatgen 3.6.0

Band Structure Plots

This repository contains several examples of band structure plots using a rgb scale to look at atomic or orbital contributions. The plots are done with pymatgen and matplotlib. In order to use the scripts on your own systems you have to read the band structure from your calculations and to obtain a pymatge.electronic_structure.bandstructure.BandStructure object.

Silicon

Examples

The reported examples are done using python3 and pymatgen version 3.6.0. The band structure calculations were done with VASP.

  • copper : Cu_bands/
  • silicon : Si_bands/
  • graphene : graphene/

The available band structure examples are not accurate calculations. The calculation were used in order to show the results of the code. You have to do your own calculculations, even if you are working on the same systems.

More examples :

Questions, remarks, comments, bug reports

If you have any questions, remarks, comments, suggestions or if you find any bug, please open an issue on this github repository.

Licence

The code is delivered under the MIT Licence.

bandstructureplots's People

Contributors

gvallverdu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bandstructureplots's Issues

Get an error when using bands_Si.py as template to plot my system

Hi Germain,
Thank you for your code!
I used your bands_Si.py as template to plot the DOS and band structure for my system.
I ran into an Error that :

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
/Users/hbliu/plot_bandos_test.py in <module>()
     83     for b in range(bands.nb_bands):
     84         for k in range(len(bands.kpoints)):
---> 85             sc = pbands[Spin.up][b][k][name]["s"]**2
     86             pc = pbands[Spin.up][b][k][name]["p"]**2
     87             dc = pbands[Spin.up][b][k][name]["d"]**2
KeyError: <Spin.up: 1>

Do you have any idea to fix this error? Thank you so much!

graphene band structure and dos

Dear Germain,

First of all, I want to say that you wrote a very nice script for plotting the orbital-projected band structure of graphene.

However, it seems that there is a finite gap in the dos (which should be vanishing in graphene due to its gapless feature). Do you know how to remove this gap as well as how to set appropriate parameters in INCAR file ? Thanks a lot in advance.

Best,
Lee

Distance between k-points

Dear Germain,
Thank you very much for your code.
Don't you know yet, how to make different distances between k-points?
Where could be find an information about?
Thank you very much!

projected bands with SOC

Dear sir,
thank you for sharing this very useful code. I would like to know if it is possible to calculated orbital projected band structure for systems with spin-orbit coupling. Thanks in advance!

best,
Rajdeep Banerjee
PhD
JNCASR, Bangalore
India

About figure

Hello Germain,

Thank you so much for such a nice script. I can run it and get plots. I have small question about image format.
When I run it on cluster and save the image as .pdf, .jpg or any other supported format, and move it to my local computer , I cannot see my Image, it appears blank.

Here I have attached files as they appear.

Thanks in advance.

band_structure_mos2
band_plot

Problems with outdated modules

Dear Vallverdu,

I am trying to follow your template "bands_Si.py" to plot my bandstructures and DOS calculated with VASP but i keep running into problems because of outdated modules. Is a similar template with the newest modules of pymatgen available? Any help or pointers will be greatly appreciated.

Best regards,

How to plot the band structure for specific orbital?

Hi,

I have run the script successfully. Thank you for this nice script. I have few questions..

  1. In case of spin-polarization, How to plot bands for both spin(spin up and spin down)?

  2. I am interested to look DOS and band structure near Fermi level. How can I specify the energy range in the plot?

  3. Is is possible to plot the band structure with specific orbital(like the DOS of d_xy, d_yz……or t_2g and e_g)?

Energy Range Problem

Dear Users
I want to plot bandstructure and DOS in the specific range. I have changed the value code as given below,but it does not effect on plot,Secondly I also want to delete the gap between DOS and Bandstructure diagram.please suggest solution.
Thanks in Advance

emin =5. 
emax =-5.
for spin in bands.bands.keys():
   for b in range(bands.nb_bands):
       emin = min(emin, min(bands.bands[spin][b]))
       emax = max(emax, max(bands.bands[spin][b]))

emin -= bands.efermi + 1
emax -= bands.efermi - 1

ax1.set_ylim(emin, emax)
ax2.set_ylim(emin, emax)

image

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 !)

bandplot for atoms

Hi Sir,

How to plot band for different atoms in same graphe taking their overall orbital contribution?

Thank you in advance

How to plot the band structure for more than three specific orbital?

Hi Germain,
Thanks for your script
I calculated the band structure of GaAs using VASP. I want to plot s & p orbital of Ga-atom and s & p orbital of As-atom. In the all script, you plotted only three orbital with three different color.
Can you give any suggestion,
How to plot the band structure for specific orbital [ Ga (s, p), As (s, p)]?

Two warnings

Hi,
im evaluating my DFT calculation from vasp with your plotting python script.
When im executing i receive two warnings:

/usr/local/lib/python2.7/dist-packages/pymatgen/io/vasp/outputs.py:543: UserWarning: Final e_wo_entrp differs from the final electronic step. VASP may have included some corrections, e.g., vdw. Vasprun will return the final e_wo_entrp, i.e., including corrections in such instances.
  warnings.warn("Final e_wo_entrp differs from the final "

/usr/lib/pymodules/python2.7/matplotlib/collections.py:548: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  if self._edgecolors == 'face':

What can i do to avoid that warnings?

Nevertheless the PDOS and Bandstructure are looking good.

Thanks for your great work!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.