luna.interaction.type module

class InteractionType(src_grp, trgt_grp, inter_type, src_interacting_atms=None, trgt_interacting_atms=None, src_centroid=None, trgt_centroid=None, directional=False, params=None)[source]

Bases: object

Define an interaction type.

Parameters
  • src_grp (AtomGroup) – The interaction’s first atom or atom group. For directional interactions such as hydrogen bonds, src_grp represents donor atoms and atom groups that act as nucleophiles, i.e., from where the interaction “comes from”.

  • trgt_grp (AtomGroup) – The interaction’s second atom or atom group. For directional interactions such as hydrogen bonds, trgt_grp represents acceptor atoms and atom groups that act as electrophiles, i.e., the interaction “receiver”.

  • inter_type (str) – The interaction type.

  • src_interacting_atms (iterable of ExtendedAtom, optional) – If provided, represent the set of atoms from src_grp that in fact participate in the interaction. For example, in hydrophobic islands, not all of their atoms are in direct contact with another hydrophobic surface.

  • trgt_interacting_atms (iterable of ExtendedAtom, optional) – If provided, represent the set of atoms from trgt_grp that in fact participate in the interaction. For example, in hydrophobic islands, not all of their atoms are in direct contact with another hydrophobic surface.

  • src_centroid (array_like of float (size 3), optional) – Atomic coordinates (x, y, z) of the centroid of src_grp. If not provided, it will be calculated automatically from src_grp or src_interacting_atms.

  • trgt_centroid (array_like of float (size 3), optional) – Atomic coordinates (x, y, z) of the centroid of trgt_grp. If not provided, it will be calculated automatically from trgt_grp or trgt_interacting_atms.

  • directional (bool) – Indicate if the interaction has a direction as in hydrogen bonds and multipolar interactions.

  • params (dict, optional) – Interaction parameters (distances, angles, etc).

as_json()[source]

Represent this interaction as a dict containing the interaction type, flags indicating if its directional or not and if it is an intra- or intermolecular interaction, its default color for visual representations, and information related to each involved atom group.

The dict is defined as follows:
  • type (str): the interaction type;

  • is_directional (bool`): if it is a directional interaction;

  • is_intramol_interaction (bool`): if it is an intramolecular interaction;

  • is_intermol_interaction (bool`): if it is an intermolecular interaction;

  • color (str): the default interaction hex color for visual representations;

  • src_grp (dict): information related to the interaction’s first atom or atom group. The dict structure is defined in luna.mol.groups.AtomGroup.as_json(). Additional keys:

    • add_pseudo_group (bool): if True, it means a pseudo-atom (centroid) should represent src_grp as it comprises multiple atoms.

    • centroid (list of float): the atomic coordinates (x, y, z) of the centroid of src_grp

    • show_centroid (str): if the centroid should be shown or not. It will be False only for nucleophiles and electrophiles.

  • trgt_grp (dict): information related to the interaction’s second atom or atom group. The dict structure is defined in luna.mol.groups.AtomGroup.as_json(). Additional keys:

    • add_pseudo_group (bool): if True, it means a pseudo-atom (centroid) should represent trgt_grp as it comprises multiple atoms.

    • centroid (list of float): the atomic coordinates (x, y, z) of the centroid of trgt_grp

    • show_centroid (str): if the centroid should be shown or not. It will be False only for nucleophiles and electrophiles.

clear_refs()[source]

References to this InteractionType instance will be removed from the list of interactions of src_grp and trgt_grp.

get_partner(comp)[source]

Get the partner atom group that forms this interaction with comp. Return None if comp is neither the src_grp nor trgt_grp.

Parameters

comp (AtomGroup) – Get the partner of this atom group.

Return type

AtomGroup or None

is_directional()[source]

Indicate if the interaction has a direction as in hydrogen bonds and multipolar interactions.

Return type

bool

is_intermol_interaction()[source]

Indicate if the interaction involves atoms from different molecules.

Return type

bool

is_intramol_interaction()[source]

Indicate if the interaction involves atoms from the same molecule.

Return type

bool

property params

Interaction parameters (distances, angles, etc).

Type

dict

property required_interactions

If this interaction depends on other interactions, then return them as a list. Currently, by default, only water-bridged hydrogen bonds and salt bridges have a dependency on other interactions. The first, depends on two or more hydrogen bonds, while the second depends on an ionic and a hydrogen bond.

Type

list of InteractionType

property src_centroid

Atomic coordinates (x, y, z) of the centroid of src_grp. If it is not provided during the initialization of this class, then it will be calculated automatically from src_grp or src_interacting_atms.

Type

array_like of float (size 3)

property src_grp

The interaction’s first atom or atom group.

Type

AtomGroup

property src_interacting_atms

The set of atoms from src_grp that in fact participate in the interaction. If a sequence of atoms is not provided during the initialization of this class, then all atoms from src_grp are returned.

Type

iterable of ExtendedAtom

property trgt_centroid

Atomic coordinates (x, y, z) of the centroid of trgt_grp. If it is not provided during the initialization of this class, then it will be calculated automatically from trgt_grp or trgt_interacting_atms.

Type

array_like of float (size 3)

property trgt_grp

The interaction’s second atom or atom group.

Type

AtomGroup

property trgt_interacting_atms

The set of atoms from trgt_grp that in fact participate in the interaction. If a sequence of atoms is not provided during the initialization of this class, then all atoms from trgt_grp are returned.

Type

iterable of ExtendedAtom

property type

The interaction type.

Type

str