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


Python Vasp.add_specie方法代码示例

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


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

示例1: test

# 需要导入模块: from pylada.vasp import Vasp [as 别名]
# 或者: from pylada.vasp.Vasp import add_specie [as 别名]
def test(path):
  from os import makedirs
  from os.path import exists
  from shutil import rmtree
  from tempfile import mkdtemp
  from pylada.crystal import Structure
  from pylada.vasp import Vasp
  from pylada import default_comm

  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")

  vasp = Vasp()
  vasp.kpoints    = "Automatic generation\n0\nMonkhorst\n2 2 2\n0 0 0"
  vasp.prec       = "accurate"
  vasp.ediff      = 1e-5
  vasp.encut      = 1
  vasp.ismear     = "fermi"
  vasp.sigma      = 0.01
  vasp.relaxation = "volume"
  vasp.add_specie = "Si", "{0}/pseudos/Si".format(path)
  directory = mkdtemp()
  if directory == '/tmp/test' or directory == '/tmp/test/':
    if exists(directory): rmtree(directory)
    makedirs(directory)
  try: 
    result = vasp(structure, outdir=directory, comm=default_comm)
    assert result.success
  finally: 
    if directory != '/tmp/test' and directory != '/tmp/test/':
      rmtree(directory)
开发者ID:georgeyumnam,项目名称:pylada,代码行数:34,代码来源:run.py

示例2: test

# 需要导入模块: from pylada.vasp import Vasp [as 别名]
# 或者: from pylada.vasp.Vasp import add_specie [as 别名]
def test(tmpdir, path):
    from numpy import all, abs
    from quantities import kbar, eV, angstrom
    from pylada.crystal import Structure
    from pylada.vasp import Vasp
    from pylada.vasp.relax import Relax
    from pylada import default_comm

    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")

    vasp = Vasp()
    vasp.kpoints = "Automatic generation\n0\nMonkhorst\n2 2 2\n0 0 0"
    vasp.prec = "accurate"
    vasp.ediff = 1e-5
    vasp.encut = 1
    vasp.ismear = "fermi"
    vasp.sigma = 0.01
    vasp.relaxation = "volume"
    vasp.add_specie = "Si", "{0}/pseudos/Si".format(path)

    functional = Relax(copy=vasp)
    assert abs(functional.ediff - 1e-5) < 1e-8
    assert functional.prec == 'Accurate'
    result = functional(structure, outdir=str(tmpdir), comm=default_comm,
                        relaxation="volume ionic cellshape")
    assert result.success

    assert result.stress.units == kbar and all(abs(result.stress) < 1e0)
    assert result.forces.units == eV / angstrom and all(abs(result.forces) < 1e-1)
    assert result.total_energy.units == eV and all(
        abs(result.total_energy + 10.668652 * eV) < 1e-2)
开发者ID:pylada,项目名称:pylada-light,代码行数:35,代码来源:test_runrelax.py

示例3: test

# 需要导入模块: from pylada.vasp import Vasp [as 别名]
# 或者: from pylada.vasp.Vasp import add_specie [as 别名]
def test(tmpdir, path):
    from numpy import abs
    from pylada.crystal import Structure
    from pylada.vasp import Vasp
    from pylada.vasp.emass import effective_mass, EMass
    from pylada import default_comm

    structure = Structure([[0, 0.5, 0.5], [0.5, 0, 0.5], [0.5, 0.5, 0]], scale=5.55, name='has a name')\
        .add_atom(0, 0, 0, "Si")\
        .add_atom(0.25, 0.25, 0.25, "Si")

    vasp = Vasp()
    vasp.kpoints = "Automatic generation\n0\nMonkhorst\n2 2 2\n0 0 0"
    vasp.prec = "accurate"
    vasp.ediff = 25e-5
    vasp.encut = 1.4
    vasp.ismear = "fermi"
    vasp.sigma = 0.01
    vasp.relaxation = "volume"
    vasp.add_specie = "Si", "{0}/pseudos/Si".format(path)
    emass = EMass(copy=vasp)
    assert abs(emass.encut - 1.4) < 1e-8
    assert abs(emass.ediff - 25e-5) < 1e-10
    result = effective_mass(vasp, structure, outdir=str(tmpdir), comm=default_comm,
                            emassparams={'ediff': 1e-8})
    result.emass
    assert result.success
    result = emass(structure, outdir=str(tmpdir), comm=default_comm,
                   emassparams={'ediff': 1e-8})
    assert result.success
开发者ID:pylada,项目名称:pylada-light,代码行数:32,代码来源:test_runmass.py

示例4: test

# 需要导入模块: from pylada.vasp import Vasp [as 别名]
# 或者: from pylada.vasp.Vasp import add_specie [as 别名]
def test(path):
  from shutil import rmtree
  from tempfile import mkdtemp
  from pylada.crystal import Structure
  from pylada.vasp import Vasp
  from epirelax import epitaxial
  from pylada import default_comm

  structure = Structure([[0, 0.5, 0.5],[0.5, 0, 0.5], [0.5, 0.5, 0]], scale=5.55, name='has a name')\
                       .add_atom(0,0,0, "Si")\
                       .add_atom(0.25,0.25,0.25, "Si")

  vasp = Vasp()
  vasp.kpoints    = "Automatic generation\n0\nMonkhorst\n2 2 2\n0 0 0"
  vasp.prec       = "accurate"
  vasp.ediff      = 1e-5
  vasp.encut      = 1.4
  vasp.ismear     = "fermi"
  vasp.sigma      = 0.01
  vasp.relaxation = "volume"
  vasp.add_specie = "Si", "{0}/pseudos/Si".format(path)
  directory = mkdtemp()
  try: 
    result = epitaxial(vasp, structure, outdir=directory, epiconv=1e-4, comm=default_comm)
    assert result.success
  finally: 
    rmtree(directory)
    pass
开发者ID:georgeyumnam,项目名称:pylada,代码行数:30,代码来源:runepidoc.py

示例5: test_incar

# 需要导入模块: from pylada.vasp import Vasp [as 别名]
# 或者: from pylada.vasp.Vasp import add_specie [as 别名]
def test_incar():
  from shutil import rmtree
  from tempfile import mkdtemp
  from os.path import join, dirname
  from quantities import eV
  from pylada.vasp import Vasp, read_incar
  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")

  vasp = Vasp()
  vasp.kpoints    = "Automatic generation\n0\nMonkhorst\n2 2 2\n0 0 0"
  vasp.precision  = "accurate"
  vasp.ediff      = 1e-5
  vasp.encut      = 1
  vasp.ismear     = "metal"
  vasp.sigma      = 0.06
  vasp.relaxation = "volume"
  vasp.add_specie = "Si", join(dirname(__file__), 'pseudos', 'Si')

  directory = mkdtemp()
  try: 
    vasp.write_incar(path=join(directory, 'INCAR'), structure=structure)
    other = read_incar(join(directory, 'INCAR'))
    assert abs(other.ediff - 1e-5)  < 1e-8
    assert abs(other.encut - 245.345) < 1e-8
    assert abs(other.sigma - 0.06 * eV) < 1e-8
    assert other.ibrion     == 2
    assert other.icharg     == 'atomic'
    assert other.isif       == 7
    assert other.ismear     == 'metal'
    assert other.istart     == 'scratch'
    assert other.lcharg     == False
    assert other.nsw        == 50
    assert other.relaxation == 'volume'
    assert other.system     == 'has a name'
    with open(join(directory, 'INCAR'), 'a') as file:
      file.write('\nSOMETHing = 0.5\n')
    other = read_incar(join(directory, 'INCAR'))
    assert abs(other.ediff - 1e-5)  < 1e-8
    assert abs(other.encut - 245.345) < 1e-8
    assert abs(other.sigma - 0.06 * eV) < 1e-8
    assert other.ibrion     == 2
    assert other.icharg     == 'atomic'
    assert other.isif       == 7
    assert other.ismear     == 'metal'
    assert other.istart     == 'scratch'
    assert other.lcharg     == False
    assert other.nsw        == 50
    assert other.relaxation == 'volume'
    assert other.system     == 'has a name'
    assert 'something' in other._input
    assert isinstance(other.something, float)
    assert abs(other.something - 0.5) < 1e-8
  finally: 
    rmtree(directory)
    pass
开发者ID:hbwzhsh,项目名称:pylada-light,代码行数:60,代码来源:test_incar.py

示例6: test_nelect

# 需要导入模块: from pylada.vasp import Vasp [as 别名]
# 或者: from pylada.vasp.Vasp import add_specie [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

示例7: vasp

# 需要导入模块: from pylada.vasp import Vasp [as 别名]
# 或者: from pylada.vasp.Vasp import add_specie [as 别名]
def vasp():
    from os.path import join, dirname
    from pylada.vasp import Vasp
    vasp = Vasp()
    vasp.kpoints = "Automatic generation\n0\nMonkhorst\n2 2 2\n0 0 0"
    vasp.precision = "accurate"
    vasp.ediff = 1e-5
    vasp.encut = 1
    vasp.ismear = "metal"
    vasp.sigma = 0.06
    vasp.relaxation = "volume"
    vasp.add_specie = "Si", join(dirname(__file__), 'pseudos', 'Si')
    return vasp
开发者ID:,项目名称:,代码行数:15,代码来源:

示例8: test

# 需要导入模块: from pylada.vasp import Vasp [as 别名]
# 或者: from pylada.vasp.Vasp import add_specie [as 别名]
def test(path):
  from glob import glob
  from os.path import join
  from shutil import rmtree
  from tempfile import mkdtemp
  from numpy import all, abs
  from quantities import kbar, eV, angstrom
  from pylada.crystal import Structure
  from pylada.vasp import Vasp
  from pylada.vasp.relax import Relax
  from pylada import default_comm
    
  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")

  vasp = Vasp()
  vasp.kpoints    = "Automatic generation\n0\nMonkhorst\n2 2 2\n0 0 0"
  vasp.prec       = "accurate"
  vasp.ediff      = 1e-5
  vasp.encut      = 1
  vasp.ismear     = "fermi"
  vasp.sigma      = 0.01
  vasp.relaxation = "volume"
  vasp.add_specie = "Si", "{0}/pseudos/Si".format(path)
  directory = mkdtemp()
  try: 
    functional = Relax(copy=vasp)
    assert abs(functional.ediff - 1e-5) < 1e-8
    assert functional.prec == 'Accurate'
    result = functional(structure, outdir=directory, comm=default_comm,
                        relaxation="volume ionic cellshape")
    assert result.success
    def sortme(a): return int(a.split('/')[-1])
    dirs = sorted(glob(join(join(directory, '*'), '[0-9]')), key=sortme)
  # for previous, current in zip(dirs, dirs[1:]):
  #   assert len(check_output(['diff', join(previous, 'CONTCAR'), join(current, 'POSCAR')])) == 0
  # assert len(check_output(['diff', join(current, 'CONTCAR'), join(directory, 'POSCAR')])) == 0
    assert result.stress.units == kbar and all(abs(result.stress) < 1e0)
    assert result.forces.units == eV/angstrom and all(abs(result.forces) < 1e-1)
    assert result.total_energy.units == eV and all(abs(result.total_energy + 10.668652*eV) < 1e-2)

  finally: 
    if directory != '/tmp/test/relax': rmtree(directory)
    pass
开发者ID:georgeyumnam,项目名称:pylada,代码行数:47,代码来源:runrelax.py

示例9: test

# 需要导入模块: from pylada.vasp import Vasp [as 别名]
# 或者: from pylada.vasp.Vasp import add_specie [as 别名]
def test(path):
  from shutil import rmtree
  from os.path import exists
  from os import makedirs
  from tempfile import mkdtemp
  from numpy import abs
  from pylada.crystal import Structure
  from pylada.vasp import Vasp
  from pylada.vasp.emass import effective_mass, EMass
  from pylada import default_comm

    
    
  structure = Structure([[0, 0.5, 0.5],[0.5, 0, 0.5], [0.5, 0.5, 0]], scale=5.55, name='has a name')\
                       .add_atom(0,0,0, "Si")\
                       .add_atom(0.25,0.25,0.25, "Si")

  vasp = Vasp()
  vasp.kpoints    = "Automatic generation\n0\nMonkhorst\n2 2 2\n0 0 0"
  vasp.prec       = "accurate"
  vasp.ediff      = 25e-5
  vasp.encut      = 1.4
  vasp.ismear     = "fermi"
  vasp.sigma      = 0.01
  vasp.relaxation = "volume"
  vasp.add_specie = "Si", "{0}/pseudos/Si".format(path)
  emass = EMass(copy=vasp)
  assert abs(emass.encut - 1.4) < 1e-8
  assert abs(emass.ediff - 25e-5) < 1e-10
  directory = "/tmp/test" #mkdtemp()
  if exists(directory) and directory == '/tmp/test': rmtree(directory)
  if not exists(directory): makedirs(directory)
  try: 
    result = effective_mass(vasp, structure, outdir=directory, comm=default_comm,
                            emassparams={'ediff': 1e-8})
    result.emass
    assert result.success
    result = emass(structure, outdir=directory, comm=default_comm,
                   emassparams={'ediff': 1e-8})
    assert result.success
  finally: 
    if directory != '/tmp/test': rmtree(directory)
    pass
开发者ID:mdavezac,项目名称:LaDa,代码行数:45,代码来源:runmass.py

示例10: test

# 需要导入模块: from pylada.vasp import Vasp [as 别名]
# 或者: from pylada.vasp.Vasp import add_specie [as 别名]
def test(tmpdir, path):
    from pylada.crystal import Structure
    from pylada.vasp import Vasp
    from pylada import default_comm

    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")

    vasp = Vasp()
    vasp.kpoints = "Automatic generation\n0\nMonkhorst\n2 2 2\n0 0 0"
    vasp.prec = "accurate"
    vasp.ediff = 1e-5
    vasp.encut = 1
    vasp.ismear = "fermi"
    vasp.sigma = 0.01
    vasp.relaxation = "volume"
    vasp.add_specie = "Si", "{0}/pseudos/Si".format(path)
    result = vasp(structure, outdir=str(tmpdir), comm=default_comm)
    assert result.success
开发者ID:pylada,项目名称:pylada-light,代码行数:22,代码来源:test_run.py

示例11: test_encut

# 需要导入模块: from pylada.vasp import Vasp [as 别名]
# 或者: from pylada.vasp.Vasp import add_specie [as 别名]
def test_encut():
    from os.path import dirname
    from pickle import loads, dumps
    from quantities import eV, hartree
    import quantities
    import numpy
    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__))

    o = a._input['encut']
    d = {'Encut': o.__class__}
    d.update(quantities.__dict__)
    d.update(numpy.__dict__)
    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 == 'encut'
    assert loads(dumps(o)).output_map() is None

    a.encut = 1e0
    assert abs(a.encut - 1e0) < 1e-8
    assert abs(float(o.output_map(structure=structure, vasp=a)['encut']) - 245.345) < 1e-8
    assert abs(float(eval(repr(o), d).output_map(
        structure=structure, vasp=a)['encut']) - 245.345) < 1e-8
    assert abs(float(loads(dumps(o)).output_map(
        structure=structure, vasp=a)['encut']) - 245.345) < 1e-8
    assert abs(eval(repr(o), d).value - 1.0) < 1e-8
    assert abs(loads(dumps(o)).value - 1.0) < 1e-8
    a.encut = 0.8
    assert abs(a.encut - 0.8) < 1e-8
    assert abs(float(o.output_map(structure=structure, vasp=a)['encut']) - 245.345 * 0.8) < 1e-8
    assert abs(float(eval(repr(o), d).output_map(
        structure=structure, vasp=a)['encut']) - 245.345 * 0.8) < 1e-8
    assert abs(float(loads(dumps(o)).output_map(
        structure=structure, vasp=a)['encut']) - 245.345 * 0.8) < 1e-8
    assert abs(eval(repr(o), d).value - 0.8) < 1e-8
    assert abs(loads(dumps(o)).value - 0.8) < 1e-8
    a.encut = 200
    assert abs(a.encut - 200) < 1e-8
    assert abs(float(o.output_map(structure=structure, vasp=a)['encut']) - 200) < 1e-8
    assert abs(float(eval(repr(o), d).output_map(
        structure=structure, vasp=a)['encut']) - 200) < 1e-8
    assert abs(float(loads(dumps(o)).output_map(structure=structure, vasp=a)['encut']) - 200) < 1e-8
    assert abs(eval(repr(o), d).value - 200) < 1e-8
    assert abs(loads(dumps(o)).value - 200) < 1e-8
    a.encut = 200 * eV
    assert abs(a.encut - 200 * eV) < 1e-8
    assert a.encut.units == eV
    assert abs(float(o.output_map(structure=structure, vasp=a)['encut']) - 200) < 1e-8
    assert abs(float(eval(repr(o), d).output_map(
        structure=structure, vasp=a)['encut']) - 200) < 1e-8
    assert abs(float(loads(dumps(o)).output_map(structure=structure, vasp=a)['encut']) - 200) < 1e-8
    assert abs(eval(repr(o), d).value - 200 * eV) < 1e-8
    assert abs(loads(dumps(o)).value - 200 * eV) < 1e-8
    assert eval(repr(o), d).value.units == eV
    assert loads(dumps(o)).value.units == eV
    a.encut = (200 * eV).rescale(hartree)
    assert a.encut.units == hartree
    assert abs(a.encut - 200 * eV) < 1e-8
    assert abs(float(o.output_map(structure=structure, vasp=a)['encut']) - 200) < 1e-8
    assert abs(float(eval(repr(o), d).output_map(
        structure=structure, vasp=a)['encut']) - 200) < 1e-8
    assert abs(float(loads(dumps(o)).output_map(structure=structure, vasp=a)['encut']) - 200) < 1e-8
    assert abs(eval(repr(o), d).value - 200 * eV) < 1e-8
    assert abs(loads(dumps(o)).value - 200 * eV) < 1e-8
    assert eval(repr(o), d).value.units == hartree
    assert loads(dumps(o)).value.units == hartree

    o = a._input['encutgw']
    d = {'EncutGW': o.__class__}
    d.update(quantities.__dict__)
    d.update(numpy.__dict__)
    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 == 'encutgw'
    assert loads(dumps(o)).output_map() is None
    a.encutgw = (200 * eV).rescale(hartree)
    assert a.encutgw.units == hartree
    assert abs(a.encutgw - 200 * eV) < 1e-8
    assert abs(float(o.output_map(structure=structure, vasp=a)['encutgw']) - 200) < 1e-8
    assert abs(float(eval(repr(o), d).output_map(
        structure=structure, vasp=a)['encutgw']) - 200) < 1e-8
    assert abs(float(loads(dumps(o)).output_map(
        structure=structure, vasp=a)['encutgw']) - 200) < 1e-8
    assert abs(eval(repr(o), d).value - 200 * eV) < 1e-8
    assert abs(loads(dumps(o)).value - 200 * eV) < 1e-8
    assert eval(repr(o), d).value.units == hartree
    assert loads(dumps(o)).value.units == hartree
开发者ID:,项目名称:,代码行数:97,代码来源:

示例12: test

# 需要导入模块: from pylada.vasp import Vasp [as 别名]
# 或者: from pylada.vasp.Vasp import add_specie [as 别名]
def test(path):
    from shutil import rmtree
    from tempfile import mkdtemp
    from os.path import join
    from quantities import eV
    from pylada.vasp import Vasp, read_incar
    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")
    )

    vasp = Vasp()
    vasp.kpoints = "Automatic generation\n0\nMonkhorst\n2 2 2\n0 0 0"
    vasp.precision = "accurate"
    vasp.ediff = 1e-5
    vasp.encut = 1
    vasp.ismear = "metal"
    vasp.sigma = 0.06
    vasp.relaxation = "volume"
    vasp.add_specie = "Si", "{0}/pseudos/Si".format(path)

    directory = mkdtemp()
    try:
        vasp.write_incar(path=join(directory, "INCAR"), structure=structure)
        other = read_incar(join(directory, "INCAR"))
        assert abs(other.ediff - 1e-5) < 1e-8
        assert abs(other.encut - 245.345) < 1e-8
        assert abs(other.sigma - 0.06 * eV) < 1e-8
        assert other.ibrion == 2
        assert other.icharg == "atomic"
        assert other.isif == 7
        assert other.ismear == "metal"
        assert other.istart == "scratch"
        assert other.lcharg == False
        assert other.nsw == 50
        assert other.relaxation == "volume"
        assert other.system == "has a name"
        with open(join(directory, "INCAR"), "a") as file:
            file.write("\nSOMETHing = 0.5\n")
        other = read_incar(join(directory, "INCAR"))
        assert abs(other.ediff - 1e-5) < 1e-8
        assert abs(other.encut - 245.345) < 1e-8
        assert abs(other.sigma - 0.06 * eV) < 1e-8
        assert other.ibrion == 2
        assert other.icharg == "atomic"
        assert other.isif == 7
        assert other.ismear == "metal"
        assert other.istart == "scratch"
        assert other.lcharg == False
        assert other.nsw == 50
        assert other.relaxation == "volume"
        assert other.system == "has a name"
        assert "something" in other._input
        assert isinstance(other.something, float)
        assert abs(other.something - 0.5) < 1e-8
    finally:
        rmtree(directory)
        pass
开发者ID:georgeyumnam,项目名称:pylada,代码行数:63,代码来源:incar.py


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