draw_molecule

cleanup_via_smiles(mol: Mol) Mol[source]

Convert a molecule to a smiles string and back to a molecule to clean it up for drawing.

Parameters:

mol (Chem.Mol) – RDKit molecule object

Returns:

Cleaned up RDKit molecule object

Return type:

Chem.Mol

cleanup_xyz(path: Path) str[source]

Read an xyz file and return a cleaned up version of it which rdkit can handle.

Parameters:

path (Path) – Path to the xyz file

Returns:

Cleaned up xyz block

Return type:

str

draw_molecule(mol: Mol, width: int, height: int) str[source]

Draw a molecule to an SVG image.

Parameters:
  • mol (Chem.Mol) – RDKit molecule object

  • width (int) – Width of the image

  • height (int) – Height of the image

Returns:

SVG image

Return type:

str

load_molecule(path: Path) Mol[source]

Load a molecule from a .xyz or .sdf file.

In case of xyz files the bond orders are tried to be determined automatically.

Parameters:

path (Path) – Path to the file

Returns:

RDKit molecule object

Return type:

Chem.Mol

parse_args(args: list) Namespace[source]

Parse command line arguments.

set_general_options() None[source]

Set general options for the RDKit.

Currently just a stub for setting the preferCoordGen option and might be later expanded.

write_file(svg: str, path: Path) None[source]

Write an SVG image to a file.

Parameters:
  • svg (str) – SVG image

  • path (Path) – Path to the output file