-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdebugscript.py
More file actions
34 lines (30 loc) · 817 Bytes
/
debugscript.py
File metadata and controls
34 lines (30 loc) · 817 Bytes
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
29
30
31
32
33
import subprocess
import sys
import time
import os
import random
OFN = "cp2kO.inp"
EFN = "cp2kE.inp"
print("PYTHON: opened")
def CP2K(OFN,EFN,typ,CN,geomXYZ):
if typ == "O":
file = open(str(CN) + '/opt.xyz', 'w')
try:
with open(str(CN) + '/input.xyz','r') as file2:
for line in file2:
file.write(line.strip()+'\n')
finally:
file2.close()
file.close()
elif typ == "E":
file = open( str(CN) + '/e.txt', 'w')
try:
file.write(str(random.random() - 0.5))
finally:
file.close()
command = sys.argv[1]
if command == "cancel":
com = 'pkill cp2k.psmp'
subprocess.run(com,shell=True)
else:
CP2K(OFN,EFN,sys.argv[1],sys.argv[2],"input.xyz")