Coverage for /builds/ase/ase/ase/calculators/turbomole/writer.py : 18.75%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""Module containing code to manupulate control file"""
2import subprocess
5def add_data_group(data_group, string=None, raw=False):
6 """write a turbomole data group to control file"""
7 if raw:
8 data = data_group
9 else:
10 data = '$' + data_group
11 if string:
12 data += ' ' + string
13 data += '\n'
14 with open('control', 'r+') as contr:
15 lines = contr.readlines()
16 contr.seek(0)
17 contr.truncate()
18 lines.insert(2, data)
19 contr.write(''.join(lines))
22def delete_data_group(data_group):
23 """delete a turbomole data group from control file"""
24 subprocess.run(['kdg', data_group], check=True)