当前位置: 首页>>代码示例>>Python>>正文


Python Vasp.nelect方法代码示例

本文整理汇总了Python中pylada.vasp.Vasp.nelect方法的典型用法代码示例。如果您正苦于以下问题:Python Vasp.nelect方法的具体用法?Python Vasp.nelect怎么用?Python Vasp.nelect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pylada.vasp.Vasp的用法示例。


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

示例1: test_nelect

# 需要导入模块: from pylada.vasp import Vasp [as 别名]
# 或者: from pylada.vasp.Vasp import nelect [as 别名]
def test_nelect():
    from os.path import dirname
    from pickle import loads, dumps
    from pylada.vasp import Vasp
    from pylada.crystal import Structure

    structure = Structure([[0, 0.5, 0.5], [0.5, 0, 0.5], [0.5, 0.5, 0]],
                          scale=5.43, name='has a name')\
        .add_atom(0, 0, 0, "Si")\
        .add_atom(0.25, 0.25, 0.25, "Si")
    a = Vasp()
    a.add_specie = "Si", "{0}/pseudos/Si".format(dirname(__file__))
    assert a.extraelectron is None
    assert a._input['extraelectron'].output_map() is None
    assert a._input['nelect'].output_map() is None
    a.extraelectron = 0
    assert a.extraelectron == 0
    assert a.nelect is None
    assert a._input['extraelectron'].output_map() is None
    assert a._input['nelect'].output_map() is None
    a.extraelectron = 1
    assert a.extraelectron == 1
    assert a.nelect is None
    assert 'nelect' in a._input['extraelectron'].output_map(vasp=a, structure=structure)
    assert abs(float(a._input['extraelectron'].output_map(
        vasp=a, structure=structure)['nelect']) - 9.0) < 1e-8
    assert a._input['nelect'].output_map() is None
    a.nelect = 1
    a.extraelectron = -1
    assert a.extraelectron == -1
    assert a.nelect is None
    assert 'nelect' in a._input['extraelectron'].output_map(vasp=a, structure=structure)
    assert abs(float(a._input['extraelectron'].output_map(
        vasp=a, structure=structure)['nelect']) - 7.0) < 1e-8
    assert a._input['nelect'].output_map() is None
    o = a._input['extraelectron']
    d = {'ExtraElectron': o.__class__}
    assert repr(eval(repr(o), d)) == repr(o)
    assert abs(float(eval(repr(o), d).output_map(
        vasp=a, structure=structure)['nelect']) - 7.0) < 1e-8
    assert repr(loads(dumps(o))) == repr(o)

    a.nelect = 8
    assert a.nelect == 8
    assert a.extraelectron is None
    assert 'nelect' in a._input['nelect'].output_map()
    assert abs(float(a._input['nelect'].output_map()['nelect']) - 8.0) < 1e-8
    assert a._input['extraelectron'].output_map() is None
    o = a._input['nelect']
    d = {'NElect': o.__class__}
    assert repr(eval(repr(o), d)) == repr(o)
    assert abs(float(eval(repr(o), d).output_map()['nelect']) - 8.0) < 1e-8
    assert repr(loads(dumps(o))) == repr(o)
开发者ID:pylada,项目名称:pylada-light,代码行数:55,代码来源:test_vasp_nelect.py


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