schrodinger.application.matsci.swap_fragments_utils module¶
Utilities for swapping fragments to create a structure built from specified parts of two other structures.
Copyright Schrodinger, LLC. All rights reserved.
- exception schrodinger.application.matsci.swap_fragments_utils.SwapFragmentsException¶
Bases:
Exception
- schrodinger.application.matsci.swap_fragments_utils.get_idx_groups_str(idx_groups)¶
Get a string representation of the given index groups.
- Parameters
idx_groups (list) – contains lists of indices
- Return type
str
- Returns
the string
- schrodinger.application.matsci.swap_fragments_utils.get_idxs_marked_atoms(st, prop)¶
Return a list of indices of atoms in the given structure that have the given property defined.
- Parameters
st (schrodinger.structure.Structure) – the structure
prop (str) – the property that marks the atoms
- Return type
list
- Returns
contains indices of atoms
- schrodinger.application.matsci.swap_fragments_utils.get_idx_groups(text)¶
Get index groups from the given string.
- Parameters
text (str) – the string
- Raises
SwapFragmentsException – if there is an issue
- Return type
list
- Returns
contains list of indices
- schrodinger.application.matsci.swap_fragments_utils.get_keep_idxs(st)¶
Return a list of indices of keep atoms in the given structure.
- Parameters
st (schrodinger.structure.Structure) – the structure
- Return type
list
- Returns
contains indices of keep atoms
- schrodinger.application.matsci.swap_fragments_utils.get_superposition_idxs(st)¶
Return a list of indices of superposition atoms in the given structure.
- Parameters
st (schrodinger.structure.Structure) – the structure
- Return type
list
- Returns
contains indices of superposition atoms
- schrodinger.application.matsci.swap_fragments_utils.get_extracted_and_maps(st, idxs)¶
Extract and return a structure from the given indices as well as old-to-new and new-to-old atom index maps.
- Parameters
st (schrodinger.structure.Structure) – the structure
idxs (list) – the indices
- Return type
schrodinger.structure.Structure, dict, dict
- Returns
the extracted structure and old-to-new and new-to-old index maps
- schrodinger.application.matsci.swap_fragments_utils.get_cut_bonds(st, keep_idxs)¶
Return a list of (keep, replace, order) tuples, where keep is an index that will be kept, replace is an index that will be replaced, and order is the bond order, for bonds involving atoms specified in the given keep indices.
- Parameters
st (schrodinger.structure.Structure) – the structure
keep_idxs (list) – the keep indices
- Return type
list
- Returns
contains (keep, replace, order) tuples
- schrodinger.application.matsci.swap_fragments_utils.get_closest_atom(ref_st, ref_idx, nov_cell)¶
Return the novel atom index closest to the given reference atom index.
- Parameters
ref_st (schrodinger.structure.Structure) – second structure, called reference
ref_idx (int) – the reference index
nov_cell (infrastructure.DistanceCell) – distance cell for the novel structure
- Return type
int or None
- Returns
the novel index if there is one
- schrodinger.application.matsci.swap_fragments_utils.get_ref_nov_close_pairs(nov_st, ref_st)¶
Return a map of reference to novel close atoms.
- Parameters
nov_st (schrodinger.structure.Structure) – first structure, called novel
ref_st (schrodinger.structure.Structure) – second structure, called reference
- Return type
dict
- Returns
a map of reference to novel close atoms
- schrodinger.application.matsci.swap_fragments_utils.get_assembled_structure(nov_st, ref_st, nov_superposition_idxs, ref_superposition_idxs, nov_keep_idxs, ref_keep_idxs, title=None, require_identical_bonds=True)¶
Return an assembled structure from the given structures using superposition followed by extraction.
- Parameters
nov_st (schrodinger.structure.Structure) – first structure, called novel
ref_st (schrodinger.structure.Structure) – second structure, called reference
nov_superposition_idxs (list) – novel superposition indices
ref_superposition_idxs (list) – reference superposition indices
nov_keep_idxs (list) – novel keep indices
ref_keep_idxs (list) – reference keep indices
title (str) – the title to be given to the assembled structure
require_identical_bonds (bool) – whether to require that bonds to be created must exist in both novel and reference structures and be of the same bond order
- Raises
SwapFragmentsException – if there is an issue
- Return type
- Returns
the assembled structure
- schrodinger.application.matsci.swap_fragments_utils.get_idxs_str(idxs, sort=True)¶
Get a string representation of the given indices.
- Parameters
idxs (list) – the idxs
sort (bool) – whether to sort
- Return type
str
- Returns
the string
- schrodinger.application.matsci.swap_fragments_utils.get_idxs(le)¶
Get indices from the given QLineEdit.
- Parameters
le (QtWidgets.QLineEdit) – the line edit
- Return type
list
- Returns
the indices