Coverage for /builds/kinetik161/ase/ase/calculators/turbomole/writer.py: 18.75%
16 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-12-10 11:04 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-12-10 11:04 +0000
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)