sdf format#

Aliases#

sdf, sdf_file

Implementation: SdfFormat

Overview#

Structure-data file (SDF) containing one or more conformers.

RDKit provides cheminformatics capabilities for SDF reading and writing.

All records must describe the same molecular topology so they can be represented as conformers of one dpdata.BondOrderSystem. Reading and writing requires RDKit.

Quick examples#

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

import dpdata

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

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

Conversions#

Convert from this format to BondOrderSystem#

dpdata.BondOrderSystem(file_name, fmt: Literal['sdf'] = None, **kwargs) → dpdata.bond_order_system.BondOrderSystem
dpdata.BondOrderSystem(file_name, fmt: Literal['sdf_file'] = None, **kwargs) → dpdata.bond_order_system.BondOrderSystem
dpdata.BondOrderSystem.from_sdf(file_name, **kwargs) → dpdata.bond_order_system.BondOrderSystem
dpdata.BondOrderSystem.from_sdf_file(file_name, **kwargs) → dpdata.bond_order_system.BondOrderSystem

Load same-topology SDF records as one RDKit molecule.

Parameters:
file_namestr or os.PathLike

Input .sdf file. All records must share a topology.

**kwargsdict

Additional format arguments accepted for API compatibility.

Returns:
BondOrderSystem

converted system

Convert from BondOrderSystem to this format#

dpdata.BondOrderSystem.to(fmt: Literal['sdf'], file_name, frame_idx=-1, **kwargs)
dpdata.BondOrderSystem.to(fmt: Literal['sdf_file'], file_name, frame_idx=-1, **kwargs)
dpdata.BondOrderSystem.to_sdf(file_name, frame_idx=-1, **kwargs)
dpdata.BondOrderSystem.to_sdf_file(file_name, frame_idx=-1, **kwargs)

Write conformers to an SDF file.

Parameters:
file_namestr or os.PathLike

Destination .sdf file.

frame_idxint, default=-1

Conformer to write. -1 writes every conformer as a separate SDF record.

**kwargsdict

Additional format arguments accepted for API compatibility.