mofstructure


Namemofstructure JSON
Version 0.1.3 PyPI version JSON
download
home_page
SummaryA python tool to deconstruct MOFs into building units and compute porosity. The code remove guest from MOFs and all porous systems, compute smiles strings and inchikeys of all building units.
upload_time2023-11-28 09:51:23
maintainer
docs_urlNone
authorDinga Wonanke
requires_python>=3.8
licenseMIT
keywords guest removal inchikeys inchi smiles pld lcd mof cof zeolites accessible surface area void fraction coordination number porosity zeo++ sbu point of extension
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![intro](images/Rotation.gif)
# Generalities 
This is an elaborate python module that provides simple fucntions for
manipulation metal-organic frameworks and other porous systems such as 
COFs and Zeolites. Some uses of the module involves 

1. 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 ...

2. Automated removal of unbound guest molecules

3. 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.  

4. 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

5. 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 .
```
# How to: 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 
1. Importing module

```
from  mofstructure import mofdeconstructor
from  mofstructure import porosity
from  mofstructure import buildingunits
from ase.io import read, write 
import pandas as pd
```
2. Read using ase 
```
ase_atom = read(cif_file)
```
3. Removal of unbound guest 
![guest removal](images/guest_removal.gif)
```
no_guest_indices = mofdeconstructor.remove_unbound_guest(ase_atom)
no_guest_atom = ase_atom[no_guest_indices]
```

4. Computing porosity 
```
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')
```
5. sbus and ligands 
![MOF deconstruction](images/deconstruction.gif)
```
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. 
```

# Support 
The module contains much more functionalities. If you are struggling or if you wish to compute a new quantity that is not yet present, feel free to send me an email. dak52@uclive.ac.nz 

<object data="doc/how-to-doc.html" width="100%" height="600">
  <p>Click <a href="doc/how-to-doc.html">here</a> how-to-tutorial.</p>
</object>

# Roadmap
In the future the code should be able to: 
1. Compute rcsr topological code
2. Subsitutue building units in a MOF to enable framework functionalisation
3. Automatic curation of cifs
4. Decontsruction of COFs into their building units 
![process](images/decon.jpeg)

![proccess](images/guest.png)

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "mofstructure",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "guest removal,inchikeys,inchi,smiles,pld,lcd,MOF,COF,zeolites,accessible surface area,void fraction,coordination number,porosity,zeo++,sbu,point of extension",
    "author": "Dinga Wonanke",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/43/68/936fda83606a063e139f4d047003d176efbce88a85bc393a970c63d64966/mofstructure-0.1.3.tar.gz",
    "platform": null,
    "description": "![intro](images/Rotation.gif)\n# Generalities \nThis is an elaborate python module that provides simple fucntions for\nmanipulation metal-organic frameworks and other porous systems such as \nCOFs and Zeolites. Some uses of the module involves \n\n1. 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 ...\n\n2. Automated removal of unbound guest molecules\n\n3. 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.  \n\n4. 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\n\n5. Seperation of building units into regions. This is essential when on wishes to subsitute a specific ligand or building unit.  \n\n# Installation \n## Option 1 \n ```\n pip install mofstructure\n ```\n## Option 2 \n```\n  git clone https://github.com/bafgreat/mofstructure.git mofstructure\n  cd mofstructure\n  pip install .\n```\n# How to: Quick start \n## Run on the commandline\n### Building units \nSimply run the following command on a cif file or any ase readable file format containing a MOF. \n```\nmofstructure cif_file \n```\nThe 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:\n```\nmofstructure cif_file path_to_result_folder\n```\nFor multiple cif files. Simply run a loop and all the Results will be saved in the \n```\nfor cifs in ciffiles:\n    mofstructure cifs path_to_result\n```\n### Creating a database\nIf 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. \n```\nmofstructure_database ciffolder\n```\nHere 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. \n```\nmofstructure_database ciffolder path_to_result\n```\n## Use as a libray \n1. Importing module\n\n```\nfrom  mofstructure import mofdeconstructor\nfrom  mofstructure import porosity\nfrom  mofstructure import buildingunits\nfrom ase.io import read, write \nimport pandas as pd\n```\n2. Read using ase \n```\nase_atom = read(cif_file)\n```\n3. Removal of unbound guest \n![guest removal](images/guest_removal.gif)\n```\nno_guest_indices = mofdeconstructor.remove_unbound_guest(ase_atom)\nno_guest_atom = ase_atom[no_guest_indices]\n```\n\n4. Computing porosity \n```\npores = porosity.zeo_calculation(ase_ato, probe_radius=1.86, number_of_steps=5000)\ndf = pd.DataFrame(pores, index=[0])\ndf.to_csv('pore.csv')\n```\n5. sbus and ligands \n![MOF deconstruction](images/deconstruction.gif)\n```\nconnected_components, atoms_indices_at_breaking_point, porpyrin_checker, all_regions = MOF_deconstructor.secondary_building_units(ase_atom)\n\nmetal_sbus, organic_sbus, building_unit_regions = MOF_deconstructor.find_unique_building_units(\n    connected_components,\n    atoms_indices_at_breaking_point,\n    ase_atom, \n    porpyrin_checker,\n    all_regions,\n    cheminfo=True\n    )\n```\n### when cheminfo = True\nopenbabel is called to compute all chemifomatic information,\nwhich are all stored on the ase_atom.info\nmetal_sbus and  organic_sbus  list that contains all the unique instances of the metal sbus and organic sbus. \n### extracting cheminfor \nFor each instance in a building unit the various chemiformatic informations are as follows. \n```\nfor i,  sbu in enumerate(metal_sbu):\n    smi = sbu.info['smi]\n    inchi = sbu.info['inchi']\n    inchikey = sbu.info['inchikey]\n    # for sbus only \n    number_of_point_of_extension = sbu.info['point_of_extension']\n    #for metal sbus only \n    sbu_type = sbu.info['sbu_type'] # sbu_type :rodlike, irmof, uoi66, paddlewheel e.t.c\n    # write \n    sbu.write('metal_sbu_'+str(i)+'.cif')\n```\n# Summary \nAll of above codes can be run by a single function found mofstructure.buildingunits\n## for a single cif file\n``` \nfrom  mofstructure import buildingunits\nbuildingunits.work_flow(ciffile, result_folder)\n```\n## for multiple cif files \n```\nfrom  mofstructure import buildingunits\nimport glob \nall_cifs = glob.glob(folder/*cif)\n# folder corresponds to the folder containing all the cif files\nfor cif_files in all_cifs:\n    buildingunits.work_flow(cif_files, result_folder)\n# 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. \n```\n\n# Support \nThe module contains much more functionalities. If you are struggling or if you wish to compute a new quantity that is not yet present, feel free to send me an email. dak52@uclive.ac.nz \n\n<object data=\"doc/how-to-doc.html\" width=\"100%\" height=\"600\">\n  <p>Click <a href=\"doc/how-to-doc.html\">here</a> how-to-tutorial.</p>\n</object>\n\n# Roadmap\nIn the future the code should be able to: \n1. Compute rcsr topological code\n2. Subsitutue building units in a MOF to enable framework functionalisation\n3. Automatic curation of cifs\n4. Decontsruction of COFs into their building units \n![process](images/decon.jpeg)\n\n![proccess](images/guest.png)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A python tool to deconstruct MOFs into building units and compute porosity. The code remove guest from MOFs and all porous systems, compute smiles strings and inchikeys of all building units.",
    "version": "0.1.3",
    "project_urls": null,
    "split_keywords": [
        "guest removal",
        "inchikeys",
        "inchi",
        "smiles",
        "pld",
        "lcd",
        "mof",
        "cof",
        "zeolites",
        "accessible surface area",
        "void fraction",
        "coordination number",
        "porosity",
        "zeo++",
        "sbu",
        "point of extension"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0bdca8d49fa9c3beec50fbf305399d292ac45041558238fae4fb5e0ef4bdc59b",
                "md5": "464edd73fdcdf94f4f8d09cd97b7483a",
                "sha256": "b44e38cc9dd11c8fcf352b987f0640bf7b18db4e65f0668fe74363fd2ac424a4"
            },
            "downloads": -1,
            "filename": "mofstructure-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "464edd73fdcdf94f4f8d09cd97b7483a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 26856,
            "upload_time": "2023-11-28T09:51:22",
            "upload_time_iso_8601": "2023-11-28T09:51:22.118059Z",
            "url": "https://files.pythonhosted.org/packages/0b/dc/a8d49fa9c3beec50fbf305399d292ac45041558238fae4fb5e0ef4bdc59b/mofstructure-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4368936fda83606a063e139f4d047003d176efbce88a85bc393a970c63d64966",
                "md5": "d9bd2cd6532035b0ff0355ca3b2a4726",
                "sha256": "44c83306eb1c64dc1781210203ac6c6ad3f34b9c6d4ca2885809f089c3b4544b"
            },
            "downloads": -1,
            "filename": "mofstructure-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "d9bd2cd6532035b0ff0355ca3b2a4726",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 25510,
            "upload_time": "2023-11-28T09:51:23",
            "upload_time_iso_8601": "2023-11-28T09:51:23.939575Z",
            "url": "https://files.pythonhosted.org/packages/43/68/936fda83606a063e139f4d047003d176efbce88a85bc393a970c63d64966/mofstructure-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-28 09:51:23",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "mofstructure"
}
        
Elapsed time: 0.14927s