Skip to content

Commit

Permalink
mk_prepare_receptor writes reactive config for adgpu only if --write_…
Browse files Browse the repository at this point in the history
…pdbqt
  • Loading branch information
diogomart committed Oct 12, 2024
1 parent 3c4e030 commit df52267
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions scripts/mk_prepare_receptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,14 +598,7 @@ def get_args():

for res_id in all_flexres:
chorizo.flexibilize_sidechain(res_id, mk_prep)
rigid_pdbqt, flex_pdbqt_dict = PDBQTWriterLegacy.write_from_linked_rdkit_chorizo(
chorizo
)

pdbqt = {
"rigid": rigid_pdbqt,
"flex": flex_pdbqt_dict,
}

any_lig_base_types = [
"HD",
Expand Down Expand Up @@ -657,6 +650,10 @@ def get_args():
fn_base = args.write_pdbqt[0]
else:
fn_base = str(outpath)

pdbqt_tuple = PDBQTWriterLegacy.write_from_linked_rdkit_chorizo(chorizo)
rigid_pdbqt, flex_pdbqt_dict = pdbqt_tuple

if len(all_flexres) == 0:
box_center = args.box_center
rigid_fn = fn_base + ".pdbqt"
Expand All @@ -665,7 +662,7 @@ def get_args():
print(f"{reactive_flexres=}")
all_flex_pdbqt = ""
reactive_flexres_count = 0
for res_id, flexres_pdbqt in pdbqt["flex"].items():
for res_id, flexres_pdbqt in flex_pdbqt_dict.items():
all_flex_pdbqt += flexres_pdbqt

rigid_fn = fn_base + "_rigid.pdbqt"
Expand All @@ -679,14 +676,14 @@ def get_args():
written_files_log["filename"].append(rigid_fn)
written_files_log["description"].append("static (i.e., rigid) receptor input file")
with open(rigid_fn, "w") as f:
f.write(pdbqt["rigid"])
f.write(rigid_pdbqt)

def warn_flexres_outside_box(chorizo, box_center, box_size):
for res_id, res in chorizo.residues.items():
if not res.is_movable:
continue
for atom in res.molsetup.atoms:
if not res.is_flexres_atom[atom.index]:
if not res.is_flexres_atom[atom.index]: # TODO: not implemented
continue
if gridbox.is_point_outside_box(atom.coord, box_center, box_size, spacing=1.0):
print(
Expand Down Expand Up @@ -852,7 +849,7 @@ def warn_flexres_outside_box(chorizo, box_center, box_size):


# configuration info for AutoDock-GPU reactive docking
if len(reactive_flexres) > 0:
if len(reactive_flexres) > 0 and args.write_pdbqt is not None:
any_lig_reac_types = []
for order in (1, 2, 3):
for t in any_lig_base_types:
Expand Down

0 comments on commit df52267

Please sign in to comment.