File: example_nwchem.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-- 683 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 sys

from ase.build import molecule
from ase.calculators.nwchem import NWChem
from ase.calculators.socketio import SocketIOCalculator
from ase.optimize import BFGS

atoms = molecule('H2O')
atoms.rattle(stdev=0.1)

unixsocket = 'ase_nwchem'
socket_kwargs = dict(task='optimize', driver={'socket': {'unix': unixsocket}})
nwchem = NWChem(directory='calc-nwchem', theory='scf', **socket_kwargs)

opt = BFGS(atoms, trajectory='opt.traj', logfile='opt.log')

# Manually create socket io calcualtor since nwchem does not yet have
# the .socketio() shortcut:
with SocketIOCalculator(nwchem, log=sys.stdout, unixsocket=unixsocket) as calc:
    atoms.calc = calc
    opt.run(fmax=0.05)