本文整理汇总了Python中ase.neb.NEB.set_calculator方法的典型用法代码示例。如果您正苦于以下问题:Python NEB.set_calculator方法的具体用法?Python NEB.set_calculator怎么用?Python NEB.set_calculator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ase.neb.NEB
的用法示例。
在下文中一共展示了NEB.set_calculator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_atoms
# 需要导入模块: from ase.neb import NEB [as 别名]
# 或者: from ase.neb.NEB import set_calculator [as 别名]
def get_atoms():
# 2x2-Al(001) surface with 3 layers and an
# Au atom adsorbed in a hollow site:
slab = fcc100('Al', size=(2, 2, 3))
add_adsorbate(slab, 'Au', 1.7, 'hollow')
slab.center(axis=2, vacuum=4.0)
# Fix second and third layers:
mask = [atom.tag > 1 for atom in slab]
slab.set_constraint(FixAtoms(mask=mask))
# Use EMT potential:
slab.set_calculator(EMT())
# Initial state:
qn = QuasiNewton(slab, logfile=None)
qn.run(fmax=0.05)
initial = slab.copy()
# Final state:
slab[-1].x += slab.get_cell()[0, 0] / 2
qn = QuasiNewton(slab, logfile=None)
qn.run(fmax=0.05)
final = slab.copy()
# Setup a NEB calculation
constraint = FixAtoms(mask=[atom.tag > 1 for atom in initial])
images = [initial]
for i in range(3):
image = initial.copy()
image.set_constraint(constraint)
images.append(image)
images.append(final)
neb = NEB(images, parallel=mpi.parallel)
neb.interpolate()
def set_calculator(calc):
i = 0
for image in neb.images[1:-1]:
if not mpi.parallel or mpi.rank // (mpi.size // 3) == i:
image.set_calculator(calc)
i += 1
neb.set_calculator = set_calculator
return neb