schrodinger.application.matsci.swap_fragments_utils module

Utilities for swapping fragments.

Copyright Schrodinger, LLC. All rights reserved.

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:
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:
Return type:

list

Returns:

contains (keep, replace, order) tuples

schrodinger.application.matsci.swap_fragments_utils.get_closest_atom(nov_st, ref_st, nov_idx, ref_cell)

Return the reference atom index closest to the given novel atom index.

Parameters:
Return type:

int

Returns:

the reference index

exception schrodinger.application.matsci.swap_fragments_utils.SwapFragmentsException

Bases: Exception

__init__

Initialize self. See help(type(self)) for accurate signature.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

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:

schrodinger.structure.Structure

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