其他分享
首页 > 其他分享> > ase库和xtb库结合进行构型优化

ase库和xtb库结合进行构型优化

作者:互联网

本文主要基于ase官方文档
使用xtb-python接口作为calculator

from ase import Atoms
from ase.optimize import BFGS
from ase.io.trajectory import Trajectory
water = Atoms('HOH', positions = [[0, 0, -1], [0, 1, 0], [0, 0, 1]])
from xtb.ase.calculator import XTB
water.calc = XTB(method = "GFN2-xTB")
opt = BFGS(water, trajectory = 'opt.traj')
opt.run(fmax = 0.05)
traj = Trajectory('opt.traj')
for atoms in traj:
    print(atoms.positions, atoms.get_potential_energy())

结果如下:
Step Time Energy fmax
BFGS: 0 11:48:50 -134.169582 7.7630
BFGS: 1 11:48:50 -135.791628 6.9198
BFGS: 2 11:48:50 -137.876804 1.7051
BFGS: 3 11:48:50 -137.853712 2.8540
BFGS: 4 11:48:50 -137.941753 0.6583
BFGS: 5 11:48:50 -137.955264 0.5226
BFGS: 6 11:48:50 -137.976499 0.0566
BFGS: 7 11:48:50 -137.976542 0.0007
[[ 0. 0. -1.]
[ 0. 1. 0.]
[ 0. 0. 1.]] -134.1695821399963
[[ 9.29408340e-18 5.54496911e-02 -9.48703487e-01]
[-1.00644410e-17 8.89100618e-01 -9.47284802e-18]
[ 7.70357583e-19 5.54496911e-02 9.48703487e-01]] -135.7916277544899
[[ 9.20266853e-18 1.55449691e-01 -8.39242853e-01]
[-8.93725953e-18 6.89100618e-01 -9.31895833e-17]
[-3.71104932e-18 1.55449691e-01 8.39242853e-01]] -137.8768035909548
[[ 1.30807253e-16 1.77025147e-01 -7.95166284e-01]
[-1.11305275e-16 6.45949706e-01 8.81331708e-17]
[-7.76865093e-18 1.77025147e-01 7.95166284e-01]] -137.85371154320737
[[ 1.24670797e-16 1.59866969e-01 -8.12604206e-01]
[-1.04453221e-16 6.80266062e-01 1.09326373e-16]
[-1.39219053e-17 1.59866969e-01 8.12604206e-01]] -137.94175256013645
[[ 1.27640540e-16 1.56128949e-01 -8.03964795e-01]
[-9.97592069e-17 6.87742102e-01 6.72864072e-17]
[-2.00635675e-17 1.56128949e-01 8.03964795e-01]] -137.95526411489126
[[ 4.33930237e-16 1.43243972e-01 -7.72452722e-01]
[-3.30014293e-16 7.13512056e-01 3.89666616e-16]
[-9.03399679e-17 1.43243972e-01 7.72452722e-01]] -137.976499448259
[[ 2.63550122e-16 1.43670850e-01 -7.72230878e-01]
[-1.44291002e-16 7.12658300e-01 -7.05619458e-17]
[-1.05572135e-16 1.43670850e-01 7.72230878e-01]] -137.9765422816702

标签:11,BFGS,01,构型,17,16,50,xtb,ase
来源: https://blog.csdn.net/frank_haha/article/details/114926105