forked from HITS-MBM/kimmdy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Automized_run.py
71 lines (50 loc) · 2.83 KB
/
Automized_run.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
"""
Part of reactive Kinetic Monte Carlo / Molecular Dynamics Simulations (rKMC/MD)
This modules contains all functions that are directly executing task in the terminal or need to communicate with the terminal
"""
import numpy as np
import subprocess as sp
import os
def do_production_run(grofile,topfile,mdpfile, indexfile, tprfile,trrfile):
command=sp.Popen('gmx grompp -p '+topfile+' -c '+grofile+' -r '+grofile+' -f '+mdpfile + ' -n ' +indexfile + ' -o '+tprfile + ' -maxwarn 5' ,shell=True)
command.wait()
command=sp.Popen('gmx mdrun -v -s '+tprfile+ ' -o ' +trrfile,shell=True) #use mpirun mdrun_mpi on cluster / several nodes are used
command.wait()
def do_equilibration(grofile,topfile,mdpfile,tprfile,outgro):
command=sp.Popen('gmx grompp -p '+topfile+' -c '+grofile+' -r '+grofile+' -f '+mdpfile+' -o '+tprfile,shell=True)
command.wait()
command=sp.Popen('gmx mdrun -v -s '+tprfile+' -c '+outgro,shell=True)
command.wait()
def do_energy_minimisation(grofile,topfile,mdpfile,tprfile,outgro):
command=sp.Popen('gmx grompp -p '+topfile+' -c '+grofile+' -r '+grofile+' -f '+mdpfile+' -o '+tprfile,shell=True)
command.wait()
command=sp.Popen('gmx mdrun -s '+tprfile+' -c '+outgro,shell=True)
command.wait()
def equilibration_after_break(oldcpt, newmdp, oldtpr, newtpr, newtop, indexfile, outgro, newtrr):
command = sp.Popen(" gmx grompp -f " + newmdp + " -p " + newtop + ' -n ' + indexfile + " -c "+ oldtpr + " -r "+oldtpr+" -o " + newtpr + " -t " + oldcpt + ' -maxwarn 5', shell = True)
command.wait()
command=sp.Popen('gmx mdrun -v -s '+newtpr+ ' -c '+ outgro + ' -o ' + newtrr,shell=True) # use mpirun mdrun_mpi on cluster
command.wait()
def continue_run (oldcpt, newmdp, oldtpr, newtpr, newtop, indexfile, newtrr, plumedfile):
command = sp.Popen(" gmx grompp -f " + newmdp + " -p " + newtop + ' -n ' + indexfile + " -c "+ oldtpr + " -r "+oldtpr+" -o " + newtpr + " -t " + oldcpt + ' -maxwarn 5', shell = True)
command.wait()
command=sp.Popen('gmx mdrun -v -s '+newtpr+' -o '+ newtrr + ' -plumed ' + plumedfile,shell=True) # use mpirun mdrun_mpi on cluster
command.wait()
def concat_all_trr(nbr_of_files):
#beachte Reihenfolge! Wird so einfach hintereinander gehaengt. t.b.d.
command=sp.Popen('gmx trjcat -f *.trr -o combined.trr -cat -settime' ,shell=True)
command.wait()
inputstr = "0"
command=command.communicate(input=inputstr.encode()) # setze erstes Frame auf 0 und dann alle auf "C"
command.wait()
for i in range(nbr_of_files -1):
inputstr = "c"
command=command.communicate(input=inputstr.encode())
command.wait()
def create_dir(dir_name):
command=sp.Popen('mkdir -p ' + dir_name ,shell=True)
command.wait()
def change_to_dir(dir_name):
os.chdir(dir_name)
if __name__ == "__main__":
pass