• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python plotter.DosPlotter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pymatgen.electronic_structure.plotter.DosPlotter的典型用法代码示例。如果您正苦于以下问题:Python DosPlotter类的具体用法?Python DosPlotter怎么用?Python DosPlotter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了DosPlotter类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: get_dos_plot

def get_dos_plot(args):
    v = Vasprun(args.dos_file)
    dos = v.complete_dos

    all_dos = OrderedDict()
    all_dos["Total"] = dos

    structure = v.final_structure

    if args.site:
        for i in range(len(structure)):
            site = structure[i]
            all_dos["Site " + str(i) + " " + site.specie.symbol] = \
                dos.get_site_dos(site)

    if args.element:
        syms = [tok.strip() for tok in args.element[0].split(",")]
        all_dos = {}
        for el, dos in dos.get_element_dos().items():
            if el.symbol in syms:
                all_dos[el] = dos
    if args.orbital:
        all_dos = dos.get_spd_dos()

    plotter = DosPlotter()
    plotter.add_dos_dict(all_dos)
    return plotter.get_plot()
开发者ID:czhengsci,项目名称:pymatgen,代码行数:27,代码来源:pmg_plot.py


示例2: plot_dos

 def plot_dos(self, sigma=0.05):
     """
     plot dos
     Args:
         sigma:
             a smearing
     Returns:
         a matplotlib object
     """
     plotter = DosPlotter(sigma=sigma)
     plotter.add_dos("t", self._bz.dos)
     return plotter.get_plot()
开发者ID:hgfb,项目名称:pymatgen,代码行数:12,代码来源:boltztrap.py


示例3: plot_dos

    def plot_dos(self, T=None, npoints=10000):
        """
            Plot the total Dos using DosPlotter()
        """
        if self.bzt_interp is None:
            raise BoltztrapError("BztInterpolator not present")

        tdos = self.bzt_interp.get_dos(T=T,npts_mu=npoints)
        #print(npoints)
        dosPlotter = DosPlotter()
        dosPlotter.add_dos('Total',tdos)

        return dosPlotter
开发者ID:ExpHP,项目名称:pymatgen,代码行数:13,代码来源:boltztrap2.py


示例4: setUp

 def setUp(self):
     try:
         import scipy
     except ImportError:
         raise SkipTest("scipy not present. Skipping...")
     with open(os.path.join(test_dir, "complete_dos.json"), "r") as f:
         self.dos = CompleteDos.from_dict(json.load(f))
         self.plotter = DosPlotter(sigma=0.2, stack=True)
开发者ID:jesuansito,项目名称:pymatgen,代码行数:8,代码来源:test_plotter.py


示例5: DosPlotterTest

class DosPlotterTest(unittest.TestCase):

    def setUp(self):
        try:
            import scipy
        except ImportError:
            raise SkipTest("scipy not present. Skipping...")
        with open(os.path.join(test_dir, "complete_dos.json"), "r") as f:
            self.dos = CompleteDos.from_dict(json.load(f))
            self.plotter = DosPlotter(sigma=0.2, stack=True)

    def test_add_dos_dict(self):
        try:
            import scipy
        except ImportError:
            raise SkipTest("scipy not present. Skipping...")
        d = self.plotter.get_dos_dict()
        self.assertEqual(len(d), 0)
        self.plotter.add_dos_dict(self.dos.get_element_dos(),
                                  key_sort_func=lambda x: x.X)
        d = self.plotter.get_dos_dict()
        self.assertEqual(len(d), 4)

    def test_get_dos_dict(self):
        try:
            import scipy
        except ImportError:
            raise SkipTest("scipy not present. Skipping...")
        self.plotter.add_dos_dict(self.dos.get_element_dos(),
                                  key_sort_func=lambda x: x.X)
        d = self.plotter.get_dos_dict()
        for el in ["Li", "Fe", "P", "O"]:
            self.assertIn(el, d)
开发者ID:jesuansito,项目名称:pymatgen,代码行数:33,代码来源:test_plotter.py


示例6: main

def main():
    parser = argparse.ArgumentParser(description='''Convenient DOS Plotter for Feff runs.
    Author: Alan Dozier
    Version: 1.0
    Last updated: April, 2013''')

    parser.add_argument('filename', metavar='filename', type=str, nargs=1,
                        help='ldos%% file set to plot')
    parser.add_argument('filename1', metavar='filename1', type=str, nargs=1,
                        help='feff.inp input file ')
    parser.add_argument('-s', '--site', dest='site', action='store_const',
                        const=True, help='plot site projected DOS')
    parser.add_argument('-e', '--element', dest='element', action='store_const',
                        const=True, help='plot element projected DOS')
    parser.add_argument('-o', '--orbital', dest="orbital", action='store_const',
                        const=True, help='plot orbital projected DOS')

    args = parser.parse_args()
    f = LDos.from_file(args.filename1[0], args.filename[0])
    dos = f.complete_dos

    all_dos = OrderedDict()
    all_dos['Total'] = dos

    structure = f.complete_dos.structure

    if args.site:
        for i, site in enumerate(structure):
            all_dos['Site ' + str(i) + " " + site.specie.symbol] = \
                dos.get_site_dos(site)
    if args.element:
        all_dos.update(dos.get_element_dos())
    if args.orbital:
        all_dos.update(dos.get_spd_dos())

    plotter = DosPlotter()
    plotter.add_dos_dict(all_dos)
    plotter.show()
开发者ID:ExpHP,项目名称:pymatgen,代码行数:38,代码来源:feff_plot_dos.py


示例7: main

def main():
    parser = argparse.ArgumentParser(
        description="""Convenient DOS Plotter for Feff runs.
    Author: Alan Dozier
    Version: 1.0
    Last updated: April, 2013"""
    )

    parser.add_argument("filename", metavar="filename", type=str, nargs=1, help="ldos%% file set to plot")
    parser.add_argument("filename1", metavar="filename1", type=str, nargs=1, help="feff.inp input file ")
    parser.add_argument("-s", "--site", dest="site", action="store_const", const=True, help="plot site projected DOS")
    parser.add_argument(
        "-e", "--element", dest="element", action="store_const", const=True, help="plot element projected DOS"
    )
    parser.add_argument(
        "-o", "--orbital", dest="orbital", action="store_const", const=True, help="plot orbital projected DOS"
    )

    args = parser.parse_args()
    f = LDos.from_file(args.filename1[0], args.filename[0])
    dos = f.complete_dos

    all_dos = OrderedDict()
    all_dos["Total"] = dos

    structure = f.complete_dos.structure

    if args.site:
        for i, site in enumerate(structure):
            all_dos["Site " + str(i) + " " + site.specie.symbol] = dos.get_site_dos(site)
    if args.element:
        all_dos.update(dos.get_element_dos())
    if args.orbital:
        all_dos.update(dos.get_spd_dos())

    plotter = DosPlotter()
    plotter.add_dos_dict(all_dos)
    plotter.show()
开发者ID:shyamd,项目名称:pymatgen,代码行数:38,代码来源:feff_plot_dos.py


示例8: DosPlotterTest

class DosPlotterTest(unittest.TestCase):

    def setUp(self):
        with open(os.path.join(test_dir, "complete_dos.json"), "r",
                  encoding='utf-8') as f:
            self.dos = CompleteDos.from_dict(json.load(f))
            self.plotter = DosPlotter(sigma=0.2, stack=True)

    def test_add_dos_dict(self):
        d = self.plotter.get_dos_dict()
        self.assertEqual(len(d), 0)
        self.plotter.add_dos_dict(self.dos.get_element_dos(),
                                  key_sort_func=lambda x: x.X)
        d = self.plotter.get_dos_dict()
        self.assertEqual(len(d), 4)

    def test_get_dos_dict(self):
        self.plotter.add_dos_dict(self.dos.get_element_dos(),
                                  key_sort_func=lambda x: x.X)
        d = self.plotter.get_dos_dict()
        for el in ["Li", "Fe", "P", "O"]:
            self.assertIn(el, d)
开发者ID:AtlasL,项目名称:pymatgen,代码行数:22,代码来源:test_plotter.py


示例9: setUp

 def setUp(self):
     with open(os.path.join(test_dir, "complete_dos.json"), "r",
               encoding='utf-8') as f:
         self.dos = CompleteDos.from_dict(json.load(f))
         self.plotter = DosPlotter(sigma=0.2, stack=True)
开发者ID:AtlasL,项目名称:pymatgen,代码行数:5,代码来源:test_plotter.py


示例10: OrderedDict

                    help='feff.inp input file ')
parser.add_argument('-s', '--site', dest='site', action='store_const',
                    const=True, help='plot site projected DOS')
parser.add_argument('-e', '--element', dest='element', action='store_const',
                    const=True, help='plot element projected DOS')
parser.add_argument('-o', '--orbital', dest="orbital", action='store_const',
                    const=True, help='plot orbital projected DOS')

args = parser.parse_args()
f = FeffLdos.from_file(args.filename1[0], args.filename[0])
dos = f.complete_dos

all_dos = OrderedDict()
all_dos['Total'] = dos

structure = f.complete_dos.structure

if args.site:
    for i in xrange(len(structure)):
        site = structure[i]
        all_dos['Site ' + str(i) + " " + site.specie.symbol] = \
            dos.get_site_dos(site)
if args.element:
    all_dos.update(dos.get_element_dos())
if args.orbital:
    all_dos.update(dos.get_spd_dos())

plotter = DosPlotter()
plotter.add_dos_dict(all_dos)
plotter.show()
开发者ID:thuwangming,项目名称:pymatgen,代码行数:30,代码来源:feff_plot_dos.py


示例11: DosPlotterTest

class DosPlotterTest(unittest.TestCase):
    def setUp(self):
        with open(os.path.join(test_dir, "complete_dos.json"), "r",
                  encoding='utf-8') as f:
            self.dos = CompleteDos.from_dict(json.load(f))
            self.plotter = DosPlotter(sigma=0.2, stack=True)

    def test_add_dos_dict(self):
        d = self.plotter.get_dos_dict()
        self.assertEqual(len(d), 0)
        self.plotter.add_dos_dict(self.dos.get_element_dos(),
                                  key_sort_func=lambda x: x.X)
        d = self.plotter.get_dos_dict()
        self.assertEqual(len(d), 4)

    def test_get_dos_dict(self):
        self.plotter.add_dos_dict(self.dos.get_element_dos(),
                                  key_sort_func=lambda x: x.X)
        d = self.plotter.get_dos_dict()
        for el in ["Li", "Fe", "P", "O"]:
            self.assertIn(el, d)

    # Minimal baseline testing for get_plot. not a true test. Just checks that
    # it can actually execute.
    def test_get_plot(self):
        # Disabling latex is needed for this test to work.
        from matplotlib import rc
        rc('text', usetex=False)
        self.plotter.add_dos_dict(self.dos.get_element_dos(),
                                  key_sort_func=lambda x: x.X)
        plt = self.plotter.get_plot()
        self.plotter.save_plot("dosplot.png")
        self.assertTrue(os.path.isfile("dosplot.png"))
        os.remove("dosplot.png")
开发者ID:matk86,项目名称:pymatgen,代码行数:34,代码来源:test_plotter.py


示例12: Copyright

# coding: utf-8
# Copyright (c) Henniggroup.
# Distributed under the terms of the MIT License.

from __future__ import division, print_function, unicode_literals, \
    absolute_import

"""
reads in vasprun.xml file and plots the density of states 
"""

# To use matplotlib on Hipergator, uncomment the following 2 lines:
# import matplotlib
# matplotlib.use('Agg')

from pymatgen.io.vasp.outputs import Vasprun
from pymatgen.electronic_structure.plotter import DosPlotter

if __name__ == "__main__":
    # readin the density of states from vasprun.xml file
    run = Vasprun("vasprun.xml", parse_projected_eigen=True)
    complete_dos = run.complete_dos
    print('cbm and vbm ', complete_dos.get_cbm_vbm())
    print('gap = ', complete_dos.get_gap())
    # get orbital projected DOS.    
    spd_dos = complete_dos.get_spd_dos()
    plotter = DosPlotter()
    plotter.add_dos_dict(spd_dos)
    plotter.save_plot('dos.eps')
开发者ID:HanmeiTang,项目名称:MPInterfaces,代码行数:29,代码来源:dos.py


示例13: plot_dos

 def plot_dos(self):
     plotter = DosPlotter(sigma=0.05)
     plotter.add_dos("t", self._bz.dos)
     plotter.get_plot().show()
开发者ID:akashneo,项目名称:pymatgen,代码行数:4,代码来源:boltztrap.py


示例14: Vasprun

import os
from collections import OrderedDict
from pymatgen.core.periodic_table import Element


vasp_dir = os.path.dirname(os.path.abspath(__file__))
vasp_run = Vasprun(os.path.join(vasp_dir, "vasprun.xml"))

dos = vasp_run.complete_dos

all_dos = OrderedDict()
all_dos["Total"] = dos


elem = dos.get_element_dos()

print elem.keys()

from copy import deepcopy

AgSe = elem[Element('Ag')].__add__(elem[Element('Se')])
CH = elem[Element('C')].__add__(elem[Element('H')])

all_dos.update({'Ag+Se':AgSe,'C+H':CH})

plotter = DosPlotter(sigma=0.05)
plotter.add_dos_dict(all_dos)

plotter.get_plot(xlim=[-3,4],ylim=[0,30],width=12,height=6).savefig(filename="orgo_inorg_dos.pdf",img_format="pdf")

开发者ID:blondegeek,项目名称:clusterscripts,代码行数:29,代码来源:plot_mithrene_pdos.py



注:本文中的pymatgen.electronic_structure.plotter.DosPlotter类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python compatibility.AqueousCorrection类代码示例发布时间:2022-05-25
下一篇:
Python dos.CompleteDos类代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap