moleculetda
A framework to use topological data analysis to extract topological information from a structure (e.g., molecule or crystal), which can then be used in downstream tasks.
Installation
The library can be installed as follows:
pip install moleculetda
Examples
As an example, we will start with the following metal-organic framework (MOF) and construct topological summaries of all the channels and voids in the structure:
Persistence diagrams can be generated from an example structure file such as a .cif file.
from moleculetda.structure_to_vectorization import structure_to_pd
import matplotlib.pyplot as plt
import numpy as np
filename = 'files/mof_structs/str_m4_o1_o1_acs_sym.10.cif'
# return a dict containing persistence diagrams for different dimensions (1d - channels, 2d - voids)
arr_dgms = structure_to_pd(filename, supercell_size=20)
# plot out the 1d and 2d diagrams
dgm_1d = arr_dgms['dim1']
dgm_2d = arr_dgms['dim2']
plot_pds(dgm_1d, dgm_2d)
̰
Starting from arr_dgms (dict storing the persistence diagrams), vectorized representations
can be generated. Axes units are the same as the units of the original structure file:
# initialize parameters for the "image" representation:
# spread: Gaussian spread of the kernel, pixels: size of representation (n, n),
# weighting_type: how to weigh the persistence diagram points
# Optional: specs can be provided to give bounds on the representation
from moleculetda.vectorize_pds import PersImage, pd_vectorization
from moleculetda.plotting import plot_per_images
pim = PersImage(spread=0.15,
pixels=[50, 50],
weighting_type = 'identity')
# get both the 1d and 2d representations
images = []
for dim in [1, 2]:
dgm = arr_dgms[f"dim{dim}"]
images.append(pd_vectorization(dgm, spread=0.15, weighting='identity', pixels=[50, 50]))
plot_pers_images(images, arr_dgms)
The resulting 1d and 2d image representations can be used for other tasks.
Citation
@article{doi:10.1021/acs.jpcc.0c01167,
author = {Krishnapriyan, Aditi S. and Haranczyk, Maciej and Morozov, Dmitriy},
title = {Topological Descriptors Help Predict Guest Adsorption in Nanoporous Materials},
journal = {The Journal of Physical Chemistry C},
volume = {124},
number = {17},
pages = {9360-9368},
year = {2020},
doi = {10.1021/acs.jpcc.0c01167},
}
@article{krishnapriyan_machine_2021,
title={Machine learning with persistent homology and chemical word embeddings improves prediction accuracy and interpretability in metal-organic frameworks},
author={Krishnapriyan, Aditi S and Montoya, Joseph and Haranczyk, Maciej and Hummelsh{\o}j, Jens and Morozov, Dmitriy},
journal = {Scientific Reports},
volume = {11},
numer = {1},
issn = {2045-2322},
pages = {8888},
year={2021},
doi = {10.1038/s41598-021-88027-8}
}
Metadata
Release files for moleculetda 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| moleculetda-0.2.1.tar.gz | 30.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| moleculetda-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 45.1 kB
Release files / moleculetda-0.2.1.tar.gz
| Download URL | moleculetda-0.2.1.tar.gz |
|---|---|
| Size | 30.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
43e2e2d21abbb1011421e98090013559c31658b350ce281ea874ec2a6c1dc1bb
|
|
BLAKE2b-256 checksum How to use checksums |
e40301e9b51a873e281fdfcea5d52c81a2a6d9abe2328965c89e2046e20ea60a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|
Release files / moleculetda-0.2.1-py3-none-any.whl
| Download URL | moleculetda-0.2.1-py3-none-any.whl |
|---|---|
| Size | 14.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a40151128066e37516b2cb1f554e11e180dc6707f5037d4aba629837e99d3964
|
|
BLAKE2b-256 checksum How to use checksums |
859b34b29be33bd498ed7fefe1f52e3f49f47be2f53f6d829db4a6fdf56b8bfc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|
Security for moleculetda 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.