schrodinger.application.matsci.swap_fragments_utils module

Utilities for swapping fragments.

Copyright Schrodinger, LLC. All rights reserved.

exception schrodinger.application.matsci.swap_fragments_utils.SwapFragmentsException[source]

Bases: Exception

__init__(*args, **kwargs)
args
with_traceback()

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

schrodinger.application.matsci.swap_fragments_utils.get_idx_groups_str(idx_groups)[source]

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)[source]

Return a list of indices of atoms in the given structure that have the given property defined.

Parameters
Return type

list

Returns

contains indices of atoms

schrodinger.application.matsci.swap_fragments_utils.get_idx_groups(text)[source]

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)[source]

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)[source]

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)[source]

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)[source]

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)[source]

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

Parameters
Return type

int

Returns

the reference index

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)[source]

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)[source]

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)[source]

Get indices from the given QLineEdit.

Parameters

le (QtWidgets.QLineEdit) – the line edit

Return type

list

Returns

the indices