Skip to content

Commit

Permalink
Merge pull request #14 from afloresep/pull-req
Browse files Browse the repository at this point in the history
Pull req
  • Loading branch information
jesperswillem authored Aug 17, 2023
2 parents 7b6807e + 1d29d3c commit c0111c0
Show file tree
Hide file tree
Showing 12 changed files with 1,163 additions and 198 deletions.
153 changes: 103 additions & 50 deletions QligFEP.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,61 +713,115 @@ def write_runfile(self, writedir, file_list):
run_threads = '{}'.format(int(replacements['NTASKS']))

with open(src) as infile, open(tgt, 'w') as outfile:
for line in infile:
if line.strip() == '#SBATCH -A ACCOUNT':
try:
replacements['ACCOUNT']

except:
line = ''
outline = IO.replace(line, replacements)
outfile.write(outline)

if line.strip() == '#EQ_FILES':
for line in EQ_files:
file_base = line.split('/')[-1][:-4]
outline = 'time mpirun -np {} $qdyn {}.inp' \
' > {}.log\n'.format(ntasks,
file_base,
file_base)
outfile.write(outline)

if line.strip() == '#RUN_FILES':
if self.start == '1':
for line in MD_files:
if self.cluster=='CSB':

for line in infile:
if line.strip() == '#SBATCH -A ACCOUNT':
try:
replacements['ACCOUNT']

except:
line = ''
outline = IO.replace(line, replacements)
outfile.write(outline)

if line.strip() == '#EQ_FILES':
for line in EQ_files:
file_base = line.split('/')[-1][:-4]
outline = 'time mpirun -np {} $qdyn {}.inp' \
' > {}.log\n'.format(ntasks,
file_base,
file_base)
outline = 'time mpirun -np {} $qdyn {}.inp' \
' > {}.log\n'.format(ntasks,
file_base,
file_base)
outfile.write(outline)

if line.strip() == '#RUN_FILES':
if self.start == '1':
for line in MD_files:
file_base = line.split('/')[-1][:-4]
outline = 'time mpirun -np {} $qdyn {}.inp' \
' > {}.log\n'.format(ntasks,
file_base,
file_base)
outfile.write(outline)

elif self.start == '0.5':
outline = 'time mpirun -np {} $qdyn {}.inp' \
' > {}.log\n\n'.format(ntasks,
'md_0500_0500',
'md_0500_0500')
outfile.write(outline)
for i, md in enumerate(md_1):
outline1 = 'time mpirun -np {:d} $qdyn {}.inp' \
' > {}.log &\n'.format(int(int(ntasks)/2),
md_1[i][:-4],
md_1[i][:-4])

outline2 = 'time mpirun -np {:d} $qdyn {}.inp' \
' > {}.log\n'.format(int(int(ntasks)/2),
md_2[i][:-4],
md_2[i][:-4])

outfile.write(outline1)
outfile.write(outline2)
outfile.write('\n')
elif self.cluster=='TETRA':

for line in infile:
if line.strip() == '#SBATCH -A ACCOUNT':
try:
replacements['ACCOUNT']

elif self.start == '0.5':
outline = 'time mpirun -np {} $qdyn {}.inp' \
' > {}.log\n\n'.format(ntasks,
'md_0500_0500',
'md_0500_0500')
outfile.write(outline)
for i, md in enumerate(md_1):
outline1 = 'time mpirun -np {:d} $qdyn {}.inp' \
' > {}.log &\n'.format(int(int(ntasks)/2),
md_1[i][:-4],
md_1[i][:-4])

outline2 = 'time mpirun -np {:d} $qdyn {}.inp' \
' > {}.log\n'.format(int(int(ntasks)/2),
md_2[i][:-4],
md_2[i][:-4])

outfile.write(outline1)
outfile.write(outline2)
outfile.write('\n')
except:
line = ''
outline = IO.replace(line, replacements)
outfile.write(outline)

if line.strip() == '#EQ_FILES':
for line in EQ_files:
file_base = line.split('/')[-1][:-4]
outline = 'time mpprun -np {} $qdyn {}.inp' \
' > {}.log\n'.format(ntasks,
file_base,
file_base)
outfile.write(outline)

if self.cluster == 'ALICE':
if line.strip() == '#RUN_FILES':
if self.start == '1':
for line in MD_files:
file_base = line.split('/')[-1][:-4]
outline = 'time mpprun -np {} $qdyn {}.inp' \
' > {}.log\n'.format(ntasks,
file_base,
file_base)
outfile.write(outline)

elif self.start == '0.5':
outline = 'time mpprun -np {} $qdyn {}.inp' \
' > {}.log\n\n'.format(ntasks,
'md_0500_0500',
'md_0500_0500')
outfile.write(outline)
for i, md in enumerate(md_1):
outline1 = 'time mpprun -np {:d} $qdyn {}.inp' \
' > {}.log &\n'.format(int(int(ntasks)/2),
md_1[i][:-4],
md_1[i][:-4])

outline2 = 'time mpprun -np {:d} $qdyn {}.inp' \
' > {}.log\n'.format(int(int(ntasks)/2),
md_2[i][:-4],
md_2[i][:-4])

outfile.write(outline1)
outfile.write(outline2)
outfile.write('\n')
elif self.cluster == 'ALICE':
outfile.write('rm *.dcd\n')
outfile.write('rm *.en\n')
outfile.write('rm *.re\n')

else:
raise ValueError(f"Unknown cluster: {self.cluster}")

def write_qfep(self, inputdir, windows, lambdas):
qfep_in = s.ROOT_DIR + '/INPUTS/qfep.inp'
qfep_out = writedir + '/inputfiles/qfep.inp'
Expand Down Expand Up @@ -978,5 +1032,4 @@ def parseargs(args: list[str] = []) -> argparse.Namespace:
run.write_submitfile(writedir)
run.write_qfep(inputdir, args.windows, lambdas)
run.write_qprep(inputdir)
run.qprep(inputdir)

run.qprep(inputdir)
25 changes: 25 additions & 0 deletions call_analyze_FEP.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import os
import subprocess
import sys

def run_analyze_FEP(parent_folder, command_args):
for root, dirs, files in os.walk(parent_folder):
for dir_name in dirs:
if dir_name.startswith('FEP_'):
full_path = os.path.join(root, dir_name)
cmd = ['python', 'analyze_FEP.py', '-F', full_path] + command_args
subprocess.run(cmd)

if __name__ == "__main__":
if len(sys.argv) < 3:
print("Usage: python script_name.py <parent_folder> <command_args>")
sys.exit(1)

parent_folder = sys.argv[1]
command_args = sys.argv[2:]

if not os.path.isdir(parent_folder):
print(f"Error: '{parent_folder}' is not a valid directory.")
sys.exit(1)

run_analyze_FEP(parent_folder, command_args)
1 change: 1 addition & 0 deletions template/1.ligprep/ligand.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Move all your ligands here. See README.md for further instructions
1 change: 1 addition & 0 deletions template/2.protprep/prot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Move the protein here. See README.md for further instructions
Loading

0 comments on commit c0111c0

Please sign in to comment.