From deb5f6ebc1e70345b98e3e62f7039fb2361593c2 Mon Sep 17 00:00:00 2001 From: Logan Ward Date: Tue, 3 Oct 2023 16:31:48 -0400 Subject: [PATCH] De-duplicate the assemble function Whoops, forgot I had a whole 'assemble' module --- mofa/assemble.py | 21 ++++++++++----------- mofa/model.py | 25 ------------------------- 2 files changed, 10 insertions(+), 36 deletions(-) diff --git a/mofa/assemble.py b/mofa/assemble.py index 0ab61eac..25e7bf33 100644 --- a/mofa/assemble.py +++ b/mofa/assemble.py @@ -1,19 +1,18 @@ """Functions for assembling a MOF structure""" -import ase +from typing import Sequence +from .model import NodeDescription, LigandDescription, MOFRecord -def assemble_mof( - node: object, - linker: str, - topology: object -) -> ase.Atoms: - """Generate a MOF structure from a recipe + +def assemble_mof(nodes: Sequence[NodeDescription], ligands: Sequence[LigandDescription], topology: str) -> MOFRecord: + """Generate a new MOF from the description of the nodes, ligands and toplogy Args: - node: Atomic structure of the nodes - linker: SMILES string defining the linker object - topology: Description of the network structure + nodes: Descriptions of each node + ligands: Description of the ligands + topology: Name of the topology + Returns: - Description of the 3D structure of the MOF + A new MOF record """ raise NotImplementedError() diff --git a/mofa/model.py b/mofa/model.py index 3da4badd..68f0876d 100644 --- a/mofa/model.py +++ b/mofa/model.py @@ -102,32 +102,7 @@ def from_file(cls, cif_path: Path | str, **kwargs) -> 'MOFRecord': return MOFRecord(structure=Path(cif_path).read_text(), **kwargs) - def replace_ligand(self, new_ligand: ase.Atoms) -> 'MOFRecord': - """Create a new MOF by replacing the ligands in this MOF with new - - Args: - new_ligand: - - Returns: - - """ - return assemble_mof(self.nodes, [new_ligand], self.topology) - @cached_property def atoms(self) -> ase.Atoms: """The structure as an ASE Atoms object""" return next(read_cif(StringIO(self.structure), index=slice(None))) - - -def assemble_mof(nodes: Sequence[NodeDescription], ligands: Sequence[LigandDescription], topology: str) -> MOFRecord: - """Generate a new MOF from the description of the nodes, ligands and toplogy - - Args: - nodes: Descriptions of each node - ligands: Description of the ligands - topology: Name of the topology - - Returns: - A new MOF record - """ - raise NotImplementedError()