Data Models (mofa.model)#

Data models for a MOF class

class mofa.model.LigandDescription(name: str | None = None, smiles: str | None = None, xyz: str | None = None, anchor_type: str | None = None, prompt_atoms: list[list[int]] | None = None, dummy_element: str | None = None, metadata: dict[str, int | float | str] = <factory>)#

Bases: object

Description of organic sections which connect inorganic nodes

anchor_constrained_optimization(xyz_tol=0.001, force_constant=10000.0, max_iterations=1000)#

optimize the ligand while the anchor atoms are constrained

Parameters:
  • xyz_tol – coordinate tolerance for constrained atoms

  • force_constant – the spring force constant to keep the constrained atoms in original position

  • max_iterations – maximum number of iterations for optimization

Returns:

inplace function, no return

anchor_type: str | None = None#

Name of the functional group used for anchoring

property atoms#
dummy_element: str = None#

Element used to represent the anchor group during assembly

classmethod from_yaml(path: Path) LigandDescription#

Load a ligand description from YAML

Parameters:

path – Path to the YAML file

Returns:

The ligand description

full_ligand_optimization(max_iterations=1000)#

optimize the ligand while the anchor atoms are constrained

Parameters:

max_iterations – maximum number of iterations for optimization

Returns:

inplace function, no return

metadata: dict[str, int | float | str]#

Any notable information about the molecule

name: str = None#

Unique name for the ligand

prompt_atoms: list[list[int]] | None = None#

Groups of atoms which attach to the nodes

There are typically two groups of fragment atoms, and these are never altered during MOF generation.

replace_with_dummy_atoms() Atoms#

Replace the fragments which attach to nodes with dummy atoms

Returns:

ASE atoms version of the molecule where the anchor atoms have been replaced with a single atom of the designated dummy type

smiles: str | None = None#

SMILES-format designation of the molecule

to_training_example() dict#

Render this ligand into the training format for DiffLinker

Returns:

Difflinker-format representation of the training example

xyz: str | None = None#

XYZ coordinates of all atoms in the linker including all Hs

class mofa.model.LigandTemplate(anchor_type: str, xyzs: tuple[str], dummy_element: str)#

Bases: object

Beginning of a new ligand to be generated.

Contains a prompt that includes both the anchor groups (i.e., those which connect to the node) and additional context atoms.

anchor_type: str#

Type of anchoring group

create_description(atom_types: list[str], coordinates: ndarray) LigandDescription#

Produce a ligand description given atomic coordinates which include the infilled atoms

Assumes the provided coordinates are of the backbone atom and do not include Hydrogens. Adds in the hydrogens from the original prompt and infers them for the new symbols

Parameters:
  • atom_types – Types of all atoms as chemical symbols

  • coordinates – Coordinates of all atoms

Returns:

Ligand description using the new coordinates

dummy_element: str#

Dummy element used to replace end group when assembling MOF

classmethod from_yaml(path: Path | str) LigandTemplate#

Load a template description from YAML

Parameters:

path – Path to the YAML file

Returns:

The ligand template

prepare_inputs() tuple[list[str], ndarray, ndarray | None]#

Produce the inputs needed for DiffLinker

Uses the prompts in xyzs without hte hydrogens

Returns:

  • List of chemical symbols

  • Array of atomic positions

  • Indices of the atom in each linker which connects to the rest of the molecule, if known

property prompts: list[Atoms]#

The prompt fragments as ASE objects

xyzs: tuple[str]#

XYZ coordinates of the prompt fragments.

Each XYZ must be arranged such that the first atom is the one which connects to the rest of the molecule, and the last set of atoms are those which are replaced with the dummy element.

class mofa.model.MOFRecord(name: str | None = None, identifiers: dict[str, str] = <factory>, topology: str | None = None, catenation: int | None = None, nodes: tuple[~mofa.model.NodeDescription, ...] = <factory>, ligands: tuple[~mofa.model.LigandDescription, ...] = <factory>, structure: str | None = None, md_trajectory: dict[str, list[tuple[int, str]]] = <factory>, gas_storage: dict[str, float | tuple[float, float]] = <factory>, structure_stability: dict[str, float] = <factory>, times: dict[str, ~datetime.datetime] = <factory>, in_progress: list[str] = <factory>)#

Bases: object

Information available about a certain MOF

property atoms: Atoms#

The structure as an ASE Atoms object

catenation: int | None = None#

Degree of catenation. 0 corresponds to no interpenetrating lattices

classmethod from_file(path: Path | str, read_kwargs: dict | None = None, **kwargs) MOFRecord#

Create a MOF description from a structure file on disk

The file will be read using ASE’s read function.

Keyword arguments can include identifiers of the MOF and will be passed to the constructor.

Parameters:
  • path – Path to the file

  • read_kwargs – Arguments passed to the read function

Returns:

A MOF record before fragmentation

gas_storage: dict[str, float | tuple[float, float]]#

Storage capacity of the MOF for different gases and pressures. Key is the name of the gas, value is a single capacity value or the capacity at different pressures (units g/L)

identifiers: dict[str, str]#

Names of this MOFs is registries (e.g., hMOF)

in_progress: list[str]#

Whether any assays are in progress

ligands: tuple[LigandDescription, ...]#

Description of each linker within the structure

md_trajectory: dict[str, list[tuple[int, str]]]#

Structures of the molecule produced during molecular dynamics simulations.

The key of the dictionary is the name of the method (e.g., forcefield) used for the molecular dynamics. The values are a list of pairs of the MD timestep and the structure at that timestep

name: str = None#

Name to be used for output files associated with this MOFs. Assumed to be unique

nodes: tuple[NodeDescription, ...]#

Description of the nodes within the structure

structure: str | None = None#

A representative 3D structure of the MOF in POSCAR format

structure_stability: dict[str, float]#

How likely the structure is to be stable according to different assays. The value is the strain between the first and last timestep. Larger values indicate worse stability

The strain for each assay should correspond to the strain from the longest trajectory in md_trajectory

times: dict[str, datetime]#

Listing times at which key events occurred

to_json(**kwargs) str#

Render the structure to a JSON string

Keyword arguments are passed to json.dumps()

Returns:

JSON-format version of the object

topology: str | None = None#

Description of the 3D network structure (e.g., pcu) as the topology

class mofa.model.NodeDescription(smiles: str, xyz: str | None = None)#

Bases: object

The inorganic components of a MOF

smiles: str#

SMILES-format description of the node

xyz: str | None = None#

XYZ coordinates of each atom in the node

Uses At or Fr as an identifier of the the anchor points where the linkers attach to the node - At designates a carbon-carbon bond anchor - Fr designates other types of linkages