How to use Boltztrap2 pmg interface

Author: Francesco Ricci, UCLouvain, francesco.ricci@uclouvain.be

Warning: under development. Please if you find any bug or issues contact me

Here you find how to use boltztrap2 directly through pymatgen. Examples of what it is possible to do with it and which quantities can be computed from the band structure are provided.

Boltztrap2 needs to be installed. Spin polarized case partially implemented but not documented yet.

This notebook was tested with pymatgen == 2018.9.12. It should work with higher version too.

In [3]:
%notebook inline
In [4]:
from pymatgen.electronic_structure.boltztrap2 import *
from monty.serialization import loadfn
In [6]:
data = VasprunLoader().from_file('boltztrap2_data/vasprun.xml')
/home/riccif/software/github/my_pymatgen/pymatgen/pymatgen/io/vasp/outputs.py:878: UserWarning: No POTCAR file with matching TITEL fields was found in /home/riccif/software/github/matgenb/notebooks/boltztrap2_data
  " was found in {}".format(os.path.abspath(p)))
In [8]:
bs = loadfn('boltztrap2_data/PbTe_bandstructure.json')
loader = BandstructureLoader(bs,data.structure)

Interpolator

In [9]:
#set curvature=False to speed up in case you do not need effective mass or hall coeficients
bztInterp = BztInterpolator(data,lpfac=10,energy_range=1.5,curvature=True)
In [10]:
sbs = bztInterp.get_band_structure()
list(sbs.bands.values())[0].shape
Out[10]:
(5, 137)
In [11]:
tot_dos = bztInterp.get_dos()
len(tot_dos.energies)
Out[11]:
10000
In [12]:
tot_proj_dos = bztInterp.get_dos(partial_dos=True)
In [13]:
len(tot_proj_dos.get_spd_dos().values())
Out[13]:
3
In [16]:
from pymatgen.electronic_structure.plotter import DosPlotter
pltdos = DosPlotter(sigma=0.05)
pltdos.add_dos_dict(tot_proj_dos.get_element_dos())
pltdos.show()

Transport Properties

In [34]:
bztTransp = BztTransportProperties(bztInterp,temp_r = np.arange(300,1300,300))
In [35]:
print('\t'.join(['Temp', 'Doping', 'rows', 'columns tensor']))
for p in bztTransp.Conductivity_mu, bztTransp.Seebeck_mu, bztTransp.Kappa_mu, \
         bztTransp.Effective_mass_mu, bztTransp.Power_Factor_mu, bztTransp.Carrier_conc_mu:
    print('\t'.join([str(i) for i in p.shape]))
Temp	Doping	rows	columns tensor
4	3208	3	3
4	3208	3	3
4	3208	3	3
4	3208	3	3
4	3208	3	3
4	3208
In [36]:
bztTransp.compute_properties_doping(doping=10.**np.arange(16,23))
In [37]:
print('\t'.join(['Temp', 'Doping', 'rows', 'columns tensor']))
for p in bztTransp.Conductivity_doping, bztTransp.Seebeck_doping, bztTransp.Kappa_doping, \
         bztTransp.Effective_mass_doping, bztTransp.Power_Factor_doping:
    print('\t'.join([str(i) for i in p['n'].shape]))
Temp	Doping	rows	columns tensor
4	7	3	3
4	7	3	3
4	7	3	3
4	7	3	3
4	7	3	3

Plotter

In [38]:
bztPlotter = BztPlotter(bztTransp,bztInterp)
In [39]:
bztPlotter.plot_props('C','mu','temp')
Out[39]:
<module 'matplotlib.pyplot' from '/home/riccif/.local/lib/python3.5/site-packages/matplotlib/pyplot.py'>
In [40]:
bztPlotter.plot_props('S','mu','temp',temps=[600,900,1200])
Out[40]:
<module 'matplotlib.pyplot' from '/home/riccif/.local/lib/python3.5/site-packages/matplotlib/pyplot.py'>
In [41]:
bztPlotter.plot_props('S','doping','temp', temps=[600,900,1200], dop_type='p').show()
In [42]:
bztPlotter.plot_props('S','temp','doping',doping=[1e16,1e20], dop_type='n').show()
In [43]:
bztPlotter.plot_props('K','mu','temp',temps=[600,900,1200]).show()
In [52]:
bztPlotter.plot_props('H','mu','temp',temps=[600,900,1200]).show()
In [45]:
bztPlotter.plot_props('Po','doping','temp',temps=[600,900,1200],dop_type='p').show()
In [48]:
bztPlotter.plot_props('E','doping','temp').show()
In [53]:
bztPlotter.plot_props('Ca','mu','temp',temps=[600,900,1200]).show()