IFermi
IFermi is a package which provides tools for plotting Fermi surfaces from DFT output. IFermi is also useful for visualisation of slices of the three-dimensional Fermi surface along a specified plane. The idea is to provide tools which allow for more tailored Fermi surface plots than what is currently offered by other packages.
The main features include:
-
Plotting of three-dimensional Fermi surfaces, with interactive plotting supported by mayavi, plotly and matplotlib (see recommended libraries below).
-
Taking a slice of a three-dimensional Fermi surface along a specified plane and plotting the resulting contour.
Dependencies on external libraries:
- VASP calculations are imported using Pymatgen.
- Band interpolation is carried out using BoltzTraP2.
- Plotting is supported in Mayavi, Plotly and Matplotlib.
- I recommend using Mayavi or Plotly for three-dimensional Fermi surface visualisation. Plotly is selected by deafult.
The code currently primarily supports VASP calculations, but will soon be extended to other platforms supported by Pymatgen (Quantum Espresso, Questaal, etc.)
Installation
IFermi can be installed with the command:
pip install ifermi
Usage
IFermi can be used from the command-line or from a python API. The built-in
help (-h) option for each command provides a summary of the
available options.
To generate the three-dimensional Fermi surface with default parameters one can just run the command:
ifermi
Alternatively, to plot a two-dimensional slice of a Fermi surface along the plane specified by the miller indices (A B C) and at a distance d, run the command
ifermi --slice A B C d
Python interface
ifermi is made up of a number of classes for building and plotting Fermi surfaces. This includes:
FermiSurface: stores isosurfaces at the Fermi-level for use in plotting, as well as other useful structural information.FermiSlice: A two-dimesnional slice of the FermiSurface along a specified plane (The plane is specified with Miller indices)WignerSeitzCell: Represents the lattice's Wigner-Seitz brillouin zoneReciprocalCell: Represents the lattice's standard reciprocal cellInterpolator: Takes energies specified on a uniform k-mesh and interpolates this to a finer k-mesh.FermiSurfacePlotter: Given a FermiSurface object, produces an interactive plotFermiSlicePlotter: Given a FermiSlice object, produces a two-dimensional plot of that object
A minimal working example for plotting the 3d Fermi surface of MgB2 from a POSCAR file and Vasprun.xml file is:
import os
import sys
from pymatgen.io.vasp.outputs import Vasprun
def find_vasprun_file():
"""Search for vasprun files from the current directory.
Will look for vasprun.xml or vasprun.xml.gz files.
"""
for file in ["vasprun.xml", "vasprun.xml.gz"]:
if os.path.exists(file):
return file
print("ERROR: No vasprun.xml found in current directory")
sys.exit()
if __name__ == '__main__':
from ifermi.fermi_surface import FermiSurface
from ifermi.interpolator import Interpolater
from ifermi.plotter import FermiSurfacePlotter
# create a Pymatgen BandStructure object from a vasprun file
filename = find_vasprun_file()
vr = Vasprun(filename)
bs = vr.get_band_structure()
# interpolate the energies to a finer k-point mesh, specified by the interpolate_factor
interpolater = Interpolater(bs)
interpolate_factor = 8
interp_bs, kpoint_dim = interpolater.interpolate_bands(interpolate_factor)
# create a FermiSurface object from the resulting energy mesh
# the Fermi-level can be displaced by changing 'mu' to a non-zero value
fs = FermiSurface.from_band_structure(
interp_bs, kpoint_dim, mu=0.0, wigner_seitz=True,
)
# Create a FSPlotter object
plotter = FermiSurfacePlotter(fs)
# specify the directory and prefix of the plot name
# create and save the plot
plotter.plot(plot_type='mayavi', interactive=True)
Example output
An example of the output generated by ifermi for MgB2 is shown below:
And for a slice taken along the plane specified by the Miller index (0 0 0.5):
Detailed requirements
ifermi is currently compatible with Python 3.5+ and relies on a number of open-source python packages, specifically:
Contributing
If you think that the code could use some improvement or added functionality, send a push request to the GitHub page. I would greatly appreciate any contributions.
License
IFermi is made available under the MIT License.
Acknowledgements
Alex Ganose for help developing/improving code. Sinead Griffin for suggesting the project.
Metadata
Release files for ifermi 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ifermi-0.0.4.tar.gz | 24.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ifermi-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 51.3 kB
Release files / ifermi-0.0.4.tar.gz
| Download URL | ifermi-0.0.4.tar.gz |
|---|---|
| Size | 24.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
99b0789671d8a5952eb5c5e6a78881538acc006594c8c013a1ee5f28ed7e7009
|
|
BLAKE2b-256 checksum How to use checksums |
407fbf846b96b255b4f6e28b57d8782b7f13196168e0e788505aefd03369a9f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7
|
Release files / ifermi-0.0.4-py3-none-any.whl
| Download URL | ifermi-0.0.4-py3-none-any.whl |
|---|---|
| Size | 27.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
73178472fbc6c490ecd5b436416b821d6640e33700568a2bcee8d4fcf4867287
|
|
BLAKE2b-256 checksum How to use checksums |
c99dc0a0b7ebfcc0d31ffb713be34db8785a4eae69c74127693f7c13e800e8a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7
|