Mol Writer

class MolWriter[source]

Bases: object

A writer class for V3000 .mol files.

Examples

Writing to a File

import stk

bb1 = stk.BuildingBlock('BrCCBr', [stk.BromoFactory()])

writer = stk.MolWriter()
writer.write(molecule=bb1, path='bb1.mol')

Methods

to_string(molecule[, atom_ids])

Get a V3000 .mol file format string of molecule.

write(molecule, path[, atom_ids])

Write molecule to V3000 .mol file format.

to_string(molecule, atom_ids=None)[source]

Get a V3000 .mol file format string of molecule.

Parameters
  • molecule (Molecule) – Molecule to write to V3000 .mol format.

  • atom_ids (Union[int, Iterable[int], None]) – The atom ids of atoms to write. Can be a single int, if a single atom is to be used, or None, if all atoms are to be used.

Return type

str

Returns

String in V3000 .mol file format.

write(molecule, path, atom_ids=None)[source]

Write molecule to V3000 .mol file format.

Parameters
  • molecule (Molecule) – Molecule to write to V3000 .mol format.

  • path (str) – The full path to the file being written.

  • atom_ids (Union[int, Iterable[int], None]) – The atom ids of atoms to write. Can be a single int, if a single atom is to be used, or None, if all atoms are to be used.

Return type

None