本文整理汇总了Python中pymatgen.io.vasp.inputs.Kpoints.from_dict方法的典型用法代码示例。如果您正苦于以下问题:Python Kpoints.from_dict方法的具体用法?Python Kpoints.from_dict怎么用?Python Kpoints.from_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymatgen.io.vasp.inputs.Kpoints
的用法示例。
在下文中一共展示了Kpoints.from_dict方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pymatgen.io.vasp.inputs import Kpoints [as 别名]
# 或者: from pymatgen.io.vasp.inputs.Kpoints import from_dict [as 别名]
def __init__(self, name, incar, poscar, potcar, kpoints,
qadapter=None, **kwargs ):
"""
default INCAR from config_dict
"""
self.name = name
self.incar = Incar.from_dict(incar.as_dict())
self.poscar = Poscar.from_dict(poscar.as_dict())
self.potcar = Potcar.from_dict(potcar.as_dict())
self.kpoints = Kpoints.from_dict(kpoints.as_dict())
self.extra = kwargs
if qadapter is not None:
self.qadapter = qadapter.from_dict(qadapter.to_dict())
else:
self.qadapter = None
config_dict = {}
config_dict['INCAR'] = self.incar.as_dict()
config_dict['POSCAR'] = self.poscar.as_dict()
#caution the key and the value are not always the same
config_dict['POTCAR'] = self.potcar.as_dict()
#dict(zip(self.potcar.as_dict()['symbols'],
#self.potcar.as_dict()['symbols']))
config_dict['KPOINTS'] = self.kpoints.as_dict()
#self.user_incar_settings = self.incar.as_dict()
DictVaspInputSet.__init__(self, name, config_dict,
ediff_per_atom=False, **kwargs)
示例2: test_as_dict_from_dict
# 需要导入模块: from pymatgen.io.vasp.inputs import Kpoints [as 别名]
# 或者: from pymatgen.io.vasp.inputs.Kpoints import from_dict [as 别名]
def test_as_dict_from_dict(self):
k = Kpoints.monkhorst_automatic([2, 2, 2], [0, 0, 0])
d = k.as_dict()
k2 = Kpoints.from_dict(d)
self.assertEqual(k.kpts, k2.kpts)
self.assertEqual(k.style, k2.style)
self.assertEqual(k.kpts_shift, k2.kpts_shift)
示例3: from_dict
# 需要导入模块: from pymatgen.io.vasp.inputs import Kpoints [as 别名]
# 或者: from pymatgen.io.vasp.inputs.Kpoints import from_dict [as 别名]
def from_dict(cls, d):
incar = Incar.from_dict(d["incar"])
poscar = Poscar.from_dict(d["poscar"])
potcar = Potcar.from_dict(d["potcar"])
kpoints = Kpoints.from_dict(d["kpoints"])
qadapter = None
if d["qadapter"] is not None:
qadapter = CommonAdapter.from_dict(d["qadapter"])
return MPINTVaspInputSet(d["name"], incar, poscar, potcar,
kpoints, qadapter, **d["kwargs"])
示例4: test_kpt_bands_as_dict_from_dict
# 需要导入模块: from pymatgen.io.vasp.inputs import Kpoints [as 别名]
# 或者: from pymatgen.io.vasp.inputs.Kpoints import from_dict [as 别名]
def test_kpt_bands_as_dict_from_dict(self):
file_name = os.path.join(test_dir, 'KPOINTS.band')
k = Kpoints.from_file(file_name)
d = k.as_dict()
import json
json.dumps(d)
# This doesn't work
k2 = Kpoints.from_dict(d)
self.assertEqual(k.kpts, k2.kpts)
self.assertEqual(k.style, k2.style)
self.assertEqual(k.kpts_shift, k2.kpts_shift)
self.assertEqual(k.num_kpts, k2.num_kpts)
示例5: from_dict
# 需要导入模块: from pymatgen.io.vasp.inputs import Kpoints [as 别名]
# 或者: from pymatgen.io.vasp.inputs.Kpoints import from_dict [as 别名]
def from_dict(cls, d):
incar = Incar.from_dict(d["incar"])
poscar = Poscar.from_dict(d["poscar"])
potcar = Potcar.from_dict(d["potcar"])
kpoints = Kpoints.from_dict(d["kpoints"])
qadapter = None
if d["qadapter"] is not None:
qadapter = CommonAdapter.from_dict(d["qadapter"])
script_name = d["script_name"]
return MPINTVaspInputSet(d["name"], incar, poscar, potcar,
kpoints, qadapter,
script_name=script_name,
vis_logger=logging.getLogger(d["logger"]),
**d["kwargs"])
示例6: from_dict
# 需要导入模块: from pymatgen.io.vasp.inputs import Kpoints [as 别名]
# 或者: from pymatgen.io.vasp.inputs.Kpoints import from_dict [as 别名]
def from_dict(cls, d):
incar = Incar.from_dict(d["incar"])
poscar = Poscar.from_dict(d["poscar"])
potcar = Potcar.from_dict(d["potcar"])
kpoints = Kpoints.from_dict(d["kpoints"])
cal = Calibrate(incar, poscar, potcar, kpoints,
system=d["system"], is_matrix = d["is_matrix"],
Grid_type = d["Grid_type"],
parent_job_dir=d["parent_job_dir"],
job_dir=d["job_dir"], qadapter=d.get("qadapter"),
job_cmd=d["job_cmd"], wait=d["wait"],
turn_knobs=d["turn_knobs"])
cal.job_dir_list = d["job_dir_list"]
cal.job_ids = d["job_ids"]
return cal
示例7: __init__
# 需要导入模块: from pymatgen.io.vasp.inputs import Kpoints [as 别名]
# 或者: from pymatgen.io.vasp.inputs.Kpoints import from_dict [as 别名]
def __init__(self, name, incar, poscar, kpoints, potcar=None,
qadapter=None, script_name='submit_script',
vis_logger=None, reuse_path=None, test=False,
**kwargs):
"""
default INCAR from config_dict
"""
self.name = name
self.test = test
self.incar_init = Incar.from_dict(incar.as_dict())
self.poscar_init = Poscar.from_dict(poscar.as_dict())
if not self.test:
self.potcar_init = Potcar.from_dict(potcar.as_dict())
if not isinstance(kpoints, str):
self.kpoints_init = Kpoints.from_dict(kpoints.as_dict())
else:
self.kpoints_init = kpoints
self.reuse_path = reuse_path # complete reuse paths
self.extra = kwargs
if qadapter is not None:
self.qadapter = qadapter.from_dict(qadapter.to_dict())
else:
self.qadapter = None
self.script_name = script_name
config_dict = {}
config_dict['INCAR'] = self.incar_init.as_dict()
config_dict['POSCAR'] = self.poscar_init.as_dict()
# caution the key and the value are not always the same
if not self.test:
config_dict['POTCAR'] = self.potcar_init.as_dict()
# dict(zip(self.potcar.as_dict()['symbols'],
# self.potcar.as_dict()['symbols']))
if not isinstance(kpoints, str):
config_dict['KPOINTS'] = self.kpoints_init.as_dict()
else:
# need to find a way to dictify this kpoints string more
# appropriately
config_dict['KPOINTS'] = {'kpts_hse':self.kpoints_init}
# self.user_incar_settings = self.incar.as_dict()
DictSet.__init__(self, poscar.structure, config_dict)
#**kwargs)
if vis_logger:
self.logger = vis_logger
else:
self.logger = logger
示例8: set_kpoints
# 需要导入模块: from pymatgen.io.vasp.inputs import Kpoints [as 别名]
# 或者: from pymatgen.io.vasp.inputs.Kpoints import from_dict [as 别名]
def set_kpoints(self, kpoint=None, poscar=None, ibzkpth=None):
"""
set the kpoint
"""
# useful to check if a poscar is supplied from setup_poscar_jobs (most often the case)
# or this is a single poscar use case
if not poscar:
poscar = self.poscar
# splitting into two if elif branches means fewer if statements to check on
# a run
# Most general method of setting the k-points for
# different grid types
# NOTE: requires that at least one k-points value be passed
# as a turn - knobs list value
# this is not true for values that may be caculated out of
# a database
# use this part only if this is a non-database run for example
# for k-points calibration
if not self.database:
if self.Grid_type == 'M':
self.kpoints = Kpoints.monkhorst_automatic(kpts=kpoint)
elif self.Grid_type == 'A':
self.kpoints = Kpoints.automatic(subdivisions=kpoint)
elif self.Grid_type == 'G':
self.kpoints = Kpoints.gamma_automatic(kpts=kpoint)
elif self.Grid_type == '3D_vol':
self.kpoints = Kpoints.automatic_density_by_vol(structure=poscar.structure,
kppvol=kpoint)
elif self.Grid_type == 'bulk_bands_pbe':
self.kpoints = Kpoints.automatic_linemode(divisions=kpoint,
ibz=HighSymmKpath(
poscar.structure))
elif self.Grid_type == 'D':
self.kpoints = Kpoints.automatic_density(structure=poscar.structure,kppa=kpoint)
elif self.Grid_type == 'Finer_G_Mesh':
# kpoint is the scaling factor and self.kpoints is the old kpoint mesh
self.logger.info('Setting Finer G Mesh for {0} by scale {1}'.format(kpoint, self.finer_kpoint))
self.kpoints = Kpoints.gamma_automatic(kpts = \
[i * self.finer_kpoint for i in kpoint])
self.logger.info('Finished scaling operation of k-mesh')
# applicable for database runs
# future constructs or settinsg can be activated via a yaml file
# database yaml file or better still the input deck from its speification
# decides what combination of input calibrate constructor settings to use
# one of them being the grid_type tag
elif self.database == 'twod':
# set of kpoints settings according to the 2D database profile
# the actual settings of k-points density
# will in future come from any database input file set
if self.Grid_type == 'hse_bands_2D_prep':
kpoint_dict = Kpoints.automatic_gamma_density(poscar.structure,
200).as_dict()
kpoint_dict['kpoints'][0][2] = 1 # remove z kpoints
self.kpoints = Kpoints.from_dict(kpoint_dict)
elif self.Grid_type == 'hse_bands_2D':
# can at most return the path to the correct kpoints file
# needs kpoints to be written out in instrument in a different way
# not using the Kpoints object
self.kpoints = get_2D_hse_kpoints(poscar.structure, ibzkpth)
elif self.Grid_type == 'bands_2D':
kpoint_dict = Kpoints.automatic_linemode(divisions=20,
ibz=HighSymmKpath(poscar.structure)).as_dict()
self.kpoints = Kpoints.from_dict(kpoint_dict)
elif self.Grid_type == 'relax_2D':
# general relaxation settings for 2D
kpoint_dict = Kpoints.automatic_gamma_density(poscar.structure,
1000).as_dict()
kpoint_dict['kpoints'][0][2] = 1
self.kpoints = Kpoints.from_dict(kpoint_dict)
elif self.Grid_type == 'relax_3D':
# general relaxation settings for 3D
kpoint_dict = Kpoints.automatic_gamma_density(
poscar.structure, 1000)
self.kpoints = Kpoints.from_dict(kpoint_dict)