Beispiel #1
0
def main():
    parser = argparse.ArgumentParser(description='Perform SMD runs for dynamic undocking')
    parser.add_argument('-i', '--input', help='Equilibrated system as input')
    parser.add_argument('-p', '--pickle', help='Pickle file')
    parser.add_argument('-n', '--num-runs', type=int, help='Number of SMD runs.')
    # parser.add_argument('-o', '--output', help="PDB output")
    parser.add_argument('-l', '--md-len', type=float, help='MD run length.')
    parser.add_argument('-d', '--start-dist', type=float, help='Starting distance')
    parser.add_argument('-v', '--init-velocity', type=float, help='Initial velocity')
    parser.add_argument('--gpu-id', type=int, help='GPU ID (optional); if not specified, runs on CPU only.')

    args = parser.parse_args()
    shutil.copyfile(args.input, "equil.chk")
    shutil.copyfile(args.pickle, "complex_system.pickle")

    # Now do the MD
    # remember start_dist
    for i in range(args.num_runs):
        if i == 0:
            md_start = "equil.chk"
        else:
            md_start = "md_" + str(i - 1) + ".chk"
        log_file = "md_" + str(i) + ".csv"
        perform_md(
            md_start,
            "md_" + str(i) + ".chk",
            log_file,
            "md_" + str(i) + ".pdb",
            md_len=args.md_len,
            gpu_id=args.gpu_id,
        )
        # Open the file and check that the potential is stable and negative
        if not check_if_equlibrated(log_file, 3):
            print("SYSTEM NOT EQUILIBRATED")
            sys.exit()
        # Now find the interaction and save to a file
        run_steered_md(
            300,
            "md_" + str(i) + ".chk",
            "smd_" + str(i) + "_300.csv",
            "smd_" + str(i) + "_300.dat",
            "smd_" + str(i) + "_300.pdb",
            "smd_" + str(i) + "_300.dcd",
            args.start_dist,
            init_velocity=args.init_velocity,
            gpu_id=args.gpu_id,
        )
        run_steered_md(
            325,
            "md_" + str(i) + ".chk",
            "smd_" + str(i) + "_325.csv",
            "smd_" + str(i) + "_325.dat",
            "smd_" + str(i) + "_325.pdb",
            "smd_" + str(i) + "_325.dcd",
            args.start_dist,
            init_velocity=args.init_velocity,
            gpu_id=args.gpu_id,
        )
def run_simulation(
    prot_file,
    mol_file,
    prot_code,
    prot_int,
    cutoff,
    init_velocity,
    num_smd_cycles,
    gpu_id,
    md_len,
    params,
):
    if not os.path.isfile("equil.chk"):
        # A couple of file name
        orig_file = prot_file
        chunk_protein = "protein_out.pdb"
        chunk_protein_prot = "protein_out_prot.pdb"
        # Do the removal of buffer mols and alt locs
        if params.get("remove_buffers", True):
            prot_file = remove_prot_buffers_alt_locs(prot_file)
        # Do the chunking and the protonation
        if params.get("prep_chunk", True):
            # Chunk
            chunk_with_amber(mol_file, prot_file, prot_int, chunk_protein,
                             cutoff, orig_file)
            # Protontate
            disulfides = find_disulfides(chunk_protein)
            do_tleap(chunk_protein, chunk_protein_prot, disulfides)
        else:
            chunk_protein_prot = prot_file
        # Paramaterize the ligand
        mol2_file = params.get("mol2_file_prepped", None)
        if not mol2_file:
            results = prep_lig(mol_file, prot_code)
            mol2_file = results[0]
        prepare_system(mol2_file, chunk_protein_prot)
        # Now find the interaction and save to a file
        results = find_interaction(prot_int, orig_file)
        startdist = params.get("distance", results[2])
        # Now do the equlibration
        do_equlibrate(gpu_id=gpu_id)
    else:
        # Now find the interaction and save to a file
        results = find_interaction(prot_int, prot_file)
        startdist = params.get("distance", results[2])
    # Open the file and check that the potential is stable and negative
    if not check_if_equlibrated("density.csv", 1):
        print("SYSTEM NOT EQUILIBRATED")
        sys.exit()
    if params.get("just_equilib", False):
        print("SYSTEM FENISHED EQULIBRATING")
        return
    # Now do the MD
    for i in range(num_smd_cycles):
        if i == 0:
            md_start = "equil.chk"
        else:
            md_start = "md_" + str(i - 1) + ".chk"
        log_file = "md_" + str(i) + ".csv"
        perform_md(
            md_start,
            "md_" + str(i) + ".chk",
            log_file,
            "md_" + str(i) + ".pdb",
            md_len=md_len,
            gpu_id=gpu_id,
        )
        # Open the file and check that the potential is stable and negative
        if not check_if_equlibrated(log_file, 3):
            print("SYSTEM NOT EQUILIBRATED")
            sys.exit()
        # Now find the interaction and save to a file
        run_steered_md(
            300,
            "md_" + str(i) + ".chk",
            "smd_" + str(i) + "_300.csv",
            "smd_" + str(i) + "_300.dat",
            "smd_" + str(i) + "_300.pdb",
            "smd_" + str(i) + "_300.dcd",
            startdist,
            init_velocity=init_velocity,
            gpu_id=gpu_id,
        )
        run_steered_md(
            325,
            "md_" + str(i) + ".chk",
            "smd_" + str(i) + "_325.csv",
            "smd_" + str(i) + "_325.dat",
            "smd_" + str(i) + "_325.pdb",
            "smd_" + str(i) + "_325.dcd",
            startdist,
            init_velocity=init_velocity,
            gpu_id=gpu_id,
        )
Beispiel #3
0
from duck.steps.normal_md import perform_md
from duck.steps.steered_md import run_steered_md
# Define these
prot_code = "MURD-x0374"
prot_int = "A_LYS_311_N"
# Cutoff for the sphere
# Now it does the magic
results = get_from_prot_code(prot_code)
prot_file = results[0]
# Now find the interaction and save to a file

results = find_interaction(prot_int, prot_file)
startdist = results[2]
for i in range(20):
    if i == 0:
        md_start = "equil.chk"
    else:
        md_start = "md_" + str(i - 1) + ".chk"
    perform_md(md_start,
               "md_" + str(i) + ".chk",
               "md_" + str(i) + ".csv",
               "md_" + str(i) + ".pdb",
               md_len=0.5)
    # Now find the interaction and save to a file
    run_steered_md(300, "md_" + str(i) + ".chk", "smd_" + str(i) + "_300.csv",
                   "smd_" + str(i) + "_300.dat", "smd_" + str(i) + "_300.pdb",
                   "smd_" + str(i) + "_300.dcd", startdist)
    run_steered_md(325, "md_" + str(i) + ".chk", "smd_" + str(i) + "_325.csv",
                   "smd_" + str(i) + "_325.dat", "smd_" + str(i) + "_325.pdb",
                   "smd_" + str(i) + "_325.dcd", startdist)