Skip to content

Commit

Permalink
De-duplicate the assemble function
Browse files Browse the repository at this point in the history
Whoops, forgot I had a whole 'assemble' module
  • Loading branch information
WardLT committed Oct 3, 2023
1 parent 56ddd1c commit deb5f6e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 36 deletions.
21 changes: 10 additions & 11 deletions mofa/assemble.py
Original file line number Diff line number Diff line change
@@ -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()
25 changes: 0 additions & 25 deletions mofa/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit deb5f6e

Please sign in to comment.