-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.py
executable file
·76 lines (59 loc) · 2.22 KB
/
start.py
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import glob
import os
import shutil
import argparse
import time
from interface.lib import *
# XTB Conformer search
def initial_run(pdt_complex, rule_file, constrain_file=None):
cwd = os.getcwd()
crest_run(pdt_complex, 'result.out')
crest_conf_split()
os.makedirs(cwd+'/conformations')
conf_lst = glob.glob('conf*.xyz')
print(conf_lst)
isConstrain = os.path.isfile('constrain')
paths = []
for i in conf_lst:
os.makedirs(cwd+'/conformations/'+(i.split('.')[0]))
shutil.copy(i, cwd+'/conformations/'+(i.split('.')[0]))
shutil.copy('/home/18cy91r30/autore2/driver.py', cwd+'/conformations/'+(i.split('.')[0]))
shutil.copy(cwd+'/'+rule_file, cwd+'/conformations/'+(i.split('.')[0]))
if isConstrain:
shutil.copy(cwd+'/constrain', cwd+'/conformations/'+(i.split('.')[0]))
else:
pass
os.chdir(cwd+'/conformations/'+(i.split('.')[0]))
slurm_input('submit.sh',i.split('.')[0])
path = os.getcwd()
paths.append(path)
os.chdir(cwd)
# print(paths)
with open('path.txt', 'w') as fp:
for i in paths:
fp.writelines('cd '+i+'\n')
fp.writelines('sbatch submit.sh'+'\n')
def main():
parser = argparse.ArgumentParser(description='Parser for autore2')
parser.add_argument('-m', '--molecule', type=str, nargs=1, required=True, help='Name of the pdt')
parser.add_argument('-r', '--rule', type=str, nargs=1, required=True, help='Active atom file name has to be act_atom.txt')
args = parser.parse_args()
pdt_complex = args.molecule[0]
rule_file = args.rule[0]
cpu_st = time.process_time()
wall_st = time.time()
initial_run(pdt_complex, rule_file)
# print(pdt_complex)
# print(rule_file)
cpu_et = time.process_time()
wall_et = time.time()
wall_elapsed = wall_et - wall_st
cpu_elapsed = cpu_et - cpu_st
print(2*'\n')
print('Total Timings: '+'\n')
print('==========================')
print('Wall Time: ', time.strftime("%H:%M:%S", time.gmtime(wall_elapsed)))
print('CPU Time: ', time.strftime("%H:%M:%S", time.gmtime(cpu_elapsed)))
print('==========================')
if __name__ == '__main__':
main()