vaspvis
A highly flexible and customizable library for visualizing electronic structure data from VASP calculations.
Usage
This package was designed to give VASP users a flexible and easy to understand method for generating a wide variety of band structures and density of states plots. The main modules in this package are:
BandDosstandardutils
The Band and Dos modules allow for the highest level of flexibility because the user
needs to pass in their own matplotlib axis, letting the user completely design the
external appearance of their plot. The Band and Dos modules will then parse the
VASP output data and append it to the axis.
The standard module uses the Band and Dos modules internally and
was designed for those people who are not familiar with matplotlib
or don't need to completely customize their own figure. There are a total of 56 different
styles of plots to choose from in this module. It gives the user the capability to project
onto any orbital, any atom, or any element in their structure, as well as individual orbitals
on any atom or element. There are also options for spin polarized band structures and density
of states as well, letting the user make intricate plots with only a few lines of code.
The utils module contains helper functions, for example to generate the files for band unfolding
calculations, to build and passivate slab structures, and to determine band gaps.
The package also provides the STM class for simulated STM images and the Charge class for charge
transfer analysis.
Installation
pip install vaspvis
How to Cite
To cite VaspVis please reference the following paper:
https://link.aps.org/doi/10.1103/PhysRevMaterials.5.064606
Loading Data
from vaspvis import Band, Dos
# Plain band structure
bs = Band(folder='path to vasp output folder')
# Projected band structure
bs_projected = Band(folder='path to vasp output folder', projected=True)
# Density of states (projected or non-projected)
dos = Dos(folder='path to vasp output folder')
Important Note: Band structures are parsed from the EIGENVAL, PROCAR, KPOINTS, POSCAR, INCAR, and OUTCAR files, and densities of states from the DOSCAR, POSCAR, INCAR, and OUTCAR files (the Fermi level is read from OUTCAR). Be sure that they are in the folder you load into vaspvis.
Important Note: For spin projected orbitals you must load the spin up and spin down channels separately using the spin = 'up' or spin = 'down' options when loading data. Default is spin = 'up'.
Band Unfolding
Band unfolding is useful for visualizing band structures of supercells and slab structures. The method used for calculating the band unfolded structure requires an integer transformation matrix from the bulk structure. To convert the slab structure so it has an integer matrix, the convert_slab function can be used to generate the new slab structure and also return the transformation matrix (M). More information about the band unfolding method can be found here.
from vaspvis.utils import convert_slab
# This function returns and prints out the transformation matrix (M)
M = convert_slab(
bulk_path='POSCAR_bulk', # POSCAR of the primitive bulk structure
slab_path='POSCAR_slab', # POSCAR of the slab structure
index=[1,1,1], # Miller index of the given slab structure
)
To generate the KPOINTS file for the band unfolded calculation the generate_kpoints function can be used
from vaspvis.utils import generate_kpoints
high_symmetry_points = [
[0.5,0.0,0.5], # X
[0.0,0.0,0.0], # Gamma
[0.5,0.0,0.5], # X
]
generate_kpoints(
M=M, # M can be generated with the convert slab function
high_symmetry_points=high_symmetry_points, # Special points
n=50, # Number of segments between each special point
)
To plot the band structure the Band or standard module can be used. An example using the standard module is shown below.
from vaspvis import standard as st
band_folder = 'PATH_TO_VASP_FOLDER'
# Transformation matrix generated from convert_slab
M = [
[0,1,-1],
[1,-1,0],
[-8,-8,-8]
]
high_symm_points = [
[0.5, 0.0, 0.5], # X
[0.0, 0.0, 0.0], # Gamma
[0.5, 0.0, 0.5] # X
]
# All other functions in the standard library work with band unfolding too.
st.band_plain(
folder=band_folder,
erange=[-4,0],
unfold=True,
kpath=[['X', 'G'], ['G', 'X']],
high_symm_points=high_symm_points,
n=50,
M=M,
)
Examples
The plots below were generated with exactly the code shown, from a band structure and a density of states
calculation of InAs (PBE with spin-orbit coupling). scale_factor sets the size of the projection markers.
band_folder = 'path to the band structure calculation'
dos_folder = 'path to the density of states calculation'
Band Structures
Plain Band Structure
from vaspvis import standard
standard.band_plain(
folder=band_folder
)
s, p, d Projected Band Structure
from vaspvis import standard
standard.band_spd(
folder=band_folder,
scale_factor=40,
)
Orbital Projected Band Structure
from vaspvis import standard
standard.band_orbitals(
folder=band_folder,
orbitals=[0, 1, 2, 3, 4, 5, 6, 7, 8],
scale_factor=40,
)
Atom Projected Band Structure
from vaspvis import standard
standard.band_atoms(
folder=band_folder,
atoms=[0, 1],
scale_factor=40,
)
Atom-Orbital Projected Band Structure
from vaspvis import standard
standard.band_atom_orbitals(
folder=band_folder,
atom_orbital_dict={0:[1,3], 1:[1,7]},
scale_factor=40,
)
Atom s, p, d Projected Band Structure
from vaspvis import standard
standard.band_atom_spd(
folder=band_folder,
atom_spd_dict={0:'spd'},
scale_factor=40,
)
Element Projected Band Structure
from vaspvis import standard
standard.band_elements(
folder=band_folder,
elements=['In', 'As'],
scale_factor=40,
)
Element s, p, d Projected Band Structure
from vaspvis import standard
standard.band_element_spd(
folder=band_folder,
element_spd_dict={'As':'spd'},
scale_factor=40,
)
Element Orbital Projected Band Structure
from vaspvis import standard
standard.band_element_orbitals(
folder=band_folder,
element_orbital_dict={'As':[2], 'In':[3]},
scale_factor=40,
)
Density of States
Plain Density of States
from vaspvis import standard
standard.dos_plain(
folder=dos_folder,
energyaxis='x',
)
s, p, d Projected Density of States
from vaspvis import standard
standard.dos_spd(
folder=dos_folder,
energyaxis='x',
)
Orbital Projected Density of States
from vaspvis import standard
standard.dos_orbitals(
folder=dos_folder,
orbitals=[0, 1, 2, 3, 4, 5, 6, 7, 8],
energyaxis='x',
)
Atom Projected Density of States
from vaspvis import standard
standard.dos_atoms(
folder=dos_folder,
atoms=[0, 1],
energyaxis='x',
)
Atom-Orbital Projected Density of States
from vaspvis import standard
standard.dos_atom_orbitals(
folder=dos_folder,
atom_orbital_dict={0:[1,3], 1:[1,7]},
energyaxis='x',
)
Atom s, p, d Projected Density of States
from vaspvis import standard
standard.dos_atom_spd(
folder=dos_folder,
atom_spd_dict={0:'spd'},
energyaxis='x',
)
Element Projected Density of States
from vaspvis import standard
standard.dos_elements(
folder=dos_folder,
elements=['In', 'As'],
energyaxis='x',
)
Element s, p, d Projected Density of States
from vaspvis import standard
standard.dos_element_spd(
folder=dos_folder,
element_spd_dict={'As':'spd'},
energyaxis='x',
)
Element Orbital Projected Density of States
from vaspvis import standard
standard.dos_element_orbitals(
folder=dos_folder,
element_orbital_dict={'As':[2], 'In':[3]},
energyaxis='x',
)
Band Structure / Density of States
Plain Band Structure / Density of States
from vaspvis import standard
standard.band_dos_plain(
band_folder=band_folder,
dos_folder=dos_folder,
)
s, p, d Projected Band Structure / Density of States
from vaspvis import standard
standard.band_dos_spd(
band_folder=band_folder,
dos_folder=dos_folder,
scale_factor=40,
)
Orbital Projected Band Structure / Density of States
from vaspvis import standard
standard.band_dos_orbitals(
band_folder=band_folder,
dos_folder=dos_folder,
orbitals=[0, 1, 2, 3, 4, 5, 6, 7, 8],
scale_factor=40,
)
Atom-Orbital Projected Band Structure / Density of States
from vaspvis import standard
standard.band_dos_atom_orbitals(
band_folder=band_folder,
dos_folder=dos_folder,
atom_orbital_dict={0:[1,3], 1:[1,7]},
scale_factor=40,
)
Atom Projected Band Structure / Density of States
from vaspvis import standard
standard.band_dos_atoms(
band_folder=band_folder,
dos_folder=dos_folder,
atoms=[0, 1],
scale_factor=40,
)
Element Projected Band Structure / Density of States
from vaspvis import standard
standard.band_dos_elements(
band_folder=band_folder,
dos_folder=dos_folder,
elements=['In', 'As'],
scale_factor=40,
)
Element s, p, d Projected Band Structure / Density of States
from vaspvis import standard
standard.band_dos_element_spd(
band_folder=band_folder,
dos_folder=dos_folder,
element_spd_dict={'As':'spd'},
scale_factor=40,
)
Element Orbital Projected Band Structure / Density of States
from vaspvis import standard
standard.band_dos_element_orbitals(
band_folder=band_folder,
dos_folder=dos_folder,
element_orbital_dict={'As':[2], 'In':[3]},
scale_factor=40,
)
Release files for vaspvis 1.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| vaspvis-1.4.2.tar.gz | 105.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| vaspvis-1.4.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 210.9 kB
Release files / vaspvis-1.4.2.tar.gz
| Download URL | vaspvis-1.4.2.tar.gz |
|---|---|
| Size | 105.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
287372e974c1f53eb0cf90adbe4d5abf7d2a66129f8d9726731414756c44079e
|
|
BLAKE2b-256 checksum How to use checksums |
c4ef849adea0d061451d56726b8f4c9422e9e2fa8e12a00f7c8f958d4e4204d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.11
|
Release files / vaspvis-1.4.2-py3-none-any.whl
| Download URL | vaspvis-1.4.2-py3-none-any.whl |
|---|---|
| Size | 104.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
332121d98b22007c18ea65fc732ce4c4af8c49766ab8ac37795b552223c68fa0
|
|
BLAKE2b-256 checksum How to use checksums |
9973b7c7b9ffdc18f40b207d151559edbc7d75d158cd43b457d75cc04f4a5764
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.11
|