Beispiel #1
0
def plot_bs(vasprun_path: str):
    try:
        v = BSVasprun(vasprun_path)
    except xml.etree.ElementTree.ParseError:
        print("\tskipped due to parse error")
        return
    bs = v.get_band_structure(kpoints_filename="KPOINTS", line_mode=True)
    plt = BSPlotter(bs)
    plt.show()
Beispiel #2
0
from pymatgen.io.vasp.outputs import BSVasprun
from pymatgen.electronic_structure.plotter import BSPlotter
import os

os.chdir('/home/jinho93/half-metal/1.CrO2/3.band')
vrun = BSVasprun('vasprun.xml')
bs = vrun.get_band_structure('KPOINTS', line_mode=True)
bsp = BSPlotter(bs)

bsp.show()
Beispiel #3
0
from pymatgen.electronic_structure.bandstructure import BandStructure
import os

# vaspout = BSVasprun("./hubbard/hub_Mn-5_Fe-5/vasprun.xml")
vaspout = BSVasprun("../calc_seq_test/bands-mag/vasprun.xml")
# 50 k-points = 0.3863000000000012 eV
# 100 k-points = 0.38480000000000114 eV
# 8x8x8 50 k-points = 0.39029999999999987 eV
# 50 k-points with LASPH = 0.3932000000000002 eV
bandstr = vaspout.get_band_structure(line_mode=True)

print(bandstr.get_band_gap())
# print(bandstr.get_direct_band_gap_dict())

plt = BSPlotter(bandstr).get_plot(ylim=[-10, 5])
plt.show()


# get band gap for all directories

def get_band_gap(directory):
    vasp_out = BSVasprun(directory + "/vasprun.xml")
    band_str = vasp_out.get_band_structure(line_mode=True)
    band_gap = band_str.get_band_gap()
    print(band_gap)
    return band_gap


get_band_gap("../calc_seq_test/bands-mag")
# for directory in os.getcwd():
#    get_band_gap(directory)
Beispiel #4
0
    print("------------------------------------------------------------")

    # POSCAR 晶体结构可视化 , 可视化需要软件VTK
    input_poscarVis = StructureVis()
    input_poscarVis.set_structure(input_structure)
    input_poscarVis.show()

    # 画能代结构图 ,
    from pymatgen.io.vasp import Vasprun, BSVasprun
    from pymatgen.electronic_structure.plotter import BSPlotter
    vasprun = BSVasprun(vasprun_path)
    bankStructure = vasprun.get_band_structure(kpoints_filename=KPOINTS,
                                               line_mode=True)
    plt = BSPlotter(bankStructure)
    # print(plt.get_ticks())              #Get all ticks and labels for a band structure plot.    return A dictionary with ‘distance’
    plt.show(ylim=(-36, 5))  # 这一行有问题。就是这个范围参数该如何得到。

    # 解析INCAR部分,应该直接打印 INCAR 中所有参数信息也是没问题的。
    incar = ParseINCAR(INCAR)
    print("------------------------------------------------------------")
    print(incar.as_dict())

    # 解析KPOINTS 部分, 需要的参数有 kpoints,  nkpoints, label,
    kpoints = ParseKPOINTS(KPOINTS)

    kPoints = kpoints['kpoints']
    nkpoints = kpoints['nkpoints']
    label = kpoints['label']
    # print(kpoints.as_dict())

    #解析OSZICAR 部分。
Beispiel #5
0
    for m in re.finditer(r"([A-Z]+)(\d+)", anon_formula)
}
data = mpr.query({"anonymous_formula": anon_formula},
                 properties=["task_id", "pretty_formula", "structure"])
print(len(data))  #Should show ~600 data.比较慢,多等一会儿。
# data now contains a list of dict. This shows you what each dict has.
# Note that the mp id is named "task_id" in the database itself.
pprint.pprint(data[0])
# # 得到“能带结构”(Getting band structures)
# 能带结构是相当大的物体。不建议你一次下载大量的绷带结构,而是直接下载你需要的。Band structures are fairly large objects. It is not recommended that you download large quantities of bandstructures in one shot, but rather just download the ones you need.
bs = mpr.get_bandstructure_by_material_id(
    "mp-20470")  #这个是material上对应的编号,需要自己去查找写自己需要的
from pymatgen.electronic_structure.plotter import BSPlotter
# %matplotlib inline
plotter = BSPlotter(bs)
plotter.show()
elastic_data = mpr.query(
    {"elasticity": {
        "$exists": True
    }},
    properties=["task_id", "pretty_formula", "elasticity"])
print(len(elastic_data))
pprint.pprint(elastic_data[0])
# # More resources
# In general, almost any data can be obtained from MP using the MPRester, either via the high-level functions or the very powerful "query" method.
# For more complex queries, you can refer to the documentation for the Materials API at https://github.com/materialsproject/mapidoc.
# # Fitting structures
# Pymatgen has its own structure matching algorithm, which we have used to effectively reduce the 130,000 structures in ICSD to ~60,000 - 70,000 structures. It is fast and accurate. Here's an example of how it works.
from pymatgen.analysis.structure_matcher import StructureMatcher

m = StructureMatcher(