本文整理汇总了Python中pymatgen.io.vasp.inputs.Kpoints.automatic方法的典型用法代码示例。如果您正苦于以下问题:Python Kpoints.automatic方法的具体用法?Python Kpoints.automatic怎么用?Python Kpoints.automatic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymatgen.io.vasp.inputs.Kpoints
的用法示例。
在下文中一共展示了Kpoints.automatic方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_static_constructors
# 需要导入模块: from pymatgen.io.vasp.inputs import Kpoints [as 别名]
# 或者: from pymatgen.io.vasp.inputs.Kpoints import automatic [as 别名]
def test_static_constructors(self):
kpoints = Kpoints.gamma_automatic([3, 3, 3], [0, 0, 0])
self.assertEqual(kpoints.style, Kpoints.supported_modes.Gamma)
self.assertEqual(kpoints.kpts, [[3, 3, 3]])
kpoints = Kpoints.monkhorst_automatic([2, 2, 2], [0, 0, 0])
self.assertEqual(kpoints.style, Kpoints.supported_modes.Monkhorst)
self.assertEqual(kpoints.kpts, [[2, 2, 2]])
kpoints = Kpoints.automatic(100)
self.assertEqual(kpoints.style, Kpoints.supported_modes.Automatic)
self.assertEqual(kpoints.kpts, [[100]])
filepath = os.path.join(test_dir, 'POSCAR')
poscar = Poscar.from_file(filepath)
kpoints = Kpoints.automatic_density(poscar.structure, 500)
self.assertEqual(kpoints.kpts, [[1, 3, 3]])
self.assertEqual(kpoints.style, Kpoints.supported_modes.Gamma)
kpoints = Kpoints.automatic_density(poscar.structure, 500, True)
self.assertEqual(kpoints.style, Kpoints.supported_modes.Gamma)
kpoints = Kpoints.automatic_density_by_vol(poscar.structure, 1000)
self.assertEqual(kpoints.kpts, [[6, 10, 13]])
self.assertEqual(kpoints.style, Kpoints.supported_modes.Gamma)
s = poscar.structure
s.make_supercell(3)
kpoints = Kpoints.automatic_density(s, 500)
self.assertEqual(kpoints.kpts, [[1, 1, 1]])
self.assertEqual(kpoints.style, Kpoints.supported_modes.Gamma)
kpoints = Kpoints.from_string("""k-point mesh
0
G
10 10 10
0.5 0.5 0.5
""")
self.assertArrayAlmostEqual(kpoints.kpts_shift, [0.5, 0.5, 0.5])
示例2: test_static_constructors
# 需要导入模块: from pymatgen.io.vasp.inputs import Kpoints [as 别名]
# 或者: from pymatgen.io.vasp.inputs.Kpoints import automatic [as 别名]
def test_static_constructors(self):
kpoints = Kpoints.gamma_automatic([3, 3, 3], [0, 0, 0])
self.assertEqual(kpoints.style, Kpoints.supported_modes.Gamma)
self.assertEqual(kpoints.kpts, [[3, 3, 3]])
kpoints = Kpoints.monkhorst_automatic([2, 2, 2], [0, 0, 0])
self.assertEqual(kpoints.style, Kpoints.supported_modes.Monkhorst)
self.assertEqual(kpoints.kpts, [[2, 2, 2]])
kpoints = Kpoints.automatic(100)
self.assertEqual(kpoints.style, Kpoints.supported_modes.Automatic)
self.assertEqual(kpoints.kpts, [[100]])
filepath = os.path.join(test_dir, "POSCAR")
poscar = Poscar.from_file(filepath)
kpoints = Kpoints.automatic_density(poscar.structure, 500)
self.assertEqual(kpoints.kpts, [[2, 4, 4]])
self.assertEqual(kpoints.style, Kpoints.supported_modes.Monkhorst)
kpoints = Kpoints.automatic_density(poscar.structure, 500, True)
self.assertEqual(kpoints.style, Kpoints.supported_modes.Gamma)
kpoints = Kpoints.automatic_density_by_vol(poscar.structure, 1000)
self.assertEqual(kpoints.kpts, [[6, 11, 13]])
self.assertEqual(kpoints.style, Kpoints.supported_modes.Gamma)
s = poscar.structure
s.make_supercell(3)
kpoints = Kpoints.automatic_density(s, 500)
self.assertEqual(kpoints.kpts, [[1, 1, 1]])
self.assertEqual(kpoints.style, Kpoints.supported_modes.Gamma)
示例3: set_kpoints
# 需要导入模块: from pymatgen.io.vasp.inputs import Kpoints [as 别名]
# 或者: from pymatgen.io.vasp.inputs.Kpoints import automatic [as 别名]
def set_kpoints(self, kpoint):
"""
set the kpoint
"""
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 == '3DD':
self.kpoints = Kpoints.automatic_density_by_vol(structure= \
self.poscar.structure, kppvol=kpoint)
elif self.Grid_type == 'band':
self.kpoints = Kpoints.automatic_linemode(divisions=kpoint, \
ibz=HighSymmKpath(self.poscar.structure))
示例4: set_kpoints
# 需要导入模块: from pymatgen.io.vasp.inputs import Kpoints [as 别名]
# 或者: from pymatgen.io.vasp.inputs.Kpoints import automatic [as 别名]
def set_kpoints(self, kpoint):
"""
set the kpoint
"""
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 == '3DD':
self.kpoints = Kpoints.automatic_density_by_vol(structure=\
self.poscar.structure, kppvol=kpoint)
elif self.Grid_type == 'band':
self.kpoints = Kpoints.automatic_linemode(divisions=kpoint,\
ibz=HighSymmKpath(self.poscar.structure))
name = self.kpoint_to_name(kpoint, self.Grid_type)
job_dir = self.job_dir +os.sep+ self.key_to_name('KPOINTS') \
+ os.sep + name
return job_dir
示例5: Poscar
# 需要导入模块: from pymatgen.io.vasp.inputs import Kpoints [as 别名]
# 或者: from pymatgen.io.vasp.inputs.Kpoints import automatic [as 别名]
incar_dict = {
'SYSTEM': 'test',
'ENCUT': 500,
'ISIF': 2,
'IBRION': 2,
'ISMEAR': 1,
'EDIFF': 1e-06,
'NPAR': 8,
'SIGMA': 0.1,
'NSW' : 100,
'PREC': 'Accurate'
}
incar = Incar.from_dict(incar_dict)
poscar = Poscar(iface)
potcar = Potcar(poscar.site_symbols)
kpoints = Kpoints.automatic(20)
#set job list. if empty a single job will be run
encut_list = [] #range(400,800,100)
turn_knobs = OrderedDict(
[
('ENCUT', encut_list)
])
#job directory
job_dir = 'vasp_job'
# run settings
qadapter = None
job_cmd = None
nprocs = 16
nnodes = 1
walltime = '24:00:00'
mem = 1000
示例6: set_kpoints
# 需要导入模块: from pymatgen.io.vasp.inputs import Kpoints [as 别名]
# 或者: from pymatgen.io.vasp.inputs.Kpoints import automatic [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)