polymerist.mdtools.openfftools.topology ======================================= .. py:module:: polymerist.mdtools.openfftools.topology .. autoapi-nested-parse:: Utilities for serializing, converting, and extracting info from OpenFF topologies Attributes ---------- .. autoapisummary:: polymerist.mdtools.openfftools.topology.LOGGER Functions --------- .. autoapisummary:: polymerist.mdtools.openfftools.topology.get_largest_offmol polymerist.mdtools.openfftools.topology.copy_atom_metadata polymerist.mdtools.openfftools.topology.to_rdkit_with_metadata polymerist.mdtools.openfftools.topology.package_atom_metadata polymerist.mdtools.openfftools.topology.unpackage_atom_metadata polymerist.mdtools.openfftools.topology.save_molecule polymerist.mdtools.openfftools.topology.topology_to_sdf polymerist.mdtools.openfftools.topology.topology_from_sdf polymerist.mdtools.openfftools.topology.topology_from_molecule_onto_lattice Module Contents --------------- .. py:data:: LOGGER .. py:function:: get_largest_offmol(offtop: openff.toolkit.topology.Topology) -> openff.toolkit.topology.Molecule Return the largest molecule in a Topology .. py:function:: copy_atom_metadata(offatom: openff.toolkit.topology.Atom, rdatom: rdkit.Chem.rdchem.Atom, preserve_type: bool = True) -> None Copies all attributes from the metadata dict of an OpenFF-type Atom as Props of an RDKit-type atom .. py:function:: to_rdkit_with_metadata(offmol: openff.toolkit.topology.Molecule, preserve_type: bool = True) -> rdkit.Chem.rdchem.Mol Converts an OpenFF molecule to an RDKit molecule, preserving atomic metadata .. py:function:: package_atom_metadata(offmol: openff.toolkit.topology.Molecule) -> None Collect atom metadata into a serializable property of the parent Molecule .. py:function:: unpackage_atom_metadata(offmol: openff.toolkit.topology.Molecule) -> None Reassign atom metadata from a "packaged" metadata property dict belonging to the parent Molecule .. py:function:: save_molecule(path: pathlib.Path, offmol: openff.toolkit.topology.Molecule, toolkit_registry: openff.toolkit.ToolkitRegistry = GTR) -> None Syntactic sugar for annoying suffix re-specification when saving OpenFF Molecules .. py:function:: topology_to_sdf(path: pathlib.Path, offtop: openff.toolkit.topology.Topology, toolkit_registry: openff.toolkit.ToolkitRegistry = GTR) -> None Save an OpenFF Topology to an SDF file, preserving all atom metadata :Parameters: * **path** (*Path*) -- The path of the SDF file to save to * **offtop** (*Topology*) -- An OpenFF Topology * **toolkit_registry** (*ToolkitRegistry, default=GLOBAL_TOOLKIT_REGISTRY*) -- The toolkit registry to use for serializing each Molecule object within the Topology Defaults to the Global Toolkit Registry supplied by the OpenFF toolkit .. py:function:: topology_from_sdf(path: pathlib.Path, *args, **kwargs) -> openff.toolkit.topology.Topology Load an OpenFF Topology from an SDF file, assigning metadata and partial charges if stored :Parameters: * **path** (*Path*) -- The path of the SDF file to load * **\*args, \*\*kwargs** (*Any*) -- Additional positional arguments to pass to Molecule.from_file() :returns: An OpenFF Topology object containing the molecule(s) found in the SDF, each with its associated metadata and partial charges from the SDF bound :rtype: Topology .. py:function:: topology_from_molecule_onto_lattice(offmol: openff.toolkit.topology.Molecule, lattice_points: numpy.ndarray, rotate_randomly: bool = True, unique_mol_ids: bool = True) -> openff.toolkit.topology.Topology Copy and tile an OpenFF Molecule onto a set of specified lattice sites For each lattice site provided, a copy of the Molecule will be placed with its center of mass coincident to that site :Parameters: * **offmol** (*Molecule*) -- The OpenFF Molecule to tile onto the lattice * **lattice_points** (*np.ndarray*) -- An Nx3 array where each row is the xyz coordinate of a lattice site * **rotate_randomly** (*bool, default=True*) -- Whether to apply a random SO(3) rotation to each copy of the Molecule * **unique_mol_ids** (*bool, default=True*) -- Whether to assign unique IDs to each copy of the Molecule :returns: A Topology containing all tiled copies of the original molecule :rtype: Topology