mol format#

Aliases#

mol, mol_file

Implementation: MolFormat

Overview#

MDL Molfile containing one molecular graph and its conformers.

RDKit is a collection of cheminformatics and machine-learning tools.

Reading and writing requires RDKit. Bond orders and formal charges are preserved through dpdata.BondOrderSystem rather than the regular System classes.

Quick examples#

The examples use the preferred alias mol; any alias listed above is equivalent.

import dpdata

# Molecular graph and conformers
bond_order_system = dpdata.BondOrderSystem("input_file", fmt="mol")

# Write molecular graph data
bond_order_system.to("mol", "output_path")

Conversions#

Convert from this format to BondOrderSystem#

dpdata.BondOrderSystem(file_name, fmt: Literal['mol'] = None, **kwargs) → dpdata.bond_order_system.BondOrderSystem
dpdata.BondOrderSystem(file_name, fmt: Literal['mol_file'] = None, **kwargs) → dpdata.bond_order_system.BondOrderSystem
dpdata.BondOrderSystem.from_mol(file_name, **kwargs) → dpdata.bond_order_system.BondOrderSystem
dpdata.BondOrderSystem.from_mol_file(file_name, **kwargs) → dpdata.bond_order_system.BondOrderSystem

Load an MDL Molfile as an RDKit molecule.

Parameters:
file_namestr or os.PathLike

Input .mol file.

**kwargsdict

Additional format arguments accepted for API compatibility.

Returns:
BondOrderSystem

converted system

Convert from BondOrderSystem to this format#

dpdata.BondOrderSystem.to(fmt: Literal['mol'], file_name, frame_idx=0, **kwargs)
dpdata.BondOrderSystem.to(fmt: Literal['mol_file'], file_name, frame_idx=0, **kwargs)
dpdata.BondOrderSystem.to_mol(file_name, frame_idx=0, **kwargs)
dpdata.BondOrderSystem.to_mol_file(file_name, frame_idx=0, **kwargs)

Write one conformer to an MDL Molfile.

Parameters:
file_namestr or os.PathLike

Destination .mol file.

frame_idxint, default=0

Conformer/frame index to write.

**kwargsdict

Additional format arguments accepted for API compatibility.