Example #1
0
def obtain_jobinfo(xyzfile):
    init_mol = read_geometry_to_mol(xyzfile)
    natoms = init_mol.natoms
    metal_ind = init_mol.findMetal()[0]
    liglist, ligdents, ligcons = ligand_breakdown(init_mol, flag_loose=False, BondedOct=False)
    _, _, _, _, _, _, ax_con, eq_con, _ = ligand_assign(init_mol, liglist,
                                                        ligdents, ligcons)
    job_info = {}
    info_list = ['ax_con', 'eq_con', 'ax_con_sym', 'eq_con_sym', 'catoms', 'natoms', 'metal_ind']
    ax_con = np.squeeze(np.array(ax_con).reshape(2, -1))
    eq_con = np.squeeze(np.array(eq_con).reshape(4, -1))
    ax_con_sym = [init_mol.atoms[x].sym for x in ax_con]
    eq_con_sym = [init_mol.atoms[x].sym for x in eq_con]
    catoms = [x for x in eq_con] + [x for x in ax_con]
    for info in info_list:
        job_info.update({info: locals()[info]})
    return job_info
def find_mc_eq_ax_autocorrelation_oct(mol,
                                      prop,
                                      loud,
                                      depth,
                                      name=False,
                                      oct=True,
                                      func=autocorrelation_catoms,
                                      modifier=False):
    # For octahedral complexes only.
    # Calculate mc/ax, mc/eq deltametrics.
    liglist, ligdents, ligcons = ligand_breakdown(mol)
    ax_ligand_list, eq_ligand_list, ax_natoms_list, eq_natoms_list, ax_con_int_list, eq_con_int_list, ax_con_list, eq_con_list, built_ligand_list = ligand_assign(
        mol, liglist, ligdents, ligcons, loud, name=False)
    ## shape reduce
    ax_con_list = [x[0] for x in ax_con_list]
    eq_con_list = [x[0] for x in eq_con_list]
    ax_ligand_ac_mc = metal_only_autocorrelation(mol,
                                                 prop,
                                                 depth,
                                                 catoms=ax_con_list,
                                                 func=func,
                                                 modifier=modifier)
    eq_ligand_ac_mc = metal_only_autocorrelation(mol,
                                                 prop,
                                                 depth,
                                                 catoms=eq_con_list,
                                                 func=func,
                                                 modifier=modifier)
    ax_ligand_ac_mc = np.divide(ax_ligand_ac_mc, len(ax_con_list))
    eq_ligand_ac_mc = np.divide(eq_ligand_ac_mc, len(eq_con_list))
    return ax_ligand_ac_mc, eq_ligand_ac_mc
def find_ligand_deltametrics_oct(mol,
                                 prop,
                                 loud,
                                 depth,
                                 name=False,
                                 oct=True,
                                 custom_ligand_dict=False):
    ## custom_ligand_dict.keys() must be eq_ligands_list, ax_ligand_list
    ##                                    ax_con_int_list ,eq_con_int_list
    ## with types: eq/ax_ligand_list list of mol3D
    ##             eq/ax_con_int_list list of list/tuple of int e.g,  [[1,2] [1,2]]
    ## this function takes a
    ## octahedral complex
    ## and returns deltametrics for
    ## the axial an equatorial ligands
    if not custom_ligand_dict:
        liglist, ligdents, ligcons = ligand_breakdown(mol)
        ax_ligand_list, eq_ligand_list, ax_natoms_list, eq_natoms_list, ax_con_int_list, eq_con_int_list, ax_con_list, eq_con_list, built_ligand_list = ligand_assign(
            mol, liglist, ligdents, ligcons, loud, name=False)
    else:
        ax_ligand_list = custom_ligand_dict["ax_ligand_list"]
        eq_ligand_list = custom_ligand_dict["eq_ligand_list"]
        ax_con_int_list = custom_ligand_dict["ax_con_int_list"]
        eq_con_int_list = custom_ligand_dict["eq_con_int_list"]
    ## count ligands
    n_ax = len(ax_ligand_list)
    n_eq = len(eq_ligand_list)

    ## get partial ligand AC
    ax_ligand_ac_con = []
    eq_ligand_ac_con = []

    for i in range(0, n_ax):
        if not list(ax_ligand_ac_con):
            ax_ligand_ac_con = atom_only_deltametric(ax_ligand_list[i].mol,
                                                     prop, depth,
                                                     ax_con_int_list[i])
        else:
            ax_ligand_ac_con += atom_only_deltametric(ax_ligand_list[i].mol,
                                                      prop, depth,
                                                      ax_con_int_list[i])
    ax_ligand_ac_con = np.divide(ax_ligand_ac_con, n_ax)
    for i in range(0, n_eq):
        if not list(eq_ligand_ac_con):
            eq_ligand_ac_con = atom_only_deltametric(eq_ligand_list[i].mol,
                                                     prop, depth,
                                                     eq_con_int_list[i])
        else:
            eq_ligand_ac_con += atom_only_deltametric(eq_ligand_list[i].mol,
                                                      prop, depth,
                                                      eq_con_int_list[i])
    eq_ligand_ac_con = np.divide(eq_ligand_ac_con, n_eq)

    return ax_ligand_ac_con, eq_ligand_ac_con
def find_ligand_autocorrelations_oct(mol,
                                     prop,
                                     loud,
                                     depth,
                                     name=False,
                                     oct=True,
                                     custom_ligand_dict=False):
    ## this function takes a
    ## symmetric (axial == axial,
    ## equatorial == equatorial)
    ## octahedral complex
    ## and returns autocorrelations for
    ## the axial an equatorial ligands
    ## custom_ligand_dict allows the user to skip the breakdown
    ## in cases where 3D geo is not correct/formed
    ## custom_ligand_dict.keys() must be eq_ligands_list, ax_ligand_list
    ##                                    ax_con_int_list ,eq_con_int_list
    ## with types: eq/ax_ligand_list list of mol3D
    ##             eq/ax_con_int_list list of list/tuple of int e.g,  [[1,2] [1,2]]
    if not custom_ligand_dict:
        liglist, ligdents, ligcons = ligand_breakdown(mol)
        ax_ligand_list, eq_ligand_list, ax_natoms_list, eq_natoms_list, ax_con_int_list, eq_con_int_list, ax_con_list, eq_con_list, built_ligand_list = ligand_assign(
            mol, liglist, ligdents, ligcons, loud, name=False)
    else:
        ax_ligand_list = custom_ligand_dict["ax_ligand_list"]
        eq_ligand_list = custom_ligand_dict["eq_ligand_list"]
        ax_con_int_list = custom_ligand_dict["ax_con_int_list"]
        eq_con_int_list = custom_ligand_dict["eq_con_int_list"]
    ## count ligands
    n_ax = len(ax_ligand_list)
    n_eq = len(eq_ligand_list)
    ## get full ligand AC
    ax_ligand_ac_full = []
    eq_ligand_ac_full = []
    for i in range(0, n_ax):
        if not list(ax_ligand_ac_full):
            ax_ligand_ac_full = full_autocorrelation(ax_ligand_list[i].mol,
                                                     prop, depth)
        else:
            ax_ligand_ac_full += full_autocorrelation(ax_ligand_list[i].mol,
                                                      prop, depth)
    ax_ligand_ac_full = np.divide(ax_ligand_ac_full, n_ax)
    for i in range(0, n_eq):
        if not list(eq_ligand_ac_full):
            eq_ligand_ac_full = full_autocorrelation(eq_ligand_list[i].mol,
                                                     prop, depth)
        else:
            eq_ligand_ac_full += full_autocorrelation(eq_ligand_list[i].mol,
                                                      prop, depth)
    eq_ligand_ac_full = np.divide(eq_ligand_ac_full, n_eq)

    ## get partial ligand AC
    ax_ligand_ac_con = []
    eq_ligand_ac_con = []

    for i in range(0, n_ax):
        if not list(ax_ligand_ac_con):
            ax_ligand_ac_con = atom_only_autocorrelation(
                ax_ligand_list[i].mol, prop, depth, ax_con_int_list[i])
        else:
            ax_ligand_ac_con += atom_only_autocorrelation(
                ax_ligand_list[i].mol, prop, depth, ax_con_int_list[i])
    ax_ligand_ac_con = np.divide(ax_ligand_ac_con, n_ax)
    for i in range(0, n_eq):
        if not list(eq_ligand_ac_con):
            eq_ligand_ac_con = atom_only_autocorrelation(
                eq_ligand_list[i].mol, prop, depth, eq_con_int_list[i])
        else:
            eq_ligand_ac_con += atom_only_autocorrelation(
                eq_ligand_list[i].mol, prop, depth, eq_con_int_list[i])
    eq_ligand_ac_con = np.divide(eq_ligand_ac_con, n_eq)

    # ax_ligand_ac_con = atom_only_autocorrelation(ax_ligand.mol,prop,depth,ax_con_int)
    # eq_ligand_ac_con = atom_only_autocorrelation(eq_ligand.mol,prop,depth,eq_con_int)
    return ax_ligand_ac_full, eq_ligand_ac_full, ax_ligand_ac_con, eq_ligand_ac_con
Example #5
0
def generate_all_ligand_misc(mol, loud, custom_ligand_dict=False, force_legacy=False):
    # custom_ligand_dict.keys() must be eq_ligands_list, ax_ligand_list
    ##                                    ax_con_int_list ,eq_con_int_list
    # with types: eq/ax_ligand_list list of mol3D
    # eq/ax_con_int_list list of list/tuple of int e.g,  [[1,2] [1,2]]
    # use force_legacy to get kier indices/MCDL
    result_ax = list()
    result_eq = list()
    if force_legacy:
        colnames = ['dent', 'maxDEN', 'ki', 'tki', 'charge']
    else:
        colnames = ['dent', 'charge']
    if not custom_ligand_dict:
        liglist, ligdents, ligcons = ligand_breakdown(mol)
        ax_ligand_list, eq_ligand_list, ax_natoms_list, eq_natoms_list, ax_con_int_list, eq_con_int_list, ax_con_list, eq_con_list, built_ligand_list = ligand_assign(
            mol, liglist, ligdents, ligcons, loud, name=False)
    else:
        ax_ligand_list = custom_ligand_dict["ax_ligand_list"]
        eq_ligand_list = custom_ligand_dict["eq_ligand_list"]
        ax_con_int_list = custom_ligand_dict["ax_con_int_list"]
        eq_con_int_list = custom_ligand_dict["eq_con_int_list"]
    # count ligands
    n_ax = len(ax_ligand_list)
    n_eq = len(eq_ligand_list)
    # allocate
    result_ax_dent = False
    result_eq_dent = False
    result_ax_maxdelen = False
    result_eq_maxdelen = False
    result_ax_ki = False
    result_eq_ki = False
    result_ax_tki = False
    result_eq_tki = False
    result_ax_charge = False
    result_eq_charge = False
    # loop over axial ligands
    if n_ax > 0:
        for i in range(0, n_ax):
            ax_ligand_list[i].mol.convert2OBMol()
            if not (i == 0):
                result_ax_dent += ax_ligand_list[i].dent
                if force_legacy:
                    result_ax_maxdelen += get_lig_EN(
                        ax_ligand_list[i].mol, ax_con_int_list[i])
                    result_ax_ki += kier(ax_ligand_list[i].mol)
                    result_ax_tki += get_truncated_kier(
                        ax_ligand_list[i].mol, ax_con_int_list[i])
                result_ax_charge += ax_ligand_list[i].mol.OBMol.GetTotalCharge()
            else:
                result_ax_dent = ax_ligand_list[i].dent
                if force_legacy:
                    result_ax_maxdelen = get_lig_EN(
                        ax_ligand_list[i].mol, ax_con_int_list[i])
                    result_ax_ki = kier(ax_ligand_list[i].mol)
                    result_ax_tki = get_truncated_kier(
                        ax_ligand_list[i].mol, ax_con_int_list[i])
                result_ax_charge = ax_ligand_list[i].mol.OBMol.GetTotalCharge()
        # average axial results
        result_ax_dent = np.divide(result_ax_dent, n_ax)
        if force_legacy:
            result_ax_maxdelen = np.divide(result_ax_maxdelen, n_ax)
            result_ax_ki = np.divide(result_ax_ki, n_ax)
            result_ax_tki = np.divide(result_ax_tki, n_ax)
        result_ax_charge = np.divide(result_ax_charge, n_ax)

    # loop over eq ligands
    if n_eq > 0:
        for i in range(0, n_eq):
            eq_ligand_list[i].mol.convert2OBMol()
            if not (i == 0):
                result_eq_dent += eq_ligand_list[i].dent
                if force_legacy:
                    result_eq_maxdelen += get_lig_EN(
                        eq_ligand_list[i].mol, eq_con_int_list[i])
                    result_eq_ki += kier(eq_ligand_list[i].mol)
                    result_eq_tki += get_truncated_kier(
                        eq_ligand_list[i].mol, eq_con_int_list[i])
                result_eq_charge += eq_ligand_list[i].mol.OBMol.GetTotalCharge()
            else:
                result_eq_dent = eq_ligand_list[i].dent
                if force_legacy:
                    result_eq_maxdelen = get_lig_EN(
                        eq_ligand_list[i].mol, eq_con_int_list[i])
                    result_eq_ki = kier(eq_ligand_list[i].mol)
                    result_eq_tki = get_truncated_kier(
                        eq_ligand_list[i].mol, eq_con_int_list[i])
                result_eq_charge = eq_ligand_list[i].mol.OBMol.GetTotalCharge()
        # average eq results
        result_eq_dent = np.divide(result_eq_dent, n_eq)
        if force_legacy:
            result_eq_maxdelen = np.divide(result_eq_maxdelen, n_eq)
            result_eq_ki = np.divide(result_eq_ki, n_eq)
            result_eq_tki = np.divide(result_eq_tki, n_eq)
        result_eq_charge = np.divide(result_eq_charge, n_eq)
        # save the results
    result_ax.append(result_ax_dent)
    if force_legacy:
        result_ax.append(result_ax_maxdelen)
        result_ax.append(result_ax_ki)
        result_ax.append(result_ax_tki)
    result_ax.append(result_ax_charge)

    result_eq.append(result_eq_dent)
    if force_legacy:
        result_eq.append(result_eq_maxdelen)
        result_eq.append(result_eq_ki)
        result_eq.append(result_eq_tki)
    result_eq.append(result_eq_charge)

    results_dictionary = {'colnames': colnames,
                          'result_ax': result_ax, 'result_eq': result_eq}
    return results_dictionary
Example #6
0
def getLigFormulae(mol):
    ## This function gets
    ## ax and equitorial 
    ## ligand names for octahedral complexes 
    axnames = []
    eqnames = []
    liglist, ligdents, ligcons = ligand_breakdown(mol)
    ax_ligand_list, eq_ligand_list, ax_natoms_list, eq_natoms_list, ax_con_int_list, eq_con_int_list, ax_con_list, eq_con_list, built_ligand_list = ligand_assign(
        mol, liglist, ligdents, ligcons, False, False)
    for axl in ax_ligand_list:
        axnames.append(axl.mol.make_formula())
    for eql in eq_ligand_list:
        eqnames.append(eql.mol.make_formula())
    return axnames, eqnames
Example #7
0
def getOctBondDistances(mol):
    ## This function gets
    ## ax and equitorial 
    ## min and max bond lengths
    liglist, ligdents, ligcons = ligand_breakdown(mol)
    ax_ligand_list, eq_ligand_list, ax_natoms_list, eq_natoms_list, ax_con_int_list, eq_con_int_list, ax_con_list, eq_con_list, built_ligand_list = ligand_assign(
        mol, liglist, ligdents, ligcons, False, False)
    ax_dist = list()
    eq_dist = list()
    for ax_ligs in ax_con_list:
        tempList = list()
        for conatms in ax_ligs:
            tempList.append(distance(mol.getAtom(mol.findMetal()[0]).coords(), mol.getAtom(conatms).coords()))
        ax_dist.append(tempList)
    for eq_ligs in eq_con_list:
        tempList = list()
        for conatms in eq_ligs:
            tempList.append(distance(mol.getAtom(mol.findMetal()[0]).coords(), mol.getAtom(conatms).coords()))
        eq_dist.append(tempList)
    return ax_dist, eq_dist