本文整理汇总了Python中pylada.vasp.Vasp.ediff_per_atom方法的典型用法代码示例。如果您正苦于以下问题:Python Vasp.ediff_per_atom方法的具体用法?Python Vasp.ediff_per_atom怎么用?Python Vasp.ediff_per_atom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pylada.vasp.Vasp
的用法示例。
在下文中一共展示了Vasp.ediff_per_atom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_ediff
# 需要导入模块: from pylada.vasp import Vasp [as 别名]
# 或者: from pylada.vasp.Vasp import ediff_per_atom [as 别名]
def test_ediff():
from pickle import loads, dumps
from pylada.vasp import Vasp
from pylada.crystal import Structure
a = Vasp()
u = 0.25
x, y = u, 0.25-u
structure = Structure([[0,0.5,0.5],[0.5,0,0.5],[0.5,0.5,0]]) \
.add_atom(5.000000e-01, 5.000000e-01, 5.000000e-01, "Mg") \
.add_atom(5.000000e-01, 2.500000e-01, 2.500000e-01, "Mg") \
.add_atom(2.500000e-01, 5.000000e-01, 2.500000e-01, "Mg") \
.add_atom(2.500000e-01, 2.500000e-01, 5.000000e-01, "Mg") \
.add_atom(8.750000e-01, 8.750000e-01, 8.750000e-01, "Al") \
.add_atom(1.250000e-01, 1.250000e-01, 1.250000e-01, "Al") \
.add_atom( x, x, x, "O") \
.add_atom( x, y, y, "O") \
.add_atom( y, x, y, "O") \
.add_atom( y, y, x, "O") \
.add_atom( -x, -x, -x, "O") \
.add_atom( -x, -y, -y, "O") \
.add_atom( -y, -x, -y, "O") \
.add_atom( -y, -y, -x, "O")
N = float(len(structure))
o = a._input['ediff']
d = {'Ediff': o.__class__}
assert a.ediff is None
assert a.ediff_per_atom is None
assert o.output_map() is None
assert eval(repr(o), d).output_map() is None
assert eval(repr(o), d).keyword == 'ediff'
assert loads(dumps(o)).output_map() is None
a.ediff_per_atom = 1e-5
a.ediff = 2e-4
assert abs(a.ediff - 2e-4) < 1e-8
assert a.ediff_per_atom is None
assert abs(float(o.output_map(structure=structure)['ediff']) - a.ediff) < a.ediff * 1e-2
assert abs(float(eval(repr(o), d).output_map(structure=structure)['ediff']) - a.ediff) < a.ediff * 1e-2
assert abs(float(loads(dumps(o)).output_map(structure=structure)['ediff']) - a.ediff) < a.ediff * 1e-2
a.ediff = -1
assert abs(a.ediff) < 1e-8
assert abs(float(o.output_map(structure=structure)['ediff'])) < 1e-8
a = Vasp()
o = a._input['ediff_per_atom']
d = {'EdiffPerAtom': o.__class__}
assert a.ediff_per_atom is None
assert a.ediff is None
assert o.output_map() is None
assert eval(repr(o), d).output_map() is None
assert eval(repr(o), d).keyword == 'ediff'
assert loads(dumps(o)).output_map() is None
a.ediff = 1e-5
a.ediff_per_atom = 2e-4
assert abs(a.ediff_per_atom - 2e-4) < 1e-8
assert a.ediff is None
assert abs(float(o.output_map(structure=structure)['ediff']) - 2e-4 * N) < 2e-4 * 1e-2
assert abs(float(eval(repr(o), d).output_map(structure=structure)['ediff']) - 2e-4 * N) < 2e-4 * 1e-2
assert abs(float(loads(dumps(o)).output_map(structure=structure)['ediff']) - 2e-4 * N) < 2e-4 * 1e-2
a.ediff = 1e-4
a.ediff_per_atom = None
assert abs(a.ediff-1e-4) < 1e-8
assert a.ediff_per_atom is None
a.ediff_per_atom = 1e-4
a.ediff = None
assert abs(a.ediff_per_atom-1e-4) < 1e-8
assert a.ediff is None