Пример #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"])
Пример #2
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('')
Пример #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"])

        # 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('')
Пример #4
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('')