BioSimSpace._SireWrappers.Molecule#

class BioSimSpace._SireWrappers.Molecule(molecule)[source]#

A container class for storing a molecule.

__init__(molecule)[source]#

Constructor.

Parameters:

molecule (Sire.Mol.Molecule, Molecule) – A Sire or BioSimSpace Molecule object.

Methods

__init__(molecule)

Constructor.

charge([property_map, is_lambda1])

Return the charge.

coordinates([property_map])

Return the coordinates of the atoms in the molecule.

copy()

Return a copy of this Molecule.

extract(indices[, renumber, property_map])

Extract atoms at the specified indices from the molecule to create a new molecule.

getAtoms()

Return a list containing the atoms in the molecule.

getAxisAlignedBoundingBox([property_map])

Get the axis-aligned bounding box enclosing the object.

getResidues()

Return a list containing the residues in the molecule.

isAmberWater([property_map])

Whether this is an AMBER format water molecule.

isGromacsWater([property_map])

Whether this is a GROMACS format water molecule.

isPerturbable()

Whether this molecule is perturbable, i.e. it can be used in a free-energy perturbation simulation.

isWater([property_map])

Whether this is a water molecule.

makeCompatibleWith(molecule[, property_map, ...])

Make this molecule compatible with passed one, i.e. match atoms and add all additional properties from the passed molecule while preserving the topology and naming/numbering convention of this molecule.

molecule0()

Return the component of the merged molecule at lambda = 0.

molecule1()

Return the component of the merged molecule at lambda = 1.

nAtoms()

Return the number of atoms in the molecule.

nChains()

Return the number of chains in the molecule.

nResidues()

Return the number of residues in the molecule.

number()

Return the number of the molecule.

repartitionHydrogenMass([factor, water, ...])

Redistrubute mass of heavy atoms connected to bonded hydrogens into the hydrogen atoms.

save(filebase)

Stream a wrapped Sire object to file.

search(query[, property_map])

Search the molecule for atoms and residues.

smiles()

Return the SMILES string representation of this object.

toSystem()

Convert a single Molecule to a System.

translate(vector[, property_map])

Translate each molecule in the container.

charge(property_map={}, is_lambda1=False)#

Return the 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 if the object is peturbable.

Returns:

charge – The charge.

Return type:

Charge

coordinates(property_map={})[source]#

Return the coordinates of the atoms in the molecule.

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:

[coordinates] – The coordinates of the atoms in the molecule.

Return type:

[class:Coordinate]

copy()[source]#

Return a copy of this Molecule.

Returns:

molecule – A copy of the object.

Return type:

Molecule

extract(indices, renumber=False, property_map={})[source]#

Extract atoms at the specified indices from the molecule to create a new molecule.

Parameters:
  • indices ([ int ]) – The indices of the atoms to extract.

  • renumber (bool) – Whether the returned molecule has the same number as the original.

  • 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:

molecule – The extracted molecule.

Return type:

Molecule

getAtoms()[source]#

Return a list containing the atoms in the molecule.

Returns:

atoms – The list of atoms in the molecule.

Return type:

[Atom]

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.

getResidues()[source]#

Return a list containing the residues in the molecule.

Returns:

residues – The list of residues in the molecule.

Return type:

[Residue]

isAmberWater(property_map={})[source]#

Whether this is an AMBER format water molecule.

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:

is_amber_water – Whether this molecule is an AMBER format water.

Return type:

bool

isGromacsWater(property_map={})[source]#

Whether this is a GROMACS format water molecule.

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

Returns:

is_gromacs_water – Whether this molecule is a GROMACS format water.

Return type:

bool

isPerturbable()[source]#

Whether this molecule is perturbable, i.e. it can be used in a free-energy perturbation simulation.

Returns:

is_perturbable – Whether the molecule is perturbable.

Return type:

bool

isWater(property_map={})[source]#

Whether this is a water molecule.

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:

is_water – Whether this is a water molecule.

Return type:

bool

makeCompatibleWith(molecule, property_map={}, overwrite=True, rename_atoms=False, verbose=False)[source]#

Make this molecule compatible with passed one, i.e. match atoms and add all additional properties from the passed molecule while preserving the topology and naming/numbering convention of this molecule.

Parameters:
  • molecule (Sire.Mol.Molecule, Molecule, Sire.System.System, System) – The molecule, or system of molecules, to match with.

  • property_map (dict) – A map between property names and user supplied names.

  • overwrite (bool) – Whether to overwrite any duplicate properties.

  • rename_atoms (bool) – Whether to rename atoms if they have changed.

  • verbose (bool) – Whether to report status updates to stdout.

molecule0()[source]#

Return the component of the merged molecule at lambda = 0.

Returns:

molecule – The component of the merged molecule at lambda = 0. Returns None if this isn’t a merged molecule.

Return type:

Molecule

molecule1()[source]#

Return the component of the merged molecule at lambda = 1.

Returns:

molecule – The component of the merged molecule at lambda = 1. Returns None if this isn’t a merged molecule.

Return type:

Molecule

nAtoms()[source]#

Return the number of atoms in the molecule.

Returns:

num_atoms – The number of atoms in the molecule.

Return type:

int

nChains()[source]#

Return the number of chains in the molecule.

Returns:

num_chains – The number of chains in the molecule.

Return type:

int

nResidues()[source]#

Return the number of residues in the molecule.

Returns:

num_residues – The number of residues in the molecule.

Return type:

int

number()[source]#

Return the number of the molecule. Each molecule has a unique identification number.

Returns:

mol_num – The unique number of the molecule.

Return type:

int

repartitionHydrogenMass(factor=4, water='no', use_coordinates=False, property_map={})[source]#

Redistrubute mass of heavy atoms connected to bonded hydrogens into the hydrogen atoms. This allows the use of larger simulation integration time steps without encountering instabilities related to high-frequency hydrogen motion.

Parameters:
  • factor (float) – The repartioning scale factor. Hydrogen masses are scaled by this amount.

  • water (str) – Whether to repartition masses for water molecules. Options are “yes”, “no”, and “exclusive”, which can be used to repartition masses for water molecules only.

  • use_coordinates (bool) – Whether to use the current molecular coordinates to work out the connectivity before repartitioning. If False, the information from the molecular topology, e.g. force field, will be used, if present.

  • 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” }

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, property_map={})[source]#

Search the molecule 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.

  • 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:

results – A list of objects matching the search query.

Return type:

[Atom, Residue, …]

Examples

Search for all residues named ALA.

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

Search for all oxygen or hydrogen atoms.

>>> result = molecule.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 a single Molecule to a System.

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” }