Example #1
0
def main(config, system=None):
    conf = settings.ConfReader(config, system)
    global_log, _ = fu.get_logs(path=conf.get_working_dir_path(),
                                light_format=True)

    for mutation in conf.properties['mutations']:
        for ligand in conf.properties['ligands']:

            traj_code = "_".join([mutation, ligand])
            traj_code_path = os.path.join(mutation, ligand)
            ensemble_prop = conf.get_prop_dic(prefix=traj_code_path)
            ensemble_paths = conf.get_paths_dic(prefix=traj_code_path)

            # Image
            global_log.info("Imaging " + traj_code +
                            " trajectory to remove PBC issues")
            # /gpfs/projects/bsc23/bsc23513/BioExcel/BioExcel_EGFR_pmx/MDs/WT/WT_apo_md_FULL.xtc
            folder = conf.properties['workdir'] + "/" + mutation
            traj = folder + "/" + traj_code + "_md_FULL.xtc"
            top = folder + "/" + traj_code + "_md_1.tpr"
            out = folder + "/" + traj_code + "_md_FULL.imaged.xtc"
            global_log.info("Traj in:" + traj)
            global_log.info("Top in:" + top)
            global_log.info("Traj out:" + out)
            ensemble_paths['image']['input_traj_path'] = traj
            ensemble_paths['image']['input_top_path'] = top
            ensemble_paths['image']['output_traj_path'] = out
            gmx_image_pc(**ensemble_paths["image"],
                         properties=ensemble_prop["image"])
Example #2
0
def get_gromacs_version(gmx: str = "gmx") -> int:
    """ Gets the GROMACS installed version and returns it as an int(3) for
    versions older than 5.1.5 and an int(5) for 20XX versions filling the gaps
    with '0' digits.

    Args:
        gmx (str): ('gmx') Path to the GROMACS binary.

    Returns:
        int: GROMACS version.
    """
    unique_dir = fu.create_unique_dir()
    out_log, err_log = fu.get_logs(path=unique_dir, can_write_console=False)
    cmd = [gmx, "-version"]
    try:
        cmd_wrapper.CmdWrapper(cmd, out_log, err_log).launch()
        pattern = re.compile(r"GROMACS version:\s+(.+)")
        with open(Path(unique_dir).joinpath('log.out')) as log_file:
            for line in log_file:
                version_str = pattern.match(line.strip())
                if version_str:
                    break
        version = version_str.group(1).replace(".", "").replace("VERSION",
                                                                "").strip()
        version = "".join([c for c in version if c.isdigit()])
    except:
        return 0
    if version.startswith("2"):
        while len(version) < 5:
            version += '0'
    else:
        while len(version) < 3:
            version += '0'

    fu.rm(unique_dir)
    return int(version)
Example #3
0
def main(config, system=None):
    start_time = time.time()
    conf = settings.ConfReader(config, system)
    global_log, _ = fu.get_logs(path=conf.get_working_dir_path(),
                                light_format=True)
    global_prop = conf.get_prop_dic()
    global_paths = conf.get_paths_dic()

    dhdl_paths_listA = []
    dhdl_paths_listB = []
    for ensemble, mutation in conf.properties['mutations'].items():

        ensemble_prop = conf.get_prop_dic(prefix=ensemble)
        ensemble_paths = conf.get_paths_dic(prefix=ensemble)

        # step0_image
        global_log.info(
            ensemble +
            " Step 0: gmx image: Imaging trajectories to remove PBC issues")
        ensemble_paths['step0_image']['input_traj_path'] = conf.properties[
            'input_trajs'][ensemble]['input_traj_path']
        ensemble_paths['step0_image']['input_top_path'] = conf.properties[
            'input_trajs'][ensemble]['input_tpr_path']
        gmx_image_pc(**ensemble_paths["step0_image"],
                     properties=ensemble_prop["step0_image"])

        # step1_trjconv
        global_log.info(
            ensemble +
            " Step 1: gmx trjconv: Extract snapshots from equilibrium trajectories"
        )
        ensemble_paths['step1_trjconv_' +
                       ensemble]['input_top_path'] = conf.properties[
                           'input_trajs'][ensemble]['input_tpr_path']
        gmx_trjconv_str_ens_pc(**ensemble_paths['step1_trjconv_' + ensemble],
                               properties=ensemble_prop['step1_trjconv_' +
                                                        ensemble])

    for ensemble, mutation in conf.properties['mutations'].items():
        ensemble_prop = conf.get_prop_dic(prefix=ensemble)
        ensemble_paths = conf.get_paths_dic(prefix=ensemble)
        compss_wait_on_file(ensemble_paths['step1_trjconv_' +
                                           ensemble]["output_str_ens_path"])

        with zipfile.ZipFile(
                ensemble_paths['step1_trjconv_' +
                               ensemble]["output_str_ens_path"]) as zip_f:
            unique_dir = os.path.abspath(
                fu.create_unique_dir(
                    prefix=ensemble_prop['step1_trjconv_' +
                                         ensemble]['working_dir_path'] + '/' +
                    ensemble + '/'))
            zip_f.extractall(unique_dir)
            state_pdb_list = [
                os.path.join(unique_dir, name) for name in zip_f.namelist()
            ]

        for pdb_path in state_pdb_list:
            pdb_name = os.path.splitext(os.path.basename(pdb_path))[0]
            prop = conf.get_prop_dic(prefix=os.path.join(ensemble, pdb_name))
            paths = conf.get_paths_dic(prefix=os.path.join(ensemble, pdb_name))

            # Fixing terminal residues
            newpdb = pdb_path + ".term.gro"
            #fix_gro("/gpfs/scratch/bsc19/bsc19611/RATG13-RBD/fixGro.sh", pdb_path, newpdb)
            fix_term(pdb_path, newpdb)

            # Fixing terminal residues
            #newpdb2 = pdb_path + ".term.gro"
            #cmd2 = "sed 's/600ASN /600NASN/g' " + pdb_path + "| sed 's/    1SER   /    1NSER  /g' | sed 's/597ASP /597CASP/g' | sed 's/793PRO /793CPRO/g' > " + newpdb2
            #subprocess.call(cmd2, shell=True)

            paths['step1_pmx_mutate']['input_structure_path'] = newpdb

            # step1_pmx_mutate
            global_log.info(ensemble + " " + pdb_name +
                            " Step 1: pmx mutate: Generate Hybrid Structure")
            prop['step1_pmx_mutate']['mutation_list'] = mutation
            mutate_pc(**paths["step1_pmx_mutate"],
                      properties=prop["step1_pmx_mutate"])

            # step1.1_check_dummies
            global_log.info(ensemble + " " + pdb_name +
                            " Step 1.1 Check for dummy atoms")
            extract_atoms_pc(**paths['step1.1_check_dummies'],
                             properties=prop['step1.1_check_dummies'])
            #compss_wait_on_file(paths['step1.1_check_dummies']['output_structure_path'])
            #try:
            #    dummy = bool(os.path.getsize(paths['step1.1_check_dummies']['output_structure_path']))
            #except:
            #    global_log.info("Error ocurred while checking the file containing dummy atoms")
            #    global_log.info(sys.exc_info()[0])

            # step1.2_remove_ligand
            #global_log.info(ensemble + " " + pdb_name + " Step 1.2 Remove ligand")
            #remove_ligand_pc(**paths['step1.2_remove_ligand'], properties=prop['step1.2_remove_ligand'])

            # step2_gmx_pdb2gmx
            global_log.info(ensemble + " " + pdb_name +
                            " Step 2: gmx pdb2gmx: Generate Topology")
            pdb2gmx_pc(**paths["step2_gmx_pdb2gmx"],
                       properties=prop["step2_gmx_pdb2gmx"])

            # step2.1_sort_gro
            #global_log.info(ensemble + " " + pdb_name + " Step 2.1 Sort gro residues")
            #sort_gro_residues_pc(**paths['step2.1_sort_gro'], properties=prop['step2.1_sort_gro'])

            # step2.2_lig_gmx_appendLigand
            #global_log.info(ensemble + " " + pdb_name +" Step 2.2_lig: gmx appendLigand: Append a ligand to a GROMACS topology")
            #append_ligand_pc(**paths["step2.2_lig_gmx_appendLigand"], properties=prop["step2.2_lig_gmx_appendLigand"])

            # step3_pmx_gentop
            global_log.info(ensemble + " " + pdb_name +
                            " Step 3: pmx gentop: Generate Hybrid Topology")
            gentop_pc(**paths["step3_pmx_gentop"],
                      properties=prop["step3_pmx_gentop"])

            # step4_gmx_makendx, step5_gmx_grompp, step6_gmx_mdrun
            #global_log.info(ensemble + " " + pdb_name +" Check structure and Step 4-6 (Dummies): gmx make_ndx: Generate Gromacs Index file to select atoms to freeze, gmx grompp: Creating portable binary run file for energy minimization, gmx mdrun: Running energy minimization")
            #check_structure_and_run_ndx_pc(ensemble, **paths["step4_gmx_makendx"], properties_makendx=prop["step4_gmx_makendx"], **paths["step5_gmx_grompp"], properties_grompp=prop["step5_gmx_grompp"], **paths["step6_gmx_mdrun"], properties_mdrun=prop["step6_gmx_mdrun"])

            # step4_gmx_makendx, step5_gmx_grompp, step6_gmx_mdrun
            global_log.info(
                ensemble + " " + pdb_name +
                " Step 4-6 (Check structure and ndx): gmx make_ndx: Generate Gromacs Index file to select atoms to freeze, gmx grompp: Creating portable binary run file for energy minimization, gmx mdrun: Running energy minimization"
            )
            fu.create_dir(prop["step4_gmx_makendx"]['working_dir_path'] + "/" +
                          ensemble + "/" + pdb_name + "/step4_gmx_makendx")
            fu.create_dir(prop["step5_gmx_grompp"]['working_dir_path'] + "/" +
                          ensemble + "/" + pdb_name + "/step5_gmx_grompp")
            fu.create_dir(prop["step6_gmx_mdrun"]['working_dir_path'] + "/" +
                          ensemble + "/" + pdb_name + "/step6_gmx_mdrun")
            check_structure_and_run_ndx_pc(
                ensemble,
                output_structure_path=paths['step1.1_check_dummies']
                ['output_structure_path'],
                **paths["step4_gmx_makendx"],
                properties_makendx=prop["step4_gmx_makendx"],
                **paths["step5_gmx_grompp"],
                properties_grompp=prop["step5_gmx_grompp"],
                **paths["step6_gmx_mdrun"],
                properties_mdrun=prop["step6_gmx_mdrun"])

            # step7_gmx_grompp
            global_log.info(
                ensemble + " " + pdb_name +
                " Step 7: gmx grompp: Creating portable binary run file for system equilibration"
            )
            grompp_pc(**paths["step7_gmx_grompp"],
                      properties=prop["step7_gmx_grompp"])

            # step8_gmx_mdrun
            global_log.info(ensemble + " " + pdb_name +
                            " Step 8: gmx mdrun: Running system equilibration")
            mdrun_pc(**paths["step8_gmx_mdrun"],
                     properties=prop["step8_gmx_mdrun"])

            # step9_gmx_grompp
            global_log.info(
                ensemble + " " + pdb_name +
                " Step 9: Creating portable binary run file for thermodynamic integration (ti)"
            )
            grompp_pc(**paths["step9_gmx_grompp"],
                      properties=prop["step9_gmx_grompp"])

            # step10_gmx_mdrun
            global_log.info(
                ensemble + " " + pdb_name +
                " Step 10: gmx mdrun: Running thermodynamic integration")
            mdrun_dhdl_pc(**paths["step10_gmx_mdrun"],
                          properties=prop["step10_gmx_mdrun"])

            if ensemble == "stateA":
                dhdl_paths_listA.append(
                    paths["step10_gmx_mdrun"]["output_dhdl_path"])
            elif ensemble == "stateB":
                dhdl_paths_listB.append(
                    paths["step10_gmx_mdrun"]["output_dhdl_path"])

    # Creating zip file containing all the dhdl files
    dhdlA_path = os.path.join(
        global_prop["step11_pmx_analyse"]['working_dir_path'], 'dhdlA.zip')
    dhdlB_path = os.path.join(
        global_prop["step11_pmx_analyse"]['working_dir_path'], 'dhdlB.zip')
    for dhdl_file in dhdl_paths_listA:
        compss_wait_on_file(dhdl_file)
    for dhdl_file in dhdl_paths_listB:
        compss_wait_on_file(dhdl_file)
    fu.zip_list(dhdlA_path, dhdl_paths_listA)
    fu.zip_list(dhdlB_path, dhdl_paths_listB)

    # step11_pmx_analyse
    global_log.info(
        ensemble +
        " Step 11: pmx analyse: Calculate free energies from fast growth thermodynamic integration simulations"
    )
    global_paths["step11_pmx_analyse"]["input_a_xvg_zip_path"] = dhdlA_path
    global_paths["step11_pmx_analyse"]["input_b_xvg_zip_path"] = dhdlB_path
    analyse_pc(**global_paths["step11_pmx_analyse"],
               properties=global_prop["step11_pmx_analyse"])

    elapsed_time = time.time() - start_time
    global_log.info('')
    global_log.info('')
    global_log.info('Execution successful: ')
    global_log.info('  Workflow_path: %s' % conf.get_working_dir_path())
    global_log.info('  Config File: %s' % config)
    if system:
        global_log.info('  System: %s' % system)
    global_log.info('')
    global_log.info('Elapsed time: %.1f minutes' % (elapsed_time / 60))
    global_log.info('')
Example #4
0
def main(config, system=None):
    from pycompss.api.api import compss_barrier
    start_time = time.time()
    conf = settings.ConfReader(config, system)
    global_log, _ = fu.get_logs(path=conf.get_working_dir_path(),
                                light_format=True)
    global_prop = conf.get_prop_dic(global_log=global_log)
    global_paths = conf.get_paths_dic()

    initial_structure = conf.properties.get('initial_structure')
    if initial_structure:
        global_paths["step2_fixsidechain"][
            'input_pdb_path'] = initial_structure
    else:
        global_log.info("step1_mmbpdb: Dowload the initial Structure")
        pdb_pc(**global_paths["step1_mmbpdb"],
               properties=global_prop["step1_mmbpdb"])

    global_log.info(
        "step2_fixsidechain: Modeling the missing heavy atoms in the structure side chains"
    )
    fix_side_chain_pc(**global_paths["step2_fixsidechain"],
                      properties=global_prop["step2_fixsidechain"])

    for mutation_number, mutation in enumerate(conf.properties['mutations']):
        global_log.info('')
        global_log.info(
            "Mutation: %s  %d/%d" %
            (mutation, mutation_number + 1, len(conf.properties['mutations'])))
        global_log.info('')
        prop = conf.get_prop_dic(prefix=mutation, global_log=global_log)
        paths = conf.get_paths_dic(prefix=mutation)

        global_log.info("step3_mutate Modeling mutation")
        prop['step3_mutate']['mutation_list'] = mutation
        paths['step3_mutate']['input_pdb_path'] = global_paths[
            'step2_fixsidechain']['output_pdb_path']
        mutate_pc(**paths["step3_mutate"], properties=prop["step3_mutate"])

        global_log.info("step4_pdb2gmx: Generate the topology")
        pdb2gmx_pc(**paths["step4_pdb2gmx"], properties=prop["step4_pdb2gmx"])

        global_log.info("step5_editconf: Create the solvent box")
        editconf_pc(**paths["step5_editconf"],
                    properties=prop["step5_editconf"])

        global_log.info(
            "step6_solvate: Fill the solvent box with water molecules")
        solvate_pc(**paths["step6_solvate"], properties=prop["step6_solvate"])

        global_log.info("step7_grompp_genion: Preprocess ion generation")
        grompp_pc(**paths["step7_grompp_genion"],
                  properties=prop["step7_grompp_genion"])

        global_log.info("step8_genion: Ion generation")
        genion_pc(**paths["step8_genion"], properties=prop["step8_genion"])

        global_log.info("step9_grompp_min: Preprocess energy minimization")
        grompp_pc(**paths["step9_grompp_min"],
                  properties=prop["step9_grompp_min"])

        pa = paths["step10_mdrun_min"]
        global_log.info("step10_mdrun_min: Execute energy minimization")
        mdrun_pc(input_tpr_path=pa["input_tpr_path"],
                 output_gro_path=pa["output_gro_path"],
                 output_xtc_path=pa["output_xtc_path"],
                 output_trr_path=pa["output_trr_path"],
                 output_edr_path=pa["output_edr_path"],
                 output_log_path=pa["output_log_path"])

        global_log.info(
            "step11_grompp_nvt: Preprocess system temperature equilibration")
        grompp_pc(**paths["step11_grompp_nvt"],
                  properties=prop["step11_grompp_nvt"])

        pa = paths["step12_mdrun_nvt"]
        global_log.info(
            "step12_mdrun_nvt: Execute system temperature equilibration")
        mdrun_pc_cpt(input_tpr_path=pa["input_tpr_path"],
                     output_gro_path=pa["output_gro_path"],
                     output_cpt_path=pa["output_cpt_path"],
                     output_xtc_path=pa["output_xtc_path"],
                     output_trr_path=pa["output_trr_path"],
                     output_edr_path=pa["output_edr_path"],
                     output_log_path=pa["output_log_path"])

        global_log.info(
            "step13_grompp_npt: Preprocess system pressure equilibration")
        grompp_cpt_pc(**paths["step13_grompp_npt"],
                      properties=prop["step13_grompp_npt"])

        pa = paths["step14_mdrun_npt"]
        global_log.info(
            "step14_mdrun_npt: Execute system pressure equilibration")
        mdrun_pc_cpt(input_tpr_path=pa["input_tpr_path"],
                     output_gro_path=pa["output_gro_path"],
                     output_cpt_path=pa["output_cpt_path"],
                     output_xtc_path=pa["output_xtc_path"],
                     output_trr_path=pa["output_trr_path"],
                     output_edr_path=pa["output_edr_path"],
                     output_log_path=pa["output_log_path"])

        global_log.info("step15_grompp_md: Preprocess free dynamics")
        grompp_cpt_pc(**paths["step15_grompp_md"],
                      properties=prop["step15_grompp_md"])

        pa = paths["step16_mdrun_md"]
        global_log.info(
            "step16_mdrun_md: Execute free molecular dynamics simulation")
        mdrun_pc_cpt(input_tpr_path=pa["input_tpr_path"],
                     output_gro_path=pa["output_gro_path"],
                     output_cpt_path=pa["output_cpt_path"],
                     output_xtc_path=pa["output_xtc_path"],
                     output_trr_path=pa["output_trr_path"],
                     output_edr_path=pa["output_edr_path"],
                     output_log_path=pa["output_log_path"])

    compss_barrier()
    elapsed_time = time.time() - start_time
    global_log.info('')
    global_log.info('')
    global_log.info('Execution sucessful: ')
    global_log.info('  Workflow_path: %s' % conf.get_working_dir_path())
    global_log.info('  Config File: %s' % config)
    if system:
        global_log.info('  System: %s' % system)
    global_log.info('')
    global_log.info('Elapsed time: %.1f minutes' % (elapsed_time / 60))
    global_log.info('')
Example #5
0
def main(config, system=None):
    start_time = time.time()
    conf = settings.ConfReader(config, system)
    global_log, _ = fu.get_logs(path=conf.get_working_dir_path(),
                                light_format=True)
    global_prop = conf.get_prop_dic(global_log=global_log)
    global_paths = conf.get_paths_dic()

    dhdl_paths_listA = []
    dhdl_paths_listB = []
    for ensemble, mutation in conf.properties['mutations'].items():
        ensemble_prop = conf.get_prop_dic(prefix=ensemble,
                                          global_log=global_log)
        ensemble_paths = conf.get_paths_dic(prefix=ensemble)

        #Create and launch bb
        global_log.info(
            ensemble +
            " Step 0: gmx trjconv: Extract snapshots from equilibrium trajectories"
        )
        ensemble_paths['step0_trjconv']['input_traj_path'] = conf.properties[
            'input_trajs'][ensemble]['input_traj_path']
        ensemble_paths['step0_trjconv']['input_top_path'] = conf.properties[
            'input_trajs'][ensemble]['input_tpr_path']
        GMXTrjConvStrEns(**ensemble_paths["step0_trjconv"],
                         properties=ensemble_prop["step0_trjconv"]).launch()

        with zipfile.ZipFile(
                ensemble_paths["step0_trjconv"]["output_str_ens_path"],
                'r') as zip_f:
            zip_f.extractall()
            state_pdb_list = zip_f.namelist()

        for pdb_path in state_pdb_list:
            pdb_name = os.path.splitext(pdb_path)[0]
            prop = conf.get_prop_dic(prefix=os.path.join(ensemble, pdb_name),
                                     global_log=global_log)
            paths = conf.get_paths_dic(prefix=os.path.join(ensemble, pdb_name))

            #Create and launch bb
            global_log.info("Step 1: pmx mutate: Generate Hybrid Structure")
            paths['step1_pmx_mutate']['input_structure_path'] = pdb_path
            prop['step1_pmx_mutate']['mutation_list'] = mutation
            Mutate(**paths["step1_pmx_mutate"],
                   properties=prop["step1_pmx_mutate"]).launch()

            # Step 2: gmx pdb2gmx: Generate Topology
            # From pmx tutorial:
            # gmx pdb2gmx -f mut.pdb -ff amber99sb-star-ildn-mut -water tip3p -o pdb2gmx.pdb
            global_log.info("Step 2: gmx pdb2gmx: Generate Topology")
            Pdb2gmx(**paths["step2_gmx_pdb2gmx"],
                    properties=prop["step2_gmx_pdb2gmx"]).launch()

            # Step 3: pmx gentop: Generate Hybrid Topology
            # From pmx tutorial:
            # python generate_hybrid_topology.py -itp topol_Protein.itp -o topol_Protein.itp -ff amber99sb-star-ildn-mut
            global_log.info("Step 3: pmx gentop: Generate Hybrid Topology")
            Gentop(**paths["step3_pmx_gentop"],
                   properties=prop["step3_pmx_gentop"]).launch()

            # Step 4: gmx make_ndx: Generate Gromacs Index File to select atoms to freeze
            # From pmx tutorial:
            # echo -e "a D*\n0 & ! 19\nname 20 FREEZE\nq\n" | gmx make_ndx -f frame0/pdb2gmx.pdb -o index.ndx
            global_log.info(
                "Step 4: gmx make_ndx: Generate Gromacs Index file to select atoms to freeze"
            )
            MakeNdx(**paths["step4_gmx_makendx"],
                    properties=prop["step4_gmx_makendx"]).launch()

            if ensemble == 'stateA':
                # In stateA, with lamdda=0, we don't need the energy minimization step, so simply get the output
                # from the step2 (pdb2gmx) as output from the step6 (energy minimization)
                # From pmx tutorial:
                # There are no dummies in this state at lambda=0, therefore simply convert mut.pdb to emout.gro
                paths['step7_gmx_grompp']['input_gro_path'] = paths[
                    'step2_gmx_pdb2gmx']['output_gro_path']

            elif ensemble == 'stateB':
                # Step 5: gmx grompp: Creating portable binary run file for energy minimization
                # From pmx tutorial:
                # gmx grompp -c pdb2gmx.pdb -p topol.top -f ../../mdp/em_FREEZE.mdp -o em.tpr -n ../index.ndx
                global_log.info(
                    "Step 5: gmx grompp: Creating portable binary run file for energy minimization"
                )
                Grompp(**paths["step5_gmx_grompp"],
                       properties=prop["step5_gmx_grompp"]).launch()

                # Step 6: gmx mdrun: Running energy minimization
                # From pmx tutorial:
                # gmx mdrun -s em.tpr -c emout.gro -v
                global_log.info(
                    ensemble +
                    " Step 6: gmx mdrun: Running energy minimization")
                Mdrun(**paths["step6_gmx_mdrun"],
                      properties=prop["step6_gmx_mdrun"]).launch()

            # Step 7: gmx grompp: Creating portable binary run file for system equilibration
            # From pmx tutorial:
            # gmx grompp -c emout.gro -p topol.top -f ../../mdp/eq_20ps.mdp -o eq_20ps.tpr -maxwarn 1
            global_log.info(
                ensemble +
                " Step 7: gmx grompp: Creating portable binary run file for system equilibration"
            )
            Grompp(**paths["step7_gmx_grompp"],
                   properties=prop["step7_gmx_grompp"]).launch()

            # Step 8: gmx mdrun: Running system equilibration
            # From pmx tutorial:
            # gmx mdrun -s eq_20ps.tpr -c eqout.gro -v
            global_log.info(ensemble +
                            " Step 8: gmx mdrun: Running system equilibration")
            Mdrun(**paths["step8_gmx_mdrun"],
                  properties=prop["step8_gmx_mdrun"]).launch()

            # Step 9: gmx grompp: Creating portable binary run file for thermodynamic integration (ti)
            # From pmx tutorial:
            # gmx grompp -c eqout.gro -p topol.top -f ../../mdp/ti.mdp -o ti.tpr -maxwarn 1
            global_log.info(
                ensemble +
                " Step 9: Creating portable binary run file for thermodynamic integration (ti)"
            )
            Grompp(**paths["step9_gmx_grompp"],
                   properties=prop["step9_gmx_grompp"]).launch()

            # Step 10: gmx mdrun: Running thermodynamic integration
            # From pmx tutorial:
            # gmx mdrun -s ti.tpr -c eqout.gro -v
            global_log.info(
                ensemble +
                " Step 10: gmx mdrun: Running thermodynamic integration")
            Mdrun(**paths["step10_gmx_mdrun"],
                  properties=prop["step10_gmx_mdrun"]).launch()
            if ensemble == "stateA":
                dhdl_paths_listA.append(
                    paths["step10_gmx_mdrun"]["output_dhdl_path"])
            elif ensemble == "stateB":
                dhdl_paths_listB.append(
                    paths["step10_gmx_mdrun"]["output_dhdl_path"])

    #Creating zip file containing all the dhdl files
    dhdlA_path = 'dhdlA.zip'
    dhdlB_path = 'dhdlB.zip'
    fu.zip_list(dhdlA_path, dhdl_paths_listA)
    fu.zip_list(dhdlB_path, dhdl_paths_listB)

    # Step 11: pmx analyse: Calculate free energies from fast growth thermodynamic integration simulations
    # From pmx tutorial:
    # python analyze_dhdl.py -fA ../stateA/frame*/dhdl*.xvg -fB ../stateB/frame*/dhdl*.xvg --nbins 25 -t 293 --reverseB
    global_log.info(
        ensemble +
        " Step 11: pmx analyse: Calculate free energies from fast growth thermodynamic integration simulations"
    )
    global_paths["step11_pmx_analyse"]["input_A_xvg_zip_path"] = dhdlA_path
    global_paths["step11_pmx_analyse"]["input_B_xvg_zip_path"] = dhdlB_path
    Analyse(**global_paths["step11_pmx_analyse"],
            properties=global_prop["step11_pmx_analyse"]).launch()

    elapsed_time = time.time() - start_time
    global_log.info('')
    global_log.info('')
    global_log.info('Execution successful: ')
    global_log.info('  Workflow_path: %s' % conf.get_working_dir_path())
    global_log.info('  Config File: %s' % config)
    if system:
        global_log.info('  System: %s' % system)
    global_log.info('')
    global_log.info('Elapsed time: %.1f minutes' % (elapsed_time / 60))
    global_log.info('')
def main(config, system=None):
    start_time = time.time()
    conf = settings.ConfReader(config, system)
    global_log, _ = fu.get_logs(path=conf.get_working_dir_path(),
                                light_format=True)
    global_prop = conf.get_prop_dic()
    global_paths = conf.get_paths_dic()

    mutations = []
    for mut_set in conf.properties['mutations'].split('+'):
        mutations.append([mut_set])

    #for mutation_list in conf.properties['mutations']:
    for mutation_list in mutations:

        if "WT" in mutation_list:

            mut_prop = conf.get_prop_dic(prefix="WT")
            mut_paths = conf.get_paths_dic(prefix="WT")

            mutpdb = conf.properties['input_pdb']

        else:

            # Converting list to String
            sep = ","
            str_mut_list = sep.join(mutation_list)

            # Updated cumulative list of mutations
            global_log.info("Mutation list: " + str_mut_list)

            mutation_code = str_mut_list.replace(":", "_").replace(",", "-")

            mut_prop = conf.get_prop_dic(prefix=mutation_code)
            mut_paths = conf.get_paths_dic(prefix=mutation_code)

            mut_paths['step1_mutate']['input_pdb_path'] = conf.properties[
                'input_pdb']
            mut_prop['step1_mutate']['mutation_list'] = str_mut_list

            global_log.info(
                "step1_mutate: Modeling a particular residue mutation")
            mutate_pc(**mut_paths["step1_mutate"],
                      properties=mut_prop["step1_mutate"])
            compss_wait_on_file(mut_paths["step1_mutate"]["output_pdb_path"])

            mutpdb = mut_paths['step1_mutate']['output_pdb_path']

        # Fixing Histidine residues to HIE
        # Must be done after mutation because biopython does not understand HIE/D/P residues

        #pdbhie = mut_paths['step1_mutate']['output_pdb_path'] + ".hie.pdb"
        pdbhie = mutpdb + ".hie.pdb"

        cmd = "sed 's/HIS/HIE/g' " + mutpdb + " > " + pdbhie
        subprocess.call(cmd, shell=True)

        mut_paths['step2_pdb2gmx']['input_pdb_path'] = pdbhie

        global_log.info("step2_pdb2gmx: Generate the topology")
        pdb2gmx_pc(**mut_paths["step2_pdb2gmx"],
                   properties=mut_prop["step2_pdb2gmx"])

        global_log.info("step3_editconf: Create the solvent box")
        editconf_pc(**mut_paths["step3_editconf"],
                    properties=mut_prop["step3_editconf"])

        global_log.info(
            "step4_solvate: Fill the solvent box with water molecules")
        solvate_pc(**mut_paths["step4_solvate"],
                   properties=mut_prop["step4_solvate"])

        global_log.info("step5_grompp_genion: Preprocess ion generation")
        grompp_pc(**mut_paths["step5_grompp_genion"],
                  properties=mut_prop["step5_grompp_genion"])

        global_log.info("step6_genion: Ion generation")
        genion_pc(**mut_paths["step6_genion"],
                  properties=mut_prop["step6_genion"])

        global_log.info("step7_grompp_min: Preprocess energy minimization")
        grompp_pc(**mut_paths["step7_grompp_min"],
                  properties=mut_prop["step7_grompp_min"])

        global_log.info("step8_mdrun_min: Execute energy minimization")
        mdrun_pc(**mut_paths["step8_mdrun_min"],
                 properties=mut_prop["step8_mdrun_min"])

        global_log.info(
            "step9_grompp_nvt: Preprocess system temperature equilibration")
        grompp_pc(**mut_paths["step9_grompp_nvt"],
                  properties=mut_prop["step9_grompp_nvt"])

        global_log.info(
            "step10_mdrun_nvt: Execute system temperature equilibration")
        mdrun_pc(**mut_paths["step10_mdrun_nvt"],
                 properties=mut_prop["step10_mdrun_nvt"])

        global_log.info(
            "step11_grompp_npt: Preprocess system pressure equilibration")
        grompp_pc(**mut_paths["step11_grompp_npt"],
                  properties=mut_prop["step11_grompp_npt"])

        global_log.info(
            "step12_mdrun_npt: Execute system pressure equilibration")
        mdrun_pc(**mut_paths["step12_mdrun_npt"],
                 properties=mut_prop["step12_mdrun_npt"])

        global_log.info("step13_grompp_md: Preprocess free dynamics")
        grompp_pc(**mut_paths["step13_grompp_md"],
                  properties=mut_prop["step13_grompp_md"])

        global_log.info(
            "step14_mdrun_md: Execute free molecular dynamics simulation")
        mdrun_pc(**mut_paths["step14_mdrun_md"],
                 properties=mut_prop["step14_mdrun_md"])

    elapsed_time = time.time() - start_time
    global_log.info('')
    global_log.info('')
    global_log.info('Execution successful: ')
    global_log.info('  Workflow_path: %s' % conf.get_working_dir_path())
    global_log.info('  Config File: %s' % config)
    if system:
        global_log.info('  System: %s' % system)
    global_log.info('')
    global_log.info('Elapsed time: %.1f minutes' % (elapsed_time / 60))
    global_log.info('')
Example #7
0
def main(config, system=None):
    start_time = time.time()
    conf = settings.ConfReader(config, system)
    global_log, _ = fu.get_logs(path=conf.get_working_dir_path(),
                                light_format=True)
    global_prop = conf.get_prop_dic()
    global_paths = conf.get_paths_dic()

    dhdl_paths_listA = []
    dhdl_paths_listB = []
    for ensemble, mutation in conf.properties['mutations'].items():

        ensemble_prop = conf.get_prop_dic(prefix=ensemble)
        ensemble_paths = conf.get_paths_dic(prefix=ensemble)

        # step0_image
        global_log.info(
            ensemble +
            " Step 0: gmx image: Imaging trajectories to remove PBC issues")
        ensemble_paths['step0_image']['input_traj_path'] = conf.properties[
            'input_trajs'][ensemble]['input_traj_path']
        ensemble_paths['step0_image']['input_top_path'] = conf.properties[
            'input_trajs'][ensemble]['input_tpr_path']
        gmx_image_pc(**ensemble_paths["step0_image"],
                     properties=ensemble_prop["step0_image"])

        # step0.1_trjconv
        global_log.info(
            ensemble +
            " Step 0: gmx trjconv: Extract snapshots from equilibrium trajectories"
        )
        ensemble_paths['step0.1_trjconv']['input_top_path'] = conf.properties[
            'input_trajs'][ensemble]['input_tpr_path']
        gmx_trjconv_str_ens_pc(**ensemble_paths["step0.1_trjconv"],
                               properties=ensemble_prop["step0.1_trjconv"])

    for ensemble, mutation in conf.properties['mutations'].items():
        ensemble_prop = conf.get_prop_dic(prefix=ensemble)
        ensemble_paths = conf.get_paths_dic(prefix=ensemble)
        compss_wait_on_file(
            ensemble_paths["step0.1_trjconv"]["output_str_ens_path"])

        with zipfile.ZipFile(ensemble_paths["step0.1_trjconv"]
                             ["output_str_ens_path"]) as zip_f:
            unique_dir = os.path.abspath(
                fu.create_unique_dir(prefix=ensemble_prop["step0.1_trjconv"]
                                     ['working_dir_path'] + '/' + ensemble +
                                     '/'))
            zip_f.extractall(unique_dir)
            state_pdb_list = [
                os.path.join(unique_dir, name) for name in zip_f.namelist()
            ]

        for pdb_path in state_pdb_list:
            pdb_name = os.path.splitext(os.path.basename(pdb_path))[0]
            prop = conf.get_prop_dic(prefix=os.path.join(ensemble, pdb_name))
            paths = conf.get_paths_dic(prefix=os.path.join(ensemble, pdb_name))

            # step1_pmx_mutate
            global_log.info(ensemble + " " + pdb_name +
                            " Step 1: pmx mutate: Generate Hybrid Structure")
            paths['step1_pmx_mutate']['input_structure_path'] = pdb_path
            prop['step1_pmx_mutate']['mutation_list'] = mutation
            mutate_pc(**paths["step1_pmx_mutate"],
                      properties=prop["step1_pmx_mutate"])

            if ensemble == 'stateA':
                mut = "L2R"
            elif ensemble == 'stateB':
                mut = "R2L"

            # step1.1_check_dummies
            global_log.info(ensemble + " " + pdb_name +
                            " Step 1.1 Check for dummy atoms")
            extract_atoms_pc(**paths['step1.1_check_dummies'],
                             properties=prop['step1.1_check_dummies'])
            compss_wait_on_file(
                paths['step1.1_check_dummies']['output_structure_path'])
            dummy = bool(
                os.path.getsize(
                    paths['step1.1_check_dummies']['output_structure_path']))

            # step1.2_remove_ligand
            global_log.info(ensemble + " " + pdb_name +
                            " Step 1.2 Remove ligand")
            remove_ligand_pc(**paths['step1.2_remove_ligand'],
                             properties=prop['step1.2_remove_ligand'])

            # step2_gmx_pdb2gmx
            global_log.info(ensemble + " " + pdb_name +
                            " Step 2: gmx pdb2gmx: Generate Topology")
            pdb2gmx_pc(**paths["step2_gmx_pdb2gmx"],
                       properties=prop["step2_gmx_pdb2gmx"])

            # step2.1_sort_gro
            global_log.info(ensemble + " " + pdb_name +
                            " Step 2.1 Sort gro residues")
            sort_gro_residues_pc(**paths['step2.1_sort_gro'],
                                 properties=prop['step2.1_sort_gro'])

            # step2.2_lig_gmx_appendLigand
            global_log.info(
                ensemble + " " + pdb_name +
                " Step 2.2_lig: gmx appendLigand: Append a ligand to a GROMACS topology"
            )
            append_ligand_pc(**paths["step2.2_lig_gmx_appendLigand"],
                             properties=prop["step2.2_lig_gmx_appendLigand"])

            # step3_pmx_gentop
            global_log.info(ensemble + " " + pdb_name +
                            " Step 3: pmx gentop: Generate Hybrid Topology")
            gentop_pc(**paths["step3_pmx_gentop"],
                      properties=prop["step3_pmx_gentop"])

            if not dummy:
                paths['step7_gmx_grompp']['input_gro_path'] = paths[
                    'step2.1_sort_gro']['output_gro_path']
            else:
                # step4_gmx_makendx
                global_log.info(
                    ensemble + " " + pdb_name +
                    " Step 4 (Dummies): gmx make_ndx: Generate Gromacs Index file to select atoms to freeze"
                )
                make_ndx_pc(**paths["step4_gmx_makendx"],
                            properties=prop["step4_gmx_makendx"])

                # step5_gmx_grompp
                global_log.info(
                    ensemble + " " + pdb_name +
                    " Step 5 (Dummies): gmx grompp: Creating portable binary run file for energy minimization"
                )
                grompp_ndx_pc(**paths["step5_gmx_grompp"],
                              properties=prop["step5_gmx_grompp"])

                # step6_gmx_mdrun
                global_log.info(
                    ensemble + " " + pdb_name +
                    " Step 6 (Dummies): gmx mdrun: Running energy minimization"
                )
                mdrun_pc(**paths["step6_gmx_mdrun"],
                         properties=prop["step6_gmx_mdrun"])

            # step7_gmx_grompp
            global_log.info(
                ensemble + " " + pdb_name +
                " Step 7: gmx grompp: Creating portable binary run file for system equilibration"
            )
            grompp_pc(**paths["step7_gmx_grompp"],
                      properties=prop["step7_gmx_grompp"])

            # step8_gmx_mdrun
            global_log.info(ensemble + " " + pdb_name +
                            " Step 8: gmx mdrun: Running system equilibration")
            mdrun_pc(**paths["step8_gmx_mdrun"],
                     properties=prop["step8_gmx_mdrun"])

            # step9_gmx_grompp
            global_log.info(
                ensemble + " " + pdb_name +
                " Step 9: Creating portable binary run file for thermodynamic integration (ti)"
            )
            grompp_pc(**paths["step9_gmx_grompp"],
                      properties=prop["step9_gmx_grompp"])

            # step10_gmx_mdrun
            global_log.info(
                ensemble + " " + pdb_name +
                " Step 10: gmx mdrun: Running thermodynamic integration")
            mdrun_dhdl_pc(**paths["step10_gmx_mdrun"],
                          properties=prop["step10_gmx_mdrun"])

            if ensemble == "stateA":
                dhdl_paths_listA.append(
                    paths["step10_gmx_mdrun"]["output_dhdl_path"])
            elif ensemble == "stateB":
                dhdl_paths_listB.append(
                    paths["step10_gmx_mdrun"]["output_dhdl_path"])

    # Creating zip file containing all the dhdl files
    dhdlA_path = 'dhdlA.zip'
    dhdlB_path = 'dhdlB.zip'
    # for dhdl_file in dhdl_paths_listA:
    #     compss_wait_on_file(dhdl_file)
    # for dhdl_file in dhdl_paths_listB:
    #     compss_wait_on_file(dhdl_file)
    # fu.zip_list(dhdlA_path, dhdl_paths_listA)
    # fu.zip_list(dhdlB_path, dhdl_paths_listB)
    zip_files_pc(dhdl_paths_listA, dhdlA_path)
    zip_files_pc(dhdl_paths_listB, dhdlB_path)

    # step11_pmx_analyse
    global_log.info(
        ensemble +
        " Step 11: pmx analyse: Calculate free energies from fast growth thermodynamic integration simulations"
    )
    global_paths["step11_pmx_analyse"]["input_a_xvg_zip_path"] = dhdlA_path
    global_paths["step11_pmx_analyse"]["input_b_xvg_zip_path"] = dhdlB_path
    analyse_pc(**global_paths["step11_pmx_analyse"],
               properties=global_prop["step11_pmx_analyse"])

    elapsed_time = time.time() - start_time
    global_log.info('')
    global_log.info('')
    global_log.info('Execution successful: ')
    global_log.info('  Workflow_path: %s' % conf.get_working_dir_path())
    global_log.info('  Config File: %s' % config)
    if system:
        global_log.info('  System: %s' % system)
    global_log.info('')
    global_log.info('Elapsed time: %.1f minutes' % (elapsed_time / 60))
    global_log.info('')
Example #8
0
def main(config, system=None):
    start_time = time.time()
    conf = settings.ConfReader(config, system)
    global_log, _ = fu.get_logs(path=conf.get_working_dir_path(),
                                light_format=True)
    global_prop = conf.get_prop_dic()
    global_paths = conf.get_paths_dic()

    for structure in conf.properties['input_structures'].split(','):

        prefix_str = os.path.basename(structure)
        prefix_str = prefix_str.replace('.', '_')

        mut_prop = conf.get_prop_dic(prefix=prefix_str)
        mut_paths = conf.get_paths_dic(prefix=prefix_str)

        global_log.info("Starting setup process for PDB: " + prefix_str)
        mut_paths['step1_pdb2gmx']['input_pdb_path'] = structure

        global_log.info("step1_pdb2gmx: Generate the topology")
        pdb2gmx_pc(**mut_paths["step1_pdb2gmx"],
                   properties=mut_prop["step1_pdb2gmx"])

        global_log.info("step2_editconf: Create the solvent box")
        editconf_pc(**mut_paths["step2_editconf"],
                    properties=mut_prop["step2_editconf"])

        global_log.info(
            "step3_solvate: Fill the solvent box with water molecules")
        solvate_pc(**mut_paths["step3_solvate"],
                   properties=mut_prop["step3_solvate"])

        global_log.info("step4_grompp_genion: Preprocess ion generation")
        grompp_pc(**mut_paths["step4_grompp_genion"],
                  properties=mut_prop["step4_grompp_genion"])

        global_log.info("step5_genion: Ion generation")
        genion_pc(**mut_paths["step5_genion"],
                  properties=mut_prop["step5_genion"])

        global_log.info("step6_grompp_min: Preprocess energy minimization")
        grompp_pc(**mut_paths["step6_grompp_min"],
                  properties=mut_prop["step6_grompp_min"])

        global_log.info("step7_mdrun_min: Execute energy minimization")
        mdrun_pc(**mut_paths["step7_mdrun_min"],
                 properties=mut_prop["step7_mdrun_min"])

        global_log.info("step8_make_ndx: Generate GROMACS index file")
        make_ndx_pc(**mut_paths["step8_make_ndx"],
                    properties=mut_prop["step8_make_ndx"])

        global_log.info(
            "step9_grompp_nvt: Preprocess system temperature equilibration")
        grompp_ndx_pc(**mut_paths["step9_grompp_nvt"],
                      properties=mut_prop["step9_grompp_nvt"])

        global_log.info(
            "step10_mdrun_nvt: Execute system temperature equilibration")
        mdrun_pc(**mut_paths["step10_mdrun_nvt"],
                 properties=mut_prop["step10_mdrun_nvt"])

        global_log.info(
            "step11_grompp_npt: Preprocess system pressure equilibration")
        grompp_ndx_pc(**mut_paths["step11_grompp_npt"],
                      properties=mut_prop["step11_grompp_npt"])

        global_log.info(
            "step12_mdrun_npt: Execute system pressure equilibration")
        mdrun_pc(**mut_paths["step12_mdrun_npt"],
                 properties=mut_prop["step12_mdrun_npt"])

        global_log.info("step13_grompp_md: Preprocess free dynamics")
        grompp_ndx_pc(**mut_paths["step13_grompp_md"],
                      properties=mut_prop["step13_grompp_md"])

        global_log.info(
            "step14_mdrun_md: Execute free molecular dynamics simulation")
        mdrun_pc(**mut_paths["step14_mdrun_md"],
                 properties=mut_prop["step14_mdrun_md"])

    elapsed_time = time.time() - start_time
    global_log.info('')
    global_log.info('')
    global_log.info('Execution successful: ')
    global_log.info('  Workflow_path: %s' % conf.get_working_dir_path())
    global_log.info('  Config File: %s' % config)
    if system:
        global_log.info('  System: %s' % system)
    global_log.info('')
    global_log.info('Elapsed time: %.1f minutes' % (elapsed_time / 60))
    global_log.info('')
Example #9
0
def main(config, imaged_traj_available):
    start_time = time.time()
    conf = settings.ConfReader(config)
    global_log, _ = fu.get_logs(path=conf.get_working_dir_path(),
                                light_format=True)
    global_prop = conf.get_prop_dic()
    global_paths = conf.get_paths_dic()

    dhdl_paths_listA = []
    dhdl_paths_listB = []
    for ensemble, mutation in conf.properties['mutations'].items():

        ensemble_prop = conf.get_prop_dic(prefix=ensemble)
        ensemble_paths = conf.get_paths_dic(prefix=ensemble)

        if not imaged_traj_available:
            # step0_image There isn't an imaged trajectory
            global_log.info(
                ensemble +
                " Step 0: gmx image: Imaging trajectories to remove PBC issues"
            )
            ensemble_paths['step0_image']['input_top_path'] = conf.properties[
                'input_trajs'][ensemble]['input_tpr_path']
            ensemble_paths['step0_image']['input_traj_path'] = conf.properties[
                'input_trajs'][ensemble]['input_traj_path']
            gmx_image_pc(**ensemble_paths["step0_image"],
                         properties=ensemble_prop["step0_image"])

        else:
            # An imaged trajectory is available
            ensemble_paths['step1_trjconv_' +
                           ensemble]['input_traj_path'] = conf.properties[
                               'input_trajs'][ensemble]['input_traj_path']

        # step1_trjconv
        global_log.info(
            ensemble +
            " Step 1: gmx trjconv: Extract snapshots from equilibrium trajectories"
        )
        ensemble_paths['step1_trjconv_' +
                       ensemble]['input_top_path'] = conf.properties[
                           'input_trajs'][ensemble]['input_tpr_path']
        gmx_trjconv_str_ens_pc(**ensemble_paths['step1_trjconv_' + ensemble],
                               properties=ensemble_prop['step1_trjconv_' +
                                                        ensemble])

    for ensemble, mutation in conf.properties['mutations'].items():
        ensemble_prop = conf.get_prop_dic(prefix=ensemble)
        ensemble_paths = conf.get_paths_dic(prefix=ensemble)
        compss_wait_on_file(ensemble_paths['step1_trjconv_' +
                                           ensemble]["output_str_ens_path"])

        with zipfile.ZipFile(
                ensemble_paths['step1_trjconv_' +
                               ensemble]["output_str_ens_path"]) as zip_f:
            unique_dir = os.path.abspath(
                fu.create_unique_dir(
                    prefix=ensemble_prop['step1_trjconv_' +
                                         ensemble]['working_dir_path'] + '/' +
                    ensemble + '/'))
            zip_f.extractall(unique_dir)
            state_pdb_list = [
                os.path.join(unique_dir, name) for name in zip_f.namelist()
            ]

        for pdb_path in state_pdb_list:
            pdb_name = os.path.splitext(os.path.basename(pdb_path))[0]
            prop = conf.get_prop_dic(prefix=os.path.join(ensemble, pdb_name))
            paths = conf.get_paths_dic(prefix=os.path.join(ensemble, pdb_name))

            # step2_pmx_mutate
            global_log.info(ensemble + " " + pdb_name +
                            " Step 2: pmx mutate: Generate Hybrid Structure")
            paths['step2_pmx_mutate']['input_structure_path'] = pdb_path
            prop['step2_pmx_mutate']['mutation_list'] = mutation
            mutate_pc(**paths["step2_pmx_mutate"],
                      properties=prop["step2_pmx_mutate"])

            # step3_check_dummies
            global_log.info(ensemble + " " + pdb_name +
                            " Step 3 Check for dummy atoms")
            extract_atoms_pc(**paths['step3_check_dummies'],
                             properties=prop['step3_check_dummies'])
            compss_wait_on_file(
                paths['step3_check_dummies']['output_structure_path'])
            try:
                dummy = bool(
                    os.path.getsize(
                        paths['step3_check_dummies']['output_structure_path']))
            except:
                global_log.info(
                    "Error ocurred while checking the file containing dummy atoms"
                )
                global_log.info(sys.exc_info()[0])

            # step4_gmx_pdb2gmx
            global_log.info(ensemble + " " + pdb_name +
                            " Step 4: gmx pdb2gmx: Generate Topology")
            pdb2gmx_pc(**paths["step4_gmx_pdb2gmx"],
                       properties=prop["step4_gmx_pdb2gmx"])

            # step5_pmx_gentop
            global_log.info(ensemble + " " + pdb_name +
                            " Step 5: pmx gentop: Generate Hybrid Topology")
            gentop_pc(**paths["step5_pmx_gentop"],
                      properties=prop["step5_pmx_gentop"])

            if not dummy:
                paths['step9_gmx_grompp']['input_gro_path'] = paths[
                    'step4_gmx_pdb2gmx']['output_gro_path']
            else:
                # step6_gmx_makendx
                global_log.info(
                    ensemble + " " + pdb_name +
                    " Step 6: (Dummies): gmx make_ndx: Generate Gromacs Index file to select atoms to freeze"
                )
                make_ndx_pc(**paths["step6_gmx_makendx"],
                            properties=prop["step6_gmx_makendx"])

                # step7_gmx_grompp
                global_log.info(
                    ensemble + " " + pdb_name +
                    " Step 7: (Dummies): gmx grompp: Creating portable binary run file for energy minimization"
                )
                grompp_ndx_pc(**paths["step7_gmx_grompp"],
                              properties=prop["step7_gmx_grompp"])

                # step8_gmx_mdrun
                global_log.info(
                    ensemble + " " + pdb_name +
                    " Step 8: (Dummies): gmx mdrun: Running energy minimization"
                )
                mdrun_pc(**paths["step8_gmx_mdrun"],
                         properties=prop["step8_gmx_mdrun"])

            # step9_gmx_grompp
            global_log.info(
                ensemble + " " + pdb_name +
                " Step 9: gmx grompp: Creating portable binary run file for system equilibration"
            )
            grompp_pc(**paths["step9_gmx_grompp"],
                      properties=prop["step9_gmx_grompp"])

            # step10_gmx_mdrun
            global_log.info(
                ensemble + " " + pdb_name +
                " Step 10: gmx mdrun: Running system equilibration")
            mdrun_pc(**paths["step10_gmx_mdrun"],
                     properties=prop["step10_gmx_mdrun"])

            # step11_gmx_grompp
            global_log.info(
                ensemble + " " + pdb_name +
                " Step 11: Creating portable binary run file for thermodynamic integration (ti)"
            )
            grompp_pc(**paths["step11_gmx_grompp"],
                      properties=prop["step11_gmx_grompp"])

            # step12_gmx_mdrun
            global_log.info(
                ensemble + " " + pdb_name +
                " Step 12: gmx mdrun: Running thermodynamic integration")
            mdrun_dhdl_pc(**paths["step12_gmx_mdrun"],
                          properties=prop["step12_gmx_mdrun"])

            if ensemble == "stateA":
                dhdl_paths_listA.append(
                    paths["step12_gmx_mdrun"]["output_dhdl_path"])
            elif ensemble == "stateB":
                dhdl_paths_listB.append(
                    paths["step12_gmx_mdrun"]["output_dhdl_path"])

    # Creating zip file containing all the dhdl files
    dhdlA_path = os.path.join(
        global_prop["step13_pmx_analyse"]['working_dir_path'], 'dhdlA.zip')
    dhdlB_path = os.path.join(
        global_prop["step13_pmx_analyse"]['working_dir_path'], 'dhdlB.zip')
    for dhdl_file in dhdl_paths_listA:
        compss_wait_on_file(dhdl_file)
    for dhdl_file in dhdl_paths_listB:
        compss_wait_on_file(dhdl_file)
    fu.zip_list(dhdlA_path, dhdl_paths_listA)
    fu.zip_list(dhdlB_path, dhdl_paths_listB)

    # step13_pmx_analyse
    global_log.info(
        ensemble +
        " Step 13: pmx analyse: Calculate free energies from fast growth thermodynamic integration simulations"
    )
    global_paths["step13_pmx_analyse"]["input_a_xvg_zip_path"] = dhdlA_path
    global_paths["step13_pmx_analyse"]["input_b_xvg_zip_path"] = dhdlB_path
    analyse_pc(**global_paths["step13_pmx_analyse"],
               properties=global_prop["step13_pmx_analyse"])

    elapsed_time = time.time() - start_time
    global_log.info('')
    global_log.info('')
    global_log.info('Execution successful: ')
    global_log.info('  Workflow_path: %s' % conf.get_working_dir_path())
    global_log.info('  Config File: %s' % config)
    global_log.info('')
    global_log.info('Elapsed time: %.1f minutes' % (elapsed_time / 60))
    global_log.info('')