本文整理汇总了Python中pylada.vasp.Vasp.addgrid方法的典型用法代码示例。如果您正苦于以下问题:Python Vasp.addgrid方法的具体用法?Python Vasp.addgrid怎么用?Python Vasp.addgrid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pylada.vasp.Vasp
的用法示例。
在下文中一共展示了Vasp.addgrid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_bool
# 需要导入模块: from pylada.vasp import Vasp [as 别名]
# 或者: from pylada.vasp.Vasp import addgrid [as 别名]
def test_bool():
from pickle import loads, dumps
from pylada.vasp import Vasp
a = Vasp()
assert a._input['addgrid'].keyword == 'addgrid'
assert a._input['addgrid'].output_map() is None
assert a.addgrid is None
a.addgrid = False
assert a.addgrid is False
assert 'addgrid' in a._input['addgrid'].output_map()
assert a._input['addgrid'].output_map()['addgrid'] == '.FALSE.'
a.addgrid = True
assert a.addgrid is True
assert 'addgrid' in a._input['addgrid'].output_map()
assert a._input['addgrid'].output_map()['addgrid'] == '.TRUE.'
a.addgrid = None
assert a._input['addgrid'].keyword == 'addgrid'
assert a._input['addgrid'].output_map() is None
a.addgrid = 0
assert a.addgrid is False
a.addgrid = False
o = a._input['addgrid']
d = {'BoolKeyword': o.__class__}
assert repr(eval(repr(o), d)) == repr(o)
assert eval(repr(o), d).output_map()['addgrid'] == '.FALSE.'
assert repr(loads(dumps(o))) == repr(o)
a.addgrid = True
o = a._input['addgrid']
assert repr(eval(repr(o), d)) == repr(o)
assert eval(repr(o), d).output_map()['addgrid'] == '.TRUE.'
assert repr(loads(dumps(o))) == repr(o)
a.addgrid = None
o = a._input['addgrid']
assert repr(eval(repr(o), d)) == repr(o)
assert eval(repr(o), d).output_map() is None
assert repr(loads(dumps(o))) == repr(o)
示例2: main
# 需要导入模块: from pylada.vasp import Vasp [as 别名]
# 或者: from pylada.vasp.Vasp import addgrid [as 别名]
def main():
from boost.mpi import world
from scipy.optimize import fmin as scipy_simplex
from pylada.vasp import Extract, ExtractGW, Vasp, Specie
from pylada.vasp.specie import nlep as nlep_parameters, U as u_parameters
from pylada.vasp.incar import Standard, NBands
from sys import exit
indir = "SnO2"
dft_in = Extract(directory=indir, comm=world)
dft_in.OUTCAR = "OUTCAR_pbe"
dft_in.CONTCAR = "POSCAR"
gw_in = ExtractGW(directory=indir, comm=world)
gw_in.OUTCAR = "OUTCAR_gw"
gw_in.CONTCAR = "POSCAR"
# Creates species with nlep parameters to optimize
species = Specie\
(
"Sn",
path="pseudos/Sn",
U=[nlep_parameters(type="Dudarev", l=i, U0=0e0) for i in ["s", "p", "d"]]
),\
Specie\
(
"O",
path="pseudos/O",
U=[nlep_parameters(type="Dudarev", l=i, U0=0e0) for i in ["s", "p"]]
)
# add U to Sn atoms.
species[0].U.append( u_parameters(type="Dudarev", U=2e0, l=2) )
# creates vasp launcher
vasp = Vasp\
(
kpoints = lambda x: "Automatic generation\n0\ngamma\n6 6 10\n0 0 0",
precision = "accurate",
smearing = "bloechl",
ediff = 1e-5,
relaxation = "ionic",
encut = 1, # uses ENMAX * 1, which is VASP default
species = species
)
# adds some extra parameters.
vasp.nbands = Standard("NBANDS", 64)
vasp.lorbit = Standard("LORBIT", 10)
vasp.npar = Standard("NPAR", 2)
vasp.lplane = Standard("LPLANE", ".TRUE.")
vasp.addgrid = Standard("ADDGRID", ".TRUE.")
del vasp.fftgrid
# creates objective function.
objective = Objective(vasp, dft_in, gw_in)
x0, f0, iter, funcalls, warnflag = scipy_simplex(objective, objective.x, maxfun=150, full_output=1, xtol=0.2)
world.barrier()
if world.rank == 0:
print "minimum value:", f0
print "for: ", x0 * units
print "after %i iterations and %i function calls." % (iter, funcalls)
print "with warning flag: ", warnflag
print final(x0)