smores.Molecule#

class smores.Molecule(atoms, positions, dummy_index, attached_index, excluded_indices=None, radii=None)[source]#

Bases: object

Calculates StericParameters from STREUSEL radii.

See also

  • EspMolecule: For calculating steric parameters from electrostatic potentials.

Examples

Calculate steric parameters

>>> import smores
>>> molecule = smores.Molecule.from_smiles("Cl", dummy_index=0, attached_index=1)
>>> molecule.get_steric_parameters()
StericParameters(L=3.57164113574581, B1=1.9730970556668774, B5=2.320611610648539)

Tip

There are many different way to initialize a Molecule, for example from_mol_file() or from_xyz_file(). See the list of methods below.

Use custom atomic radii

If we want to use custom atomic radii, we can simply make use of the radii parameter, where we provide the desired radius of each atom

>>> import smores
>>> molecule = smores.Molecule.from_smiles("Cl", dummy_index=0, attached_index=1, radii=[1.75, 1.2])
>>> molecule.get_steric_parameters()
StericParameters(L=3.57164113574581, B1=1.9730970556668774, B5=2.320611610648539)

Initialize a Molecule.

Parameters:
  • atoms (list[str]) – The elemental symbol of each atom of the molecule.

  • positions (list[list[float]]) – The coordinates of each atom of the molecule, provided as an N x 3 matrix.

  • dummy_index (int) – The index of the dummy atom.

  • attached_index (int) – The index of the attached atom of the substituent.

  • excluded_indices (list[int]) – The indices of atoms which are not included in the parameter calculation.

  • radii (list[float]) – The radius of each atom of the molecule. If None the STREUSEL radii will be used.

Methods

from_combination

Get a molecule from a Combination.

from_mol_file

Get a molecule from a .mol file.

from_rdkit

Get a molecule from an rdkit molecule.

from_smiles

Get a molecule from a SMILES string.

from_xyz_file

Get a molecule from a .xyz file.

get_attached_index

Get the index of the atom attached to the substituent.

get_dummy_index

Get the index of the dummy atom.

get_excluded_indices

Yield indices of atoms excluded from the parameter calculation.

get_steric_parameters

Get the steric paramters from STREUSEL radii.

classmethod from_combination(combination, radii=None)[source]#

Get a molecule from a Combination.

The molecule will automatically use the dummy and attached index defined in combination and set all the core_indices as excluded indices.

Parameters:
  • combination (Combination) – A combination of a core and substituent molecule.

  • radii (list[float]) – The radius of each atom of the molecule. If None the STREUSEL radii will be used.

Returns:

The molecule.

Return type:

Molecule

classmethod from_mol_file(path, dummy_index, attached_index, excluded_indices=None, radii=None)[source]#

Get a molecule from a .mol file.

Parameters:
  • path (Path | str) – The path to the file.

  • dummy_index (int) – The index of the dummy atom.

  • attached_index (int) – The index of the attached atom of the substituent.

  • excluded_indices (list[int]) – The indices of atoms which are not included in the parameter calculation.

  • radii (list[float]) – The radius of each atom of the molecule. If None the STREUSEL radii will be used.

Returns:

The molecule.

Return type:

Molecule

classmethod from_rdkit(molecule, dummy_index, attached_index, excluded_indices=None, radii=None, conformer_id=0)[source]#

Get a molecule from an rdkit molecule.

Parameters:
  • molecule (Mol) – The rdkit molecule. It must have at least one conformer.

  • dummy_index (int) – The index of the dummy atom.

  • attached_index (int) – The index of the attached atom of the substituent.

  • excluded_indices (list[int]) – The indices of atoms which are not included in the parameter calculation.

  • radii (list[float]) – The radius of each atom of the molecule. If None the STREUSEL radii will be used.

  • conformer_id (int) – The id of the conformer to use.

Returns:

The smores molecule.

Return type:

Molecule

classmethod from_smiles(smiles, dummy_index, attached_index, excluded_indices=None, positions=None, radii=None)[source]#

Get a molecule from a SMILES string.

Parameters:
  • smiles (str) – The SMILES of the molecule.

  • dummy_index (int) – The index of the dummy atom.

  • attached_index (int) – The index of the attached atom of the substituent.

  • excluded_indices (list[int]) – The indices of atoms which are not included in the parameter calculation.

  • positions (list[list[float]]) – The coordinates of each atom of the molecule provided as an N x 3 matrix. If None then the molecule will have its coordinates calculated with ETKDG.

  • radii (list[float]) – The radius of each atom of the molecule. If None the STREUSEL radii will be used.

Returns:

The molecule.

Return type:

Molecule

classmethod from_xyz_file(path, dummy_index, attached_index, excluded_indices=None, radii=None)[source]#

Get a molecule from a .xyz file.

Parameters:
  • path (Path | str) – The path to the file.

  • dummy_index (int) – The index of the dummy atom.

  • attached_index (int) – The index of the attached atom of the substituent.

  • excluded_indices (list[int]) – The indices of atoms which are not included in the parameter calculation.

  • radii (list[float]) – The radius of each atom of the molecule. If None the STREUSEL radii will be used.

Returns:

The molecule.

Return type:

Molecule

get_attached_index()[source]#

Get the index of the atom attached to the substituent.

Returns:

The index of the atom attached to the substituent.

Return type:

int

get_dummy_index()[source]#

Get the index of the dummy atom.

Returns:

The index of the dummy atom.

Return type:

int

get_excluded_indices()[source]#

Yield indices of atoms excluded from the parameter calculation.

Yields:

The index of an excluded atom.

Return type:

Iterable[int]

get_steric_parameters()[source]#

Get the steric paramters from STREUSEL radii.

Returns:

The parameters.

Return type:

StericParameters