frag_pele/Growing/template_fragmenter.py
def main(template_initial_path, template_grown_path, step, total_steps, hydrogen_to_replace, core_atom_linker,
         tmpl_out_path, null_charges=False, growing_mode="SoftcoreLike"):
    """
    Module to modify templates, currently working in OPLS2005. This main function basically compares two templates;
    an initial and a grown one, extracting the atoms of the fragment (that have been grown). Then, it uses this data
    to modify Linearly different attributes of the template, particularly, sigmas, charges, bond equilibrium distance,
    and the radius non polar SGB from atoms and bonds of the fragment. This modification is performed according to a
    lambda parameter that is computed dividing the current step by the total number of steps. Finally, the template is
    modified and written again to an output file.
    :param template_initial_path: Path to an OPLS2005 template of the core ligand.
    :type template_initial_path: str
    :param template_grown_path: Path to an OPLS2005 template of the ligand with the fragment added to the core.
    :type template_grown_path: str
    :param step: Current step of the total steps.
    :type step: int
    :param total_steps: Total number of steps.
    :type total_steps: int
    :param hydrogen_to_replace: PDB atom name of the hydrogen that will be replaced for the linking atom of the fragment.
    :type hydrogen_to_replace: str
    :param core_atom_linker: PDB atom name of the core that is linking the fragment.
    :type core_atom_linker: str
    :param tmpl_out_path: Output path for the template modified.
    :type tmpl_out_path: str
    :return: None
    """
    lambda_to_reduce = float(step/(total_steps+1))
    templ_ini = TemplateImpact(template_initial_path)
    
    for bond in templ_ini.list_of_bonds:
        key, bond_cont = bond
    templ_grw = TemplateImpact(template_grown_path)
    fragment_atoms, core_atoms_in, core_atoms_grown = detect_atoms(template_initial=templ_ini, 
                                                                   template_grown=templ_grw,
                                                                   hydrogen_to_replace=hydrogen_to_replace)
    set_fragment_atoms(list_of_fragment_atoms=fragment_atoms)
    set_connecting_atom(template_grown=templ_grw, pdb_atom_name=core_atom_linker)
    fragment_bonds = detect_fragment_bonds(list_of_fragment_atoms=fragment_atoms, template_grown=templ_grw)
    set_fragment_bonds(list_of_fragment_bonds=fragment_bonds)
    set_linker_bond(templ_grw)
    if growing_mode == "SoftcoreLike":
        modify_core_parameters_linearly(templ_grw, lambda_to_reduce, templ_ini, exp_charges=True,
                                        null_charges=null_charges)
        reduce_fragment_parameters_linearly(templ_grw, lambda_to_reduce, exp_charges=True, 
                                            null_charges=null_charges)
            
        modify_linkers_parameters_linearly(templ_grw, lambda_to_reduce, templ_ini, hydrogen_to_replace)
    elif growing_mode == "AllLinear":
        modify_core_parameters_linearly(templ_grw, lambda_to_reduce, templ_ini, exp_charges=False)
        reduce_fragment_parameters_linearly(templ_grw, lambda_to_reduce, exp_charges=False,
                                            null_charges=False)
        modify_linkers_parameters_linearly(templ_grw, lambda_to_reduce, templ_ini, hydrogen_to_replace)
    elif growing_mode == "SpreadHcharge":
        if step > 1:
            reduce_fragment_parameters_originaly(templ_grw, templ_ini, lambda_to_reduce, 
                                                  hydrogen=hydrogen_to_replace, n_GS=total_steps)
            modify_linkers_parameters_linearly(templ_grw, lambda_to_reduce, templ_ini, hydrogen_to_replace)
        else:
            reduce_fragment_parameters_spreading_H(templ_grw, templ_ini, lambda_to_reduce, 
                                                   hydrogen=hydrogen_to_replace, n_GS=total_steps)
    else:
        raise ValueError("Growing mode Not valid. Choose between: 'SoftcoreLike', 'SpreadHcharge', 'AllLinear'.")
    templ_grw.write_template_to_file(template_new_name=tmpl_out_path)
    return [atom.pdb_atom_name for atom in fragment_atoms], \
            [atom.pdb_atom_name for atom in core_atoms_grown]

    Module to modify templates, currently working in OPLS2005. This main function basically compares two templates;
    an initial and a grown one, extracting the atoms of the fragment (that have been grown). Then, it uses this data
    to modify Linearly different attributes of the template, particularly, sigmas, charges, bond equilibrium distance,
    and the radius non polar SGB from atoms and bonds of the fragment. This modification is performed according to a
    lambda parameter that is computed dividing the current step by the total number of steps. Finally, the template is
    modified and written again to an output file.
    :param template_initial_path: Path to an OPLS2005 template of the core ligand.
    :type template_initial_path: str
    :param template_grown_path: Path to an OPLS2005 template of the ligand with the fragment added to the core.
    :type template_grown_path: str
    :param step: Current step of the total steps.
    :type step: int
    :param total_steps: Total number of steps.
    :type total_steps: int
    :param hydrogen_to_replace: PDB atom name of the hydrogen that will be replaced for the linking atom of the fragment.
    :type hydrogen_to_replace: str
    :param core_atom_linker: PDB atom name of the core that is linking the fragment.
    :type core_atom_linker: str
    :param tmpl_out_path: Output path for the template modified.
    :type tmpl_out_path: str
    :return: None
    
Module to modify templates, currently working in OPLS2005. This main function basically compares two templates;
an initial and a grown one, extracting the atoms of the fragment (that have been grown). Then, it uses this data
to modify Linearly different attributes of the template, particularly, sigmas, charges, bond equilibrium distance,
and the radius non polar SGB from atoms and bonds of the fragment. This modification is performed according to a
lambda parameter that is computed dividing the current step by the total number of steps. Finally, the template is
modified and written again to an output file.
Module to modify templates currently working in OPLS2005 . This main function basically compares two templates ; an initial and a grown one extracting the atoms of the fragment ( that have been grown ) . Then it uses this data to modify Linearly different attributes of the template particularly sigmas charges bond equilibrium distance and the radius non polar SGB from atoms and bonds of the fragment . This modification is performed according to a lambda parameter that is computed dividing the current step by the total number of steps . Finally the template is modified and written again to an output file .
def main(template_initial_path, template_grown_path, step, total_steps, hydrogen_to_replace, core_atom_linker,
         tmpl_out_path, null_charges=False, growing_mode="SoftcoreLike"):
    lambda_to_reduce = float(step/(total_steps+1))
    templ_ini = TemplateImpact(template_initial_path)
    for bond in templ_ini.list_of_bonds:
        key, bond_cont = bond
    templ_grw = TemplateImpact(template_grown_path)
    fragment_atoms, core_atoms_in, core_atoms_grown = detect_atoms(template_initial=templ_ini, 
                                                                   template_grown=templ_grw,
                                                                   hydrogen_to_replace=hydrogen_to_replace)
    set_fragment_atoms(list_of_fragment_atoms=fragment_atoms)
    set_connecting_atom(template_grown=templ_grw, pdb_atom_name=core_atom_linker)
    fragment_bonds = detect_fragment_bonds(list_of_fragment_atoms=fragment_atoms, template_grown=templ_grw)
    set_fragment_bonds(list_of_fragment_bonds=fragment_bonds)
    set_linker_bond(templ_grw)
    if growing_mode == "SoftcoreLike":
        modify_core_parameters_linearly(templ_grw, lambda_to_reduce, templ_ini, exp_charges=True,
                                        null_charges=null_charges)
        reduce_fragment_parameters_linearly(templ_grw, lambda_to_reduce, exp_charges=True, 
                                            null_charges=null_charges)
        modify_linkers_parameters_linearly(templ_grw, lambda_to_reduce, templ_ini, hydrogen_to_replace)
    elif growing_mode == "AllLinear":
        modify_core_parameters_linearly(templ_grw, lambda_to_reduce, templ_ini, exp_charges=False)
        reduce_fragment_parameters_linearly(templ_grw, lambda_to_reduce, exp_charges=False,
                                            null_charges=False)
        modify_linkers_parameters_linearly(templ_grw, lambda_to_reduce, templ_ini, hydrogen_to_replace)
    elif growing_mode == "SpreadHcharge":
        if step > 1:
            reduce_fragment_parameters_originaly(templ_grw, templ_ini, lambda_to_reduce, 
                                                  hydrogen=hydrogen_to_replace, n_GS=total_steps)
            modify_linkers_parameters_linearly(templ_grw, lambda_to_reduce, templ_ini, hydrogen_to_replace)
        else:
            reduce_fragment_parameters_spreading_H(templ_grw, templ_ini, lambda_to_reduce, 
                                                   hydrogen=hydrogen_to_replace, n_GS=total_steps)
    else:
        raise ValueError("Growing mode Not valid. Choose between: 'SoftcoreLike', 'SpreadHcharge', 'AllLinear'.")
    templ_grw.write_template_to_file(template_new_name=tmpl_out_path)
    return [atom.pdb_atom_name for atom in fragment_atoms], \
            [atom.pdb_atom_name for atom in core_atoms_grown]
def main ( template_initial_path , template_grown_path , step , total_steps , hydrogen_to_replace , core_atom_linker , tmpl_out_path , null_charges = False , growing_mode = "SoftcoreLike" ) : lambda_to_reduce = float ( step / ( total_steps + 1 ) ) templ_ini = TemplateImpact ( template_initial_path ) for bond in templ_ini . list_of_bonds : key , bond_cont = bond templ_grw = TemplateImpact ( template_grown_path ) fragment_atoms , core_atoms_in , core_atoms_grown = detect_atoms ( template_initial = templ_ini , template_grown = templ_grw , hydrogen_to_replace = hydrogen_to_replace ) set_fragment_atoms ( list_of_fragment_atoms = fragment_atoms ) set_connecting_atom ( template_grown = templ_grw , pdb_atom_name = core_atom_linker ) fragment_bonds = detect_fragment_bonds ( list_of_fragment_atoms = fragment_atoms , template_grown = templ_grw ) set_fragment_bonds ( list_of_fragment_bonds = fragment_bonds ) set_linker_bond ( templ_grw ) if growing_mode == "SoftcoreLike" : modify_core_parameters_linearly ( templ_grw , lambda_to_reduce , templ_ini , exp_charges = True , null_charges = null_charges ) reduce_fragment_parameters_linearly ( templ_grw , lambda_to_reduce , exp_charges = True , null_charges = null_charges ) modify_linkers_parameters_linearly ( templ_grw , lambda_to_reduce , templ_ini , hydrogen_to_replace ) elif growing_mode == "AllLinear" : modify_core_parameters_linearly ( templ_grw , lambda_to_reduce , templ_ini , exp_charges = False ) reduce_fragment_parameters_linearly ( templ_grw , lambda_to_reduce , exp_charges = False , null_charges = False ) modify_linkers_parameters_linearly ( templ_grw , lambda_to_reduce , templ_ini , hydrogen_to_replace ) elif growing_mode == "SpreadHcharge" : if step > 1 : reduce_fragment_parameters_originaly ( templ_grw , templ_ini , lambda_to_reduce , hydrogen = hydrogen_to_replace , n_GS = total_steps ) modify_linkers_parameters_linearly ( templ_grw , lambda_to_reduce , templ_ini , hydrogen_to_replace ) else : reduce_fragment_parameters_spreading_H ( templ_grw , templ_ini , lambda_to_reduce , hydrogen = hydrogen_to_replace , n_GS = total_steps ) else : raise ValueError ( "Growing mode Not valid. Choose between: 'SoftcoreLike', 'SpreadHcharge', 'AllLinear'." ) templ_grw . write_template_to_file ( template_new_name = tmpl_out_path ) return [ atom . pdb_atom_name for atom in fragment_atoms ] , [ atom . pdb_atom_name for atom in core_atoms_grown ]
Module to modify templates, currently working in OPLS2005.
Module to modify templates currently working in OPLS2005 .
"""
    Module to modify templates, currently working in OPLS2005. This main function basically compares two templates;
    an initial and a grown one, extracting the atoms of the fragment (that have been grown). Then, it uses this data
    to modify Linearly different attributes of the template, particularly, sigmas, charges, bond equilibrium distance,
    and the radius non polar SGB from atoms and bonds of the fragment. This modification is performed according to a
    lambda parameter that is computed dividing the current step by the total number of steps. Finally, the template is
    modified and written again to an output file.
    :param template_initial_path: Path to an OPLS2005 template of the core ligand.
    :type template_initial_path: str
    :param template_grown_path: Path to an OPLS2005 template of the ligand with the fragment added to the core.
    :type template_grown_path: str
    :param step: Current step of the total steps.
    :type step: int
    :param total_steps: Total number of steps.
    :type total_steps: int
    :param hydrogen_to_replace: PDB atom name of the hydrogen that will be replaced for the linking atom of the fragment.
    :type hydrogen_to_replace: str
    :param core_atom_linker: PDB atom name of the core that is linking the fragment.
    :type core_atom_linker: str
    :param tmpl_out_path: Output path for the template modified.
    :type tmpl_out_path: str
    :return: None
    """
None
template_initial_path
Path to an OPLS2005 template of the core ligand.
Path to an OPLS2005 template of the core ligand .
template_grown_path
Path to an OPLS2005 template of the ligand with the fragment added to the core.
Path to an OPLS2005 template of the ligand with the fragment added to the core .
step
Current step of the total steps.
Current step of the total steps .
total_steps
Total number of steps.
Total number of steps .
hydrogen_to_replace
PDB atom name of the hydrogen that will be replaced for the linking atom of the fragment.
PDB atom name of the hydrogen that will be replaced for the linking atom of the fragment .
core_atom_linker
PDB atom name of the core that is linking the fragment.
PDB atom name of the core that is linking the fragment .
tmpl_out_path
Output path for the template modified.
Output path for the template modified .
null_charges
growing_mode