stream_molecules_to_file
- openff.nagl.toolkits.openff.stream_molecules_to_file(file: str, toolkit_registry=NAGL_TOOLKIT_REGISTRY)[source]
Stream molecules to an SDF file using a context manager.
- Parameters:
file (
str
) – The path to the SDF file to stream molecules to.toolkit_registry – The toolkit registry to use to write the molecules.
Examples
>>> from openff.toolkit.topology import Molecule >>> from openff.toolkit.utils.openff import stream_molecules_to_file >>> molecule1 = Molecule.from_smiles("CCO") >>> molecule2 = Molecule.from_smiles("CCC") >>> with stream_molecules_to_file("molecules.sdf") as writer: ... writer(molecule1) ... writer(molecule2)