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


Python Vasp.nsw方法代码示例

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


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

示例1: test

# 需要导入模块: from pylada.vasp import Vasp [as 别名]
# 或者: from pylada.vasp.Vasp import nsw [as 别名]
def test():
  from pickle import loads, dumps
  from pylada.vasp import Vasp
  from pylada.error import ValueError
 
  a = Vasp()

  for key in a._input.keys():
    if key not in ['isif', 'nsw', 'ibrion', 'relaxation']: 
      del a._input[key]
  assert a.relaxation == 'static'
  assert len(a.output_map(vasp=a)) == 1
  assert a.output_map(vasp=a)['ibrion'] == str(-1)

  a.relaxation = 'cellshape'
  assert a.relaxation == 'cellshape'
  assert a.isif == 5
  assert a.nsw == 50
  assert a.ibrion == 2
  assert len(a.output_map(vasp=a)) == 3
  assert a.output_map(vasp=a)['ibrion'] == str(2)
  assert a.output_map(vasp=a)['isif'] == str(5)
  assert a.output_map(vasp=a)['nsw'] == str(50)
  a = loads(dumps(a))
  assert len(a.output_map(vasp=a)) == 3
  assert a.output_map(vasp=a)['ibrion'] == str(2)
  assert a.output_map(vasp=a)['isif'] == str(5)
  assert a.output_map(vasp=a)['nsw'] == str(50)

  a.relaxation = 'cellshape volume'
  a.nsw = 25
  assert a.relaxation == 'cellshape volume'
  assert a.isif == 6
  assert a.nsw == 25
  assert a.ibrion == 2
  assert len(a.output_map(vasp=a)) == 3
  assert a.output_map(vasp=a)['ibrion'] == str(2)
  assert a.output_map(vasp=a)['isif'] == str(6)
  assert a.output_map(vasp=a)['nsw'] == str(25)

  a.relaxation = 'ions'
  assert a.relaxation == 'ionic'
  assert a.isif == 2
  a.relaxation = 'ionic'
  assert a.relaxation == 'ionic'
  assert a.isif == 2

  a.relaxation = 'cellshape, volume ions'
  print a.relaxation
  assert a.relaxation == 'cellshape ionic volume'
  assert a.isif == 3

  a.relaxation = 'cellshape, ionic'
  assert a.relaxation == 'cellshape ionic'
  assert a.isif == 4

  a.relaxation = 'volume'
  assert a.relaxation == 'volume'
  assert a.isif == 7

  a.relaxation = 'static'
  assert a.ibrion == -1
  assert a.nsw == 0
  assert a.isif == 2

  try: a.relaxation = 'ions, volume'
  except ValueError: pass
  else: raise Exception
开发者ID:georgeyumnam,项目名称:pylada,代码行数:70,代码来源:relax.py


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