File: dftd3_gpaw.py

package info (click to toggle)
python-ase 3.26.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,484 kB
  • sloc: python: 148,112; xml: 2,728; makefile: 110; javascript: 47
file content (21 lines) | stat: -rw-r--r-- 541 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import numpy as np
from gpaw import GPAW, PW

from ase.build import bulk
from ase.calculators.dftd3 import DFTD3
from ase.constraints import UnitCellFilter
from ase.optimize import LBFGS

rng = np.random.RandomState(0)

diamond = bulk('C')
diamond.rattle(stdev=0.1, rng=rng)
diamond.cell += rng.normal(scale=0.1, size=(3, 3))
dft = GPAW(xc='PBE', kpts=(8, 8, 8), mode=PW(400))
d3 = DFTD3(dft=dft)
diamond.calc = d3

ucf = UnitCellFilter(diamond)

opt = LBFGS(ucf, logfile='diamond_opt.log', trajectory='diamond_opt.traj')
opt.run(fmax=0.05)