File: gulp_opt.py

package info (click to toggle)
python-ase 3.17.0-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 16,340 kB
  • sloc: python: 117,348; makefile: 91
file content (18 lines) | stat: -rw-r--r-- 528 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import numpy as np
from ase.calculators.gulp import GULP
from ase.optimize import BFGS
from ase.build import molecule

atoms = molecule('H2O')
atoms1 = atoms.copy()
atoms1.calc = GULP(library='reaxff.lib')
opt1 = BFGS(atoms1,trajectory='bfgs.traj')
opt1.run(fmax=0.005)

atoms2 = atoms.copy()
calc2 = GULP(keywords='opti conp', library='reaxff.lib')
opt2 = calc2.get_optimizer(atoms2)
opt2.run()

print(np.abs(opt1.atoms.positions - opt2.atoms.positions))
assert np.abs(opt1.atoms.positions - opt2.atoms.positions).max() < 1e-5