File: turbomole_H2.py

package info (click to toggle)
python-ase 3.12.0-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 14,192 kB
  • ctags: 8,112
  • sloc: python: 93,375; sh: 99; makefile: 94
file content (28 lines) | stat: -rw-r--r-- 752 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
22
23
24
25
26
27
28
import os
from subprocess import Popen, PIPE, STDOUT

from ase import Atoms
from ase.calculators.turbomole import Turbomole

# Delete old coord, control, ... files, if exist
for f in ['coord',
          'basis',
          'energy',
          'mos',
          'statistics',
          'control']:
    if os.path.exists(f):
        os.remove(f)

atoms = Atoms('H2', positions=[(0, 0, 0), (0, 0, 1.1)])
atoms.set_calculator(Turbomole()) # Writes a coord file as well

# Write all commands for the define command in a string
define_str = '\n\na coord\n*\nno\nb all sto-3g hondo\n*\neht\n\n\n\n*'

# Run define
p = Popen('define', stdout=PIPE, stdin=PIPE, stderr=STDOUT)
stdout = p.communicate(input=define_str)

# Run turbomole
atoms.get_potential_energy()