File size: 1,061 Bytes
03a6065
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os

from matminer.datasets import load_dataset
from mp_api.client import MPRester

import pymatviz as pmv
from pymatviz.structure_viz import structure_2d_plotly, structure_2d
from pymatviz.enums import ElemColorScheme, Key

from pymatgen.electronic_structure.plotter import BSDOSPlotter

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from tqdm import tqdm

MP_API_KEY = ""
MID = ["mp-353", "mp-661", "mp-856", "mp-1000", "mp-1479", "mp-2284", "mp-2294", "mp-10044", "mp-10086", "mp-10910", "mp-18905", "mp-23231", "mp-36526", "mp-861883", "mp-862786"]

for mid in MID:
    if os.path.exists(f"{mid}-eb-dos.png"):
        print(f"{mid}-eb-dos.png already exists, skipping...")
        continue

    with MPRester(MP_API_KEY) as mpr:
        bs = mpr.get_bandstructure_by_material_id(mid)
        dos = mpr.get_dos_by_material_id(mid)

    plotter = BSDOSPlotter(cb_energy_range=8)
    fig = plt.figure()
    fig = plotter.get_plot(bs, dos)
    plt.tight_layout()
    plt.savefig(f"{mid}-eb-dos.png", dpi=300, bbox_inches="tight")