A Python tool to deconstruct MOFs into building units and compute porosity. The code removes guests from MOFs and all porous systems, computes SMILES strings and InChIKeys of all building units.
Project description
mofstructure
This is an elaborate python module that provides simple functions for manipulation metal-organic frameworks and other porous systems such as COFs and Zeolites. Some uses of the module involves
-
Computation of geometric properties of MOFs. It calls zeo++ in the background and enables a quick computation of all porosity information such pld, lcd, asa ...
-
Automated removal of unbound guest molecules
-
Deconstruction of metal-organic frameworks into building units. And for each buidling units (organic ligand, metal cluster, organic sbu and metal sbu) computes their cheminformatic identifiers such as SMILES strings, inchi and inchikey. It also identify the type of metal sbu and coordination number of central metal.
-
Wraps systems around unit cell so as to remove effect of pbc. This is often the case, when one tries to visualize the cif files or convert cif files into xyz, the system often appears to be uncoordinated
-
Seperation of building units into regions. This is essential when on wishes to subsitute a specific ligand or building unit.
Installation
Option 1
pip install mofstructure
Option 2
git clone https://github.com/bafgreat/mofstructure.git mofstructure
cd mofstructure
pip install .
Quick start
Run on the commandline
Building units
Simply run the following command on a cif file or any ase readable file format containing a MOF.
mofstructure cif_file
The script will deconstruct the MOF present in the cif file and load the output in a folder called 'MOF_building_units' in the current directory/folder. If you wish to load the output in a specific folder, simply add the path to the folder as follows:
mofstructure cif_file path_to_result_folder
For multiple cif files. Simply run a loop and all the Results will be saved in the
for cifs in ciffiles:
mofstructure cifs path_to_result
Creating a database
If you have a folder containg many cif files for different MOF, you could easily create a database. To create such a database, simply run the following command.
mofstructure_database ciffolder
Here the 'ciffolder' is the folder containing the cif files. The ouput will be saved in the default folder called 'MOFDb' in the current folder. Again you can choose the path to the save folder by simply listing it at the end of the command.
mofstructure_database ciffolder path_to_result
Use as a libray
from mofstructure import mofdeconstructor
from mofstructure import porosity
from mofstructure import buildingunits
from ase.io import read, write
import pandas as pd
# Read cif file using ase
ase_atom = read(cif_file)
# check and remove unbound guest molecules
no_guest_indices = mofdeconstructor.remove_unbound_guest(ase_atom)
no_guest_atom = ase_atom[no_guest_indices]
# compute porosit and write output to csv
pores = porosity.zeo_calculation(ase_ato, probe_radius=1.86, number_of_steps=5000)
df = pd.DataFrame(pores, index=[0])
df.to_csv('pore.csv')
sbus and linkers
Compute sbus and linkers
connected_components, atoms_indices_at_breaking_point, porpyrin_checker, all_regions = MOF_deconstructor.secondary_building_units(ase_atom)
metal_sbus, organic_sbus, building_unit_regions = MOF_deconstructor.find_unique_building_units(
connected_components,
atoms_indices_at_breaking_point,
ase_atom,
porpyrin_checker,
all_regions,
cheminfo=True
)
when cheminfo = True
openbabel is called to compute all chemifomatic information, which are all stored on the ase_atom.info metal_sbus and organic_sbus list that contains all the unique instances of the metal sbus and organic sbus.
extracting cheminfor
For each instance in a building unit the various chemiformatic informations are as follows.
for i, sbu in enumerate(metal_sbu):
smi = sbu.info['smi']
inchi = sbu.info['inchi']
inchikey = sbu.info['inchikey]
# for sbus only
number_of_point_of_extension = sbu.info['point_of_extension']
#for metal sbus only
sbu_type = sbu.info['sbu_type'] # sbu_type :rodlike, irmof, uoi66, paddlewheel e.t.c
# write
sbu.write('metal_sbu_'+str(i)+'.cif')
Summary
All of above codes can be run by a single function found mofstructure.buildingunits
for a single cif file
from mofstructure import buildingunits
buildingunits.work_flow(ciffile, result_folder)
for multiple cif files
from mofstructure import buildingunits
import glob
all_cifs = glob.glob(folder/*cif)
# folder corresponds to the folder containing all the cif files
for cif_files in all_cifs:
buildingunits.work_flow(cif_files, result_folder)
# Note that result_folder can be any path. If the path does not exist, it will create one and populate it with all the data.
Documentation
You can access the full project documentation on docs
Roadmap
In the future the code should be able to:
- Compute rcsr topological code
- Subsitutue building units in a MOF to enable framework functionalisation
- Automatic curation of cifs
- Decontsruction of COFs into their building units
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mofstructure-0.1.8.2.tar.gz
.
File metadata
- Download URL: mofstructure-0.1.8.2.tar.gz
- Upload date:
- Size: 34.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.9.15 Darwin/22.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 477d90a172f33172886f33b4400bfa9e2c58b4a3bf4ebaf3b4b5dba052da15fa |
|
MD5 | cb226f9222fc9b4e8ac2ca9902fed6eb |
|
BLAKE2b-256 | 9429bc6ed4961235dc93f0e4eafa10c39f23cbdf10f8dff80d4a016f65ce99bd |
File details
Details for the file mofstructure-0.1.8.2-py3-none-any.whl
.
File metadata
- Download URL: mofstructure-0.1.8.2-py3-none-any.whl
- Upload date:
- Size: 40.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.9.15 Darwin/22.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac7873821a82f34c0201f6bac13b6c3f09d7459520b2d781cd2eeee994d057b5 |
|
MD5 | ac18681d6eec7a52aa562fe7f338fa4a |
|
BLAKE2b-256 | eadf2d30206e1d4de341eb6437b161dce42bf307ebf353268a45790a7a45b648 |