SMArt.alchemy package

Submodules

SMArt.alchemy.MCS module

class SMArt.alchemy.MCS.MCS(*tops, flag_partial_ring=True, max_partial_ring_match=2, **kwargs)[source]

Bases: SMArt.incl.DataDumping

calc_score(sol, **kwargs)[source]
static calculate_combined_branch_pair_estimate(b1, b2)[source]
calculate_estimate_atom_dummy_pairs_in_sol(sol, top_pair_ind)[source]
calculate_estimate_atom_pair_in_sol(sol, top_pair_ind, atom_i, atom_j)[source]
calculate_estimate_atom_pair_in_sol_ring_ind(sol, top_pair_ind, atom_i, atom_j, ind_ring_parts_in_sol, ind_ring_parts_avail)[source]
check_match_pair(matched_pair, sol, **kwargs)[source]
Parameters
  • matched_pair

  • sol

  • kwargs

Returns

create_estimate_top_pair_in_sol(top_pair_ind, available_atoms_frozenset, in_solution_atoms_frozenset, in_solution_dummy_match_atoms_frozenset)[source]
enumerate_brute_force(**kwargs)[source]
enumerate_brute_force_call(sol, **kwargs)[source]
enumerate_stepwise(**kwargs)[source]
enumerate_stepwise_call(sol, **kwargs)[source]
enumerate_stepwise_call_partial_sol_invalid(sol, top_pair, rows, independent_ring_parts, **kwargs)[source]
enumerate_stepwise_sorted(**kwargs)[source]
enumerate_stepwise_sorted_call(sol, **kwargs)[source]
find_atom_order(sol)[source]
get_TGP_top_available_atoms(top_i, available_atoms, in_solution_atoms, in_solution_dummy_match_atoms)[source]
get_all_vs_all_estimate_matrix_top_pair(top_pair_ind, available_atoms, available_atoms_frozenset=None)[source]
get_initial_atom_brute_force(**kwargs)[source]
get_initial_pairs_brute_force(**kwargs)[source]
get_initial_pairs_stepwise(**kwargs)[source]
get_new_pairs_brute_force(sol, **kwargs)[source]
get_new_pairs_stepwise(sol, **kwargs)[source]
get_sorted_initial_pairs_stepwise(sol, **kwargs)[source]
get_sorted_initial_pairs_stepwise_2(sol, **kwargs)[source]
get_sorted_new_pairs_stepwise(sol, **kwargs)[source]
make_estimates(sol, **kwargs)[source]
prune(sol, **kwargs)[source]
static reduce_dummy_estimates_1(pair_estimates)[source]
static reduce_dummy_estimates_2(pair_estimates)[source]
update_solution(sol, temp_pair, old_sol, **kwargs)[source]
update_solutions(new_solution, n_solutions=- 1, **kwargs)[source]

SMArt.alchemy.incl module

class SMArt.alchemy.incl.AlchemicalSolution(tops, **kwargs)[source]

Bases: SMArt.alchemy.incl.AlchemicalSolution_base

class SMArt.alchemy.incl.AlchemicalSolution_base(tops, sol, available_atoms, flag_top_not_in_sol, sol_atoms_map, tried_pairs=None)[source]

Bases: object

add_match2sol(matched_pair)[source]

adds a matched pair (of atoms) to the current solution and creates a new one updates the other important variables (all from self.__init__ and tried_pairs) :param matched_pair: :return:

copy()[source]
copy4update()[source]
copy4update_new_sol_df(new_sol_df)[source]
copy_add_state()[source]
find_common_atom_pair(top_atom0_index, top1_index)[source]
find_sol_atom(top_atom0_index)[source]
states2df(**kwargs)[source]
transform_top_index_atom(top_index_atom)[source]
transform_top_index_atom_pair(matched_pair)[source]
update_copy_sol_toptp(new_sol)[source]
update_copy_sol_toptp_add_state(new_sol)[source]
update_tried_pairs()[source]
class SMArt.alchemy.incl.Branch(roots, parents, neigh_count, **kwargs)[source]

Bases: object

static calculate_branch_pair_estimate(branches)[source]
classmethod calculate_neigh_count_pair_estimate(neigh_count_pair)[source]
calculate_pair_estimate(other_branch)[source]
static calculate_stacked_neigh_count_pair_estimate(stacked_neigh_count)[source]
static combine_mutually_exclusive_neigh_count_list(neigh_count_list)[source]

calculates combined neigh_count from a list of neigh_count, such that it takes max at each position :param neigh_count_list: :return:

static combine_mutually_exclusive_neigh_count_list_with_max_Nv(neigh_count_list)[source]

calculates combined neigh_count from a list of neigh_count, such that it takes max at each position returns also the max Nv from the neigh count lists :param neigh_count_list: :return:

combine_neigh_count(other_branch, flag_other_neigh_count=False)[source]
static combine_neigh_count_list(neigh_count_list)[source]
sum_neigh_count(other_branch, flag_other_neigh_count=False)[source]
static sum_neigh_count_list(neigh_count_list)[source]
static sum_neigh_count_list_branches(branches)[source]
class SMArt.alchemy.incl.TopGraphProperties(g, available_Vs=None, non_available_Vs=None, in_solution_Vs=None, in_solution_dummy_match_Vs=None, remove_V_in_branch=False, **kwargs)[source]

Bases: object

graph properties: rings, different branches, dummy-match estimates etc…

attributes within g:

rings, rings_map within each ring:

breaks, breaks_map, break_parents, independent_parts, independent_parts_map, independent_parts_graph

attributes within the instance:

g, available_Vs, non_available_Vs first_non_ring_neighbours branches, ring_branches - true branches combined_FromRing_branches - for each ring / atom in r, a combined branch to all parents that are not in r each of ring_branches

combined_linear_branch - max of neighbouring combined_FromRing_branches within the r fake_branches - it’s a full branch having a single parent within the r

break_branches - for each ring combined_FromRing_branches - branch that is a combination off branches going out of the r combined_branches, linear_combined_branches - for each atom, combination of all available branches

if v in ring, linear_combined_branches is a bit different as it only takes first neighbours within r

dummy_estimates

check_branches()[source]
check_separate_groups(groups, **kwargs)[source]
combine_neigh_count_Nv_VinB_general(V_in_branch, neigh_count_list, Nv_sum, temp_branch)[source]
combine_neigh_count_Nv_general(neigh_count_list, Nv_sum, temp_branch)[source]
get_FromRing_branches_recursive(r, v)[source]
get_FromRing_nonring_branches_recursive(v)[source]
get_FromRing_ring_branches_recursive(r, v)[source]
get_branch_Vpair(v0, v1)[source]
get_branch_roots_parents(roots, parents)[source]
get_branches()[source]
get_combined_neigh_count_Nv()[source]
get_dummy_branch(v0)[source]
get_dummy_match_estimates()[source]
get_dummy_match_estimates_in_solution(**kwargs)[source]
get_first_non_ring_neighbour()[source]
get_max_Nv_combB_vDummy(v)[source]
get_neigh_count_Vpair(v0, v1)[source]
static get_neigh_count_from_generator(BFS_generator, **kwargs)[source]
get_neigh_count_roots_parents(roots, parents)[source]
get_nonring_branch_recursive(v0, v1)[source]
get_ring_branch_recursive(v0, r)[source]
get_ring_break_branches()[source]
get_ring_combined_FromRing_branch_recursive(r, v)[source]
get_ring_combined_linear_branch_recursive(r, v)[source]
get_ring_combined_linear_branch_tot_Nv()[source]
get_ring_ring_branch_from_generator_VinB_recursive(roots, parents, r, BFS_generator)[source]
get_ring_ring_branch_from_generator_recursive(roots, parents, r, V_in_branch, BFS_generator)[source]
get_ring_sorted_RLCB(r)[source]
get_separate_groups(**kwargs)[source]
get_separate_groups_brute_force()[source]
get_separate_groups_old(**kwargs)[source]
get_sorted_combined_branches()[source]
get_v_dummy_match_estimate(v_dummy)[source]
remove_V_in_branch()[source]
static update_neigh_count(v, l, collect_res)[source]
update_neigh_count_Nv_VinB_general(V_in_branch, neigh_count_list, Nv_sum, temp_branch, l=1)[source]
update_neigh_count_Nv_general(neigh_count_list, Nv_sum, temp_branch, l=1)[source]
classmethod update_neigh_count_VinB(v, l, collect_res, V_in_branch)[source]

SMArt.alchemy.top_matching_fnc module

SMArt.alchemy.top_matching_fnc.add_DUM_exclusions(sol, ff_dumm=None, **kwargs)[source]
SMArt.alchemy.top_matching_fnc.add_atom_a_type_to_row(sol_at, at_a_type, st_at, ptp_atom)[source]
SMArt.alchemy.top_matching_fnc.add_atom_m_to_row(sol_at, at_m, st_at, ptp_atom)[source]
SMArt.alchemy.top_matching_fnc.add_atom_pch_to_row(sol_at, at_p_ch, st_at, ptp_atom)[source]
SMArt.alchemy.top_matching_fnc.add_atom_to_row(sol_at, top_atom_id)[source]
SMArt.alchemy.top_matching_fnc.add_new_excl_pair(sol, sol_atom_pair, temp_state, top_i)[source]
SMArt.alchemy.top_matching_fnc.add_new_toptp_atom(sol, row_idx)[source]
SMArt.alchemy.top_matching_fnc.add_state2EP_ND_states(sol, sol_interaction, temp_state, top_idx)[source]
SMArt.alchemy.top_matching_fnc.find_ND_state_tops_set(ND_states, state_top_i, top_i)[source]
SMArt.alchemy.top_matching_fnc.find_atom_order(sol, **kwargs)[source]
SMArt.alchemy.top_matching_fnc.find_best_ptp_matches(int_list0, int_list1, flag_improper, top_01, atoms_01_map, ptp_score_kwargs, **kwargs)[source]
SMArt.alchemy.top_matching_fnc.find_interactions_ptp(at0, at1, top_01, top_pair_ind, sol, done_interactions, **kwargs)[source]
SMArt.alchemy.top_matching_fnc.gen_int_container_01_list(at0, at1, top_01, top_pair_ind, sol, **kwargs)[source]

generator for interaction containers to be checked for matches

SMArt.alchemy.top_matching_fnc.gen_int_container_01_list_new(at0, at1, top_01, top_pair_ind, sol, **kwargs)[source]

generator for interaction containers to be checked for matches

SMArt.alchemy.top_matching_fnc.generate_atom_states(sol, ff_dumm=None, **kwargs)[source]
SMArt.alchemy.top_matching_fnc.generate_atom_top_state(sol, other_state=None, **kwargs)[source]
SMArt.alchemy.top_matching_fnc.generate_excl_from_EP(sol, **kwargs)[source]
SMArt.alchemy.top_matching_fnc.generate_int_states(sol, **kwargs)[source]
SMArt.alchemy.top_matching_fnc.generate_multi_state_top(sol, top_state=0, **kwargs)[source]

generates multi state topology (and ptp topology) based on the solution :param sol: solution (from MCS) :param top_state: state to use to generate the topology (0 default) :kwargs

add_DUM_exclusions: adds exclusions betweeen dummies from different states (True by default) flag_EP2excl: generates exclusions and pairse from EP flag_bond_constraints: generates constraints to all bonds except the perturbed ones

also to be passed on to the following functions:

generate_atom_states, generate_int_states, find_atom_order

SMArt.alchemy.top_matching_fnc.generate_ptp_excl_pair_single_atom(sol, row_idx, top_i, done_sol_atom_pairs=None, **kwargs)[source]
SMArt.alchemy.top_matching_fnc.generate_toptp(N_tops=None, tops=None, sol=None, **kwargs)[source]
SMArt.alchemy.top_matching_fnc.get_exclusion_pair_state_from_EP(at1, at2, top, top_state=0)[source]
SMArt.alchemy.top_matching_fnc.get_generator_ptp_excl_pair_single_atom(sol, row_idx, top_i, done_sol_atom_pairs=None, **kwargs)[source]
SMArt.alchemy.top_matching_fnc.get_res_atom_names_v1(sol, **kwargs)[source]
SMArt.alchemy.top_matching_fnc.get_res_common_atoms(*tops)[source]
SMArt.alchemy.top_matching_fnc.get_residues_v1(sol, **kwargs)[source]
SMArt.alchemy.top_matching_fnc.get_state_names(sol, **kwargs)[source]
SMArt.alchemy.top_matching_fnc.get_sys_title(sol, **kwargs)[source]
SMArt.alchemy.top_matching_fnc.merge_EP_ND_states(sol, sol_interaction, sol_interaction2)[source]
SMArt.alchemy.top_matching_fnc.update_ptp(sol, top_atom_pair, old_sol, **kwargs)[source]
SMArt.alchemy.top_matching_fnc.update_ptp_excl_pair_atom_atom_pair(sol, row_idx, top_atom_pair, **kwargs)[source]
SMArt.alchemy.top_matching_fnc.update_ptp_excl_pair_row_atom_pair(sol, top_atom, sol_atom, **kwargs)[source]
SMArt.alchemy.top_matching_fnc.update_ptp_excl_pair_row_row_pair(sol, sol_atoms_pair, top_atom_list_01, **kwargs)[source]
SMArt.alchemy.top_matching_fnc.update_ptp_interactions(sol, top_atom_list_01, done_interactions=None, **kwargs)[source]

Module contents

SMArt.alchemy.generate_2state_top(mcs, solution=0, top_state=0, other_state=1, **kwargs)[source]

generates a pairwise topology based on a given MCS solution :param mcs: MCS instance used to enumerate possible solutions :param solution: index of the solution (from mcs.solutions list) :param top_state: topology state (0 by default) :param other_state: perturbation state (1 by default) :param kwargs: kwargs to pass onto SMArt.alchemy.top_matching_fnc.generate_multi_state_top function :return:

SMArt.alchemy.generate_EDS_top(mcs, solution=0, flag_EDS_mass=True, find_other_state='any', **kwargs)[source]
SMArt.alchemy.get_EDS(*tops, **kwargs)[source]
Parameters
  • tops

  • kwargs – flag_stepwise - add topologies stepwise (True) flag_prune_EDS_match_mass dihedral_match_v find_other_state

Returns

MCS instance with solutions (run generate_EDS_top(mcs) to get the EDS topology)

SMArt.alchemy.get_ptp_ligands(top1, top2, **kwargs)[source]
Parameters
  • top1

  • top2

  • kwargs – flag_get_res_common_atoms - common atoms for residues with same names and len(atoms) - False as default flag_top_update - use topology information (True as default) flag_top_prune - which prune function to use (None as default; alternative ‘bond’ - makes sure no bonds are perturbed)

Returns

MCS instance with solutions (run generate_2state_top(mcs) to get the topology)

SMArt.alchemy.point_mutation(top1, top2, **kwargs)[source]
Parameters
  • top1

  • top2

  • kwargs – flag_get_res_common_atoms - common atoms for residues with same names and len(atoms) - True as default flag_top_update - use topology information (True as default) flag_top_prune - which prune function to use (None as default; alternative ‘bond’ - makes sure no bonds are perturbed)

Returns

MCS instance with solutions (run generate_2state_top(mcs) to get the topology)