本文整理汇总了Python中ase.calculators.vasp.Vasp.read_kpoints方法的典型用法代码示例。如果您正苦于以下问题:Python Vasp.read_kpoints方法的具体用法?Python Vasp.read_kpoints怎么用?Python Vasp.read_kpoints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ase.calculators.vasp.Vasp
的用法示例。
在下文中一共展示了Vasp.read_kpoints方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: read_neb_calculator
# 需要导入模块: from ase.calculators.vasp import Vasp [as 别名]
# 或者: from ase.calculators.vasp.Vasp import read_kpoints [as 别名]
def read_neb_calculator():
"""Read calculator from the current working directory.
Static method that returns a :mod:`jasp.Jasp` calculator.
"""
log.debug('Entering read_neb_calculator in {0}'.format(os.getcwd()))
calc = Vasp()
calc.vaspdir = os.getcwd()
calc.read_incar()
calc.read_kpoints()
if calc.in_queue():
return ([None for i in range(calc.int_params['images'] + 2)],
[None for i in range(calc.int_params['images'] + 2)])
# set default functional
# if both gga and xc are not specified
if calc.string_params['gga'] is None:
if calc.input_params['xc'] is None:
calc.input_params['xc'] = 'PBE'
images = []
log.debug('calc.int_params[images] = %i', calc.int_params['images'])
# Add 2 to IMAGES flag from INCAR to get
# first and last images
for i in range(calc.int_params['images'] + 2):
log.debug('reading neb calculator: 0%i', i)
cwd = os.getcwd()
os.chdir('{0}'.format(str(i).zfill(2)))
if os.path.exists('CONTCAR'):
f = open('CONTCAR')
if f.read() == '':
log.debug('CONTCAR was empty, vasp probably still running')
fname = 'POSCAR'
else:
fname = 'CONTCAR'
else:
fname = 'POSCAR'
atoms = read(fname, format='vasp')
f = open('ase-sort.dat')
sort, resort = [], []
for line in f:
s, r = [int(x) for x in line.split()]
sort.append(s)
resort.append(r)
images += [atoms[resort]]
os.chdir(cwd)
log.debug('len(images) = %i', len(images))
calc.neb_images = images
calc.neb_nimages = len(images) - 2
calc.neb = True
return calc