rush.mol

Provides data structures and helpers for molecular systems and structures:

  • Classes for Rush Topology, Residues, Chains, and TRC types.

  • Element types and bonds.

  • Fragment type to represent fragmented systems.

class rush.mol.Element(*values)[source]

Bases: IntEnum

Represents all relevant elements.

classmethod from_str(symbol)[source]

Parse element from string symbol.

Parameters:

symbol (str)

Return type:

Self

class rush.mol.AtomRef(value)[source]

Bases: object

Reference to an atom by index.

Parameters:

value (int)

class rush.mol.FragmentRef(value)[source]

Bases: object

Reference to a fragment by index.

Parameters:

value (int)

class rush.mol.ResidueRef(value)[source]

Bases: object

Reference to a residue by index.

Parameters:

value (int)

class rush.mol.ChainRef(value)[source]

Bases: object

Reference to a chain by index.

Parameters:

value (int)

class rush.mol.FormalCharge(charge)[source]

Bases: object

Formal charge of an atom.

Parameters:

charge (int)

charge: int
class rush.mol.PartialCharge(charge)[source]

Bases: object

Partial charge of an atom.

Parameters:

charge (float)

charge: float
class rush.mol.BondOrder(*values)[source]

Bases: IntEnum

Bond order enum.

class rush.mol.Bond(atom1, atom2, order)[source]

Bases: object

Bond between two atoms.

Parameters:
atom1: AtomRef
atom2: AtomRef
order: BondOrder
class rush.mol.Fragment(atoms=None)[source]

Bases: object

Fragment containing a list of atoms.

Parameters:

atoms (list[AtomRef] | list[int] | None)

class rush.mol.SchemaVersion(*values)[source]

Bases: Enum

Schema version for the topology format.

class rush.mol.Topology(schema_version=SchemaVersion.V2, symbols=<factory>, geometry=<factory>, labels=None, formal_charges=None, partial_charges=None, connectivity=None, velocities=None, fragments=None, fragment_formal_charges=None, fragment_partial_charges=None)[source]

Bases: object

Topology contains all atom information.

Parameters:
symbols: list[Element]
geometry: list[float]
labels: list[str] | None = None
formal_charges: list[FormalCharge] | None = None
partial_charges: list[PartialCharge] | None = None
connectivity: list[Bond] | None = None
velocities: list[float] | None = None
fragments: list[Fragment] | None = None
fragment_formal_charges: list[FormalCharge] | None = None
fragment_partial_charges: list[PartialCharge] | None = None
static from_json(json_content)[source]
Parameters:

json_content (str | Path | dict)

Return type:

Topology

to_json()[source]
Return type:

dict[str, object]

check()[source]

Validate the topology structure.

Return type:

None

distance_between_atoms(atom1, atom2)[source]

Calculate distance between two atoms.

Parameters:
Return type:

float

distance_to_point(atom, point)[source]

Calculate distance from atom to a point.

Parameters:
  • atom (AtomRef)

  • point (tuple[float, float, float])

Return type:

float

get_atoms_near_point(point, threshold, atom_indices=None)[source]

Get atom indices within threshold distance of a point.

Parameters:
  • point (tuple[float, float, float])

  • threshold (float)

  • atom_indices (list[int] | None)

Return type:

list[int]

get_fragments_near_fragment(frag_idx, threshold, atom_indices=None)[source]

Get fragment indices within threshold distance of another fragment.

Parameters:
  • frag_idx (int)

  • threshold (float)

  • atom_indices (list[int] | None)

Return type:

list[FragmentRef]

extend(other)[source]

Extend this topology with atoms from another topology.

Parameters:

other (Self)

Return type:

None

new_topology_from_residue_subset(residue_subset)[source]

Create a new topology containing only atoms from specified residues.

Parameters:

residue_subset (list[Residue])

Return type:

Topology

class rush.mol.AminoAcidSeq(*values)[source]

Bases: Enum

Amino acid sequence names.

classmethod is_amino_acid(residue_name)[source]

Check if a residue name is a known amino acid.

Parameters:

residue_name (str)

Return type:

bool

to_single_letter()[source]

Convert to single letter code.

Return type:

str

class rush.mol.Residue(atoms=None)[source]

Bases: object

A residue containing a list of atoms.

Parameters:

atoms (list[AtomRef] | list[int] | None)

contains(atom)[source]
Parameters:

atom (AtomRef)

Return type:

bool

class rush.mol.Residues(residues=<factory>, seqs=<factory>, seq_ns=<factory>, insertion_codes=<factory>, labeled=None, labels=None)[source]

Bases: object

Collection of residues with metadata.

Parameters:
  • residues (list[Residue])

  • seqs (list[str])

  • seq_ns (list[int])

  • insertion_codes (list[str])

  • labeled (list[ResidueRef] | None)

  • labels (list[list[str]] | None)

residues: list[Residue]
seqs: list[str]
seq_ns: list[int]
insertion_codes: list[str]
labeled: list[ResidueRef] | None = None
labels: list[list[str]] | None = None
static from_json(json_content)[source]
Parameters:

json_content (str | Path | dict)

Return type:

Residues

to_json()[source]
Return type:

dict[str, object]

check()[source]

Validate the residues structure.

Return type:

None

is_amino_acid(index)[source]

Check if residue at index is an amino acid.

Parameters:

index (int)

Return type:

bool

amino_acid_indices()[source]

Get indices of amino acid residues.

Return type:

list[int]

non_amino_acid_indices()[source]

Get indices of non-amino acid residues.

Return type:

list[int]

extend(other)[source]

Extend this residues collection with another.

Parameters:

other (Self)

Return type:

None

new_residues_from_subset(residue_refs)[source]

Create new residues collection from a subset of residue references.

Parameters:

residue_refs (list[ResidueRef])

Return type:

Residues

class rush.mol.Chain(residues=None)[source]

Bases: object

A chain containing a list of residues.

Parameters:

residues (list[ResidueRef] | list[int] | None)

contains(residue)[source]
Parameters:

residue (ResidueRef)

Return type:

bool

class rush.mol.Chains(chains=<factory>, alpha_helices=None, beta_sheets=None, labeled=None, labels=None)[source]

Bases: object

Collection of chains with secondary structure information.

Parameters:
chains: list[Chain]
alpha_helices: list[ResidueRef] | None = None
beta_sheets: list[ResidueRef] | None = None
labeled: list[ChainRef] | None = None
labels: list[list[str]] | None = None
static from_json(json_content)[source]
Parameters:

json_content (str | Path | dict)

Return type:

Chains

to_json()[source]
Return type:

dict[str, object]

check()[source]

Validate the chains structure.

Return type:

None

extend(other)[source]

Extend this chains collection with another.

Parameters:

other (Self)

Return type:

None

new_chains_from_residue_subset(residue_refs)[source]

Create new chains collection from a subset of residue references.

Parameters:

residue_refs (list[ResidueRef])

Return type:

Chains

class rush.mol.TRC(topology=<factory>, residues=<factory>, chains=<factory>)[source]

Bases: object

Combined Topology, Residues, and Chains structure. This is the main structure for representing molecular systems on the Rush platform.

Parameters:
topology: Topology
residues: Residues
chains: Chains
check()[source]

Validate the entire TRC structure.

Return type:

None

extend(other)[source]

Extend this TRC with another TRC.

Parameters:

other (Self)

Return type:

None

new_trc_from_residue_subset(residue_refs)[source]

Create new TRC from a subset of residue references.

Parameters:

residue_refs (list[ResidueRef])

Return type:

TRC

class rush.mol.ResidueId(chain_id, sequence_number, insertion_code, residue_name)[source]

Bases: object

Unique identifier for a residue.

Parameters:
  • chain_id (str)

  • sequence_number (int)

  • insertion_code (str)

  • residue_name (str)

chain_id: str
sequence_number: int
insertion_code: str
residue_name: str