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


Python Vasp.smearings方法代码示例

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


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

示例1: test_typed

# 需要导入模块: from pylada.vasp import Vasp [as 别名]
# 或者: from pylada.vasp.Vasp import smearings [as 别名]
def test_typed():
  from pylada.vasp import Vasp
  from pylada.error import ValueError
  a = Vasp()

  assert a.nbands is None
  assert a._input['nbands'].keyword == 'nbands'
  assert a._input['nbands'].output_map() is None

  a.nbands = 50
  assert a.nbands == 50
  assert 'nbands' in a._input['nbands'].output_map()
  assert a._input['nbands'].output_map()['nbands'] == str(a.nbands)
  a.nbands = '51'
  assert a.nbands == 51
  assert 'nbands' in a._input['nbands'].output_map()
  assert a._input['nbands'].output_map()['nbands'] == str(a.nbands)
  a.nbands = None
  assert a.nbands is None
  assert a._input['nbands'].output_map() is None

  try: a.nbands = 'a'
  except ValueError: pass
  else: raise Exception()

  assert a.smearings is None
  assert a._input['smearings'].keyword == 'smearings'
  assert a._input['smearings'].output_map() is None
  a.smearings = [1.5, 1.0, 0.5]
  assert len(a.smearings) == 3
  assert all(abs(i-v) < 1e-8 for i, v in zip(a.smearings, [1.5, 1.0, 0.5]))
  assert 'smearings' in a._input['smearings'].output_map()
  assert all(abs(float(i)-v) < 1e-8 for i, v in zip(a._input['smearings'].output_map()['smearings'].split(), [1.5, 1.0, 0.5]))
  a.smearings = ['1.2', '0.2']
  assert len(a.smearings) == 2
  assert all(abs(i-v) < 1e-8 for i, v in zip(a.smearings, [1.2, 0.2]))
  assert 'smearings' in a._input['smearings'].output_map()
  assert all(abs(float(i)-v) < 1e-8 for i, v in zip(a._input['smearings'].output_map()['smearings'].split(), [1.2, 0.2]))
  a.smearings = '1.3 0.3'
  assert len(a.smearings) == 2
  assert all(abs(i-v) < 1e-8 for i, v in zip(a.smearings, [1.3, 0.3]))
  assert 'smearings' in a._input['smearings'].output_map()
  assert all(abs(float(i)-v) < 1e-8 for i, v in zip(a._input['smearings'].output_map()['smearings'].split(), [1.3, 0.3]))
  a.smearings = '1.3, 0.3'
  assert len(a.smearings) == 2
  assert all(abs(i-v) < 1e-8 for i, v in zip(a.smearings, [1.3, 0.3]))
  a.smearings = '1.3; 0.3'
  assert len(a.smearings) == 2
  assert all(abs(i-v) < 1e-8 for i, v in zip(a.smearings, [1.3, 0.3]))
  a.smearings = None
  assert a.smearings is None
  assert a._input['smearings'].output_map() is None
  
  try: a.smearings = 5.5
  except ValueError: pass
  else: raise Exception()
  try: a.smearings = [5.5, 'a']
  except ValueError: pass
  else: raise Exception()
开发者ID:mdavezac,项目名称:LaDa,代码行数:61,代码来源:keywords.py


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