BioSimSpace._SireWrappers.Molecules

class BioSimSpace._SireWrappers.Molecules(molecules)[source]

An immutable container class for storing molecules.

__init__(molecules)[source]

Constructor.

Parameters:

molecules (Sire.Mol.MoleculeGroup, Sire.System.System, Sire.Mol.SelectorMol, System, [Molecule]) – A Sire Molecues object, a Sire or BioSimSpace System object, or a list of BioSimSpace Molecule objects.

Methods

__init__(molecules)

Constructor.

charge([property_map, is_lambda1])

Return the total molecular charge.

copy()

Return a copy of this object.

getAxisAlignedBoundingBox([property_map])

Get the axis-aligned bounding box enclosing the object.

getMolecule(index)

Return the molecule at the given index.

nMolecules()

Return the number of molecules in the system.

save(filebase)

Stream a wrapped Sire object to file.

search(query)

Search the molecules for atoms and residues.

smiles()

Return the SMILES string representation of this object.

toSystem()

Convert to a System object.

translate(vector[, property_map])

Translate each molecule in the container.

charge(property_map={}, is_lambda1=False)[source]

Return the total molecular charge.

Parameters:
  • property_map (dict) – A dictionary that maps system “properties” to their user defined values. This allows the user to refer to properties with their own naming scheme, e.g. { “charge” : “my-charge” }

  • is_lambda1 (bool) – Whether to use the charge at lambda = 1 a molecule is merged.

Returns:

charge – The molecular charge.

Return type:

Charge

copy()

Return a copy of this object. The return type is same as the object on which copy is called.

Returns:

object – A copy of the object.

Return type:

Atom, Residue, Molecule, Molecules, System

getAxisAlignedBoundingBox(property_map={})

Get the axis-aligned bounding box enclosing the object.

Parameters:

property_map (dict) – A dictionary that maps system “properties” to their user defined values. This allows the user to refer to properties with their own naming scheme, e.g. { “charge” : “my-charge” }

Returns:

  • box_min ([Length]) – The minimum coordinates of the axis-aligned bounding box in each dimension.

  • box_max ([Length]) – The minimum coordinates of the axis-aligned bounding box in each dimension.

getMolecule(index)[source]

Return the molecule at the given index.

Parameters:

index (int) – The index of the molecule.

Returns:

molecule – The requested molecule.

Return type:

Molecule

nMolecules()[source]

Return the number of molecules in the system.

Returns:

num_molecules – The number of molecules in the system.

Return type:

int

save(filebase)

Stream a wrapped Sire object to file.

Parameters:
  • sire_object (System) – A wrapped Sire object.

  • filebase (str) – The base name of the binary output file.

search(query)[source]

Search the molecules for atoms and residues. Search results will be reduced to their minimal representation, i.e. a residue containing a single atom will be returned as a atom.

Parameters:

query (str) – The search query.

Returns:

results – A list of objects matching the search query.

Return type:

[Atom, Residue, …]

Examples

Search for all residues named ALA.

>>> result = molecules.search("resname ALA")

Search for all oxygen or hydrogen atoms.

>>> result = molecules.search("element oxygen or element hydrogen")

Search for atom index 23.

>>> result = molecule.search("atomidx 23")
smiles()

Return the SMILES string representation of this object.

Returns:

smiles – The SMILES string representation of the object(s).

Return type:

str, [str]

toSystem()[source]

Convert to a System object.

Returns:

system

Return type:

System

translate(vector, property_map={})[source]

Translate each molecule in the container.

Parameters:
  • vector ([Length]) – The translation vector in Angstroms.

  • property_map (dict) – A dictionary that maps system “properties” to their user defined values. This allows the user to refer to properties with their own naming scheme, e.g. { “charge” : “my-charge” }