本文整理汇总了Python中ase.optimize.QuasiNewton.get_number_of_steps方法的典型用法代码示例。如果您正苦于以下问题:Python QuasiNewton.get_number_of_steps方法的具体用法?Python QuasiNewton.get_number_of_steps怎么用?Python QuasiNewton.get_number_of_steps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ase.optimize.QuasiNewton
的用法示例。
在下文中一共展示了QuasiNewton.get_number_of_steps方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fcc111
# 需要导入模块: from ase.optimize import QuasiNewton [as 别名]
# 或者: from ase.optimize.QuasiNewton import get_number_of_steps [as 别名]
#sets up the slab and molecule
slab = fcc111('Pd', size=(3,3,2), vacuum=10)
molecule = Atoms('CO', [(0., 0., 0.), (0., 0., 1.13)])
add_adsorbate(slab, molecule, 1.7, 'ontop')
#sets up the calculator
calc = EMT()
slab.set_calculator(calc)
#runs optimization
dyn = QuasiNewton(slab, trajectory='CO-Pd-ontop.traj')
dyn.run(fmax=0.05)
#writes the trajectory file in .xyz format
traj = PickleTrajectory("CO-Pd-ontop.traj")
nsteps = dyn.get_number_of_steps()
string = 'structure'
path = os.getcwd()
path = path + '/scratch'
if not os.path.exists(path): os.makedirs(path)
outFileName = 'trajectory.xyz'
for i in range(0, nsteps+1):
atoms = traj[i]
string = 'structure%03d' % (i,) +'.xyz'
outStruct = os.path.join(path, string)
write(outStruct, atoms)
#combines all optimization steps in one trajectory file
inFile = open (os.path.join(path, 'structure%03d' % (i,) +'.xyz'), 'r')
fileStr = inFile.read()