Skip to main content

A python package for packing nanoclusters into supramolecular cages

Project description

AtomPacker

PyPI - Version PyPI - Python Version PyPI - Downloads GitHub Workflow Status GitHub

A Python package for packing nanoclusters into supramolecular cages.

See also:

Requirements

Installation

To install the latest release on PyPI, run:

pip install AtomPacker

Or, to install the development version, run:

pip install git+https://github.com/cnpem/AtomPacker.git

Usage

Packing nanoparticle atoms, based on ASE nanocluster, and filter atoms inside a target cavity.

>>> from AtomPacker import Cage
# 1: Load structure from file
>>> cage = Cage()
>>> cage.load("tests/data/ZOCXOH.pdb")
# Uncomment to preview the cage structure.
>>> # cage.preview()
# 2: Detect cavity
>>> cage.detect_cavity(step=0.6, probe_in=1.4, probe_out=10.0, removal_distance=1.0, volume_cutoff=5.0)
# Uncomment to preview the cavity structure for detection quality control.
>>> # cage.cavity.preview()
# Show volume
>>> print(f"Cavity volume: {cage.cavity.volume} A^3")
# Uncomment to save the cavity structure.
>>> # cage.cavity.save("tests/cavity.pdb")
# 3: Detect openings in the cavity
>>> cage.cavity.detect_openings()
# Show openings areas
>>> print(f"Openings areas: {cage.cavity.openings.areas}")
# Show openings diameters
>>> print(f"Openings diameters: {cage.cavity.openings.diameters}")
# Uncomment to preview the openings structure for detection quality control.
>>> # cage.cavity.openings.preview()
# Uncomment to save the openings structure.
>>> # cage.cavity.openings.save("tests/openings.pdb")
# 4: Pack nanocluster into the cavity
>>> cage.pack(atom_type="Au", lattice_type="fcc", a=None, b=None, c=None)
# Uncomment to preview the cluster structure for quality control.
>>> # cage.cavity.preview()
# Uncomment to save the cluster structure.
>>> # cage.cluster.save("tests/cluster.pdb")
# Uncomment to preview the cage, cavity, openings and cluster structures.
>>> # cage.preview(show_cavity=True, show_cluster=True, show_openings=True)
# Show optimization details
>>> print(cage.cluster.number_of_atoms)
# Show summary
>>> print(cage.cluster.summary)

Architecture

The package is organized as follows:

classDiagram
direction LR
Cage "1" o-- "1" Cavity : has
Cage "1" o-- "1" Cluster : fits in
Cavity "1" o-- "1..*" Openings : has
Cavity "1" <|-- "1" Cluster : needs
namespace AtomPacker {
class Cage {
+ numpy.ndarray atomic
+ Cavity cavity
+ numpy.ndarray centroid
+ Cluster cluster
+ numpy.ndarray coordinates
+ MDAnalysis.Universe universe
+ detect_cavity(float step, float probe_in, float probe_out, float removal_distance, float volume_cutoff, str surface, int nthreads, bool verbose, dict~str,object~ **kwargs) void
+ load(filename) void
+ pack(str lattice_type, str atom_type, float atom_radius, float a, float b, float c) void
+ preview(bool show_cavity, bool show_cluster, str renderer, dict~str,object~ **kwargs) void
# _build_cluster(str atom_type, str lattice_type, tuple~float~ lattice_constants, numpy.ndarray center) tuple~ase.cluster.Cluster, int~
# _filter_clashing_atoms(ase.cluster.Cluster cluster, float clashing_tolerance) ase.cluster.Cluster
# _filter_outside_cavity(ase.cluster.Cluster cluster) ase.cluster.Cluster
# _get_cluster_layers(str atom_type, float factor) numpy.ndarray
# _get_obb() tuple~numpy.ndarray, numpy.ndarray~
}
class Cavity {
+ numpy.ndarray coordinates
+ numpy.ndarray grid
+ Openings openings
+ MDAnalysis.Universe universe
+ numpy.ndarray volume
# float step
# float probe_in
# float probe_out
# float removal_distance
# numpy.ndarray vertices
# float volume_cutoff
# str surface
+ detect_openings() void
+ preview(str renderer, float opacity, dict~str,object~ **kwargs) void
+ select_cavity(List~int~ indexes) void
+ save(str filename) void
# _get_universe() MDAnalysis.Universe
}
class Cluster {
+ str atom_type
+ numpy.ndarray coordinates
+ str lattice_type
+ tuple~float~ lattice_constants
+ pandas.DataFrame log
+ int number_of_atoms
+ int maximum_number_of_atoms
+ pandas.DataFrame summary
+ MDAnalysis.Universe universe
+ numpy.ndarray volume
# Cavity cavity
# ase.cluster.Cluster _cluster
+ diameter(str method) float
+ preview(str renderer, float opacity, dict~str,object~ **kwargs) void
+ save(str filename) void
# _get_distances() numpy.ndarray
# _get_universe() MDAnalysis.Universe  
}
class Openings {
+ dict~str,float~ areas
+ numpy.ndarray coordinates
+ dict~str,float~ diameters
+ numpy.ndarray grid
+ int nopenings
+ MDAnalysis.Universe universe
# float step
# numpy.ndarray vertices
+ preview(str renderer, float opacity, dict~str,object~ **kwargs) void
+ save(str filename) void
# _get_diameter() dict~str,float~
# _get_universe() MDAnalysis.Universe
}
}

Citing

If you find AtomPacker useful for you, please cite the following references:

  • Guerra, J. V. S., Ribeiro-Filho, H. V., Jara, G. E., Bortot, L. O., Pereira, J. G. C., & Lopes-de-Oliveira, P. S. (2021). pyKVFinder: an efficient and integrable Python package for biomolecular cavity detection and characterization in data science. BMC bioinformatics, 22(1), 607. https://doi.org/10.1186/s12859-021-04519-4.

  • (manuscript in preparation) Guerra, J. V. S., Jara, G. E., Lopes-de-Oliveira, P. S. & Szalóki, G. (2024) Modellization of confined nanoparticles.

License

The software is licensed under the terms of the GNU General Public License version 3 (GPL3) and is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

atompacker-0.5.2.tar.gz (67.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

atompacker-0.5.2-py3-none-any.whl (61.4 kB view details)

Uploaded Python 3

File details

Details for the file atompacker-0.5.2.tar.gz.

File metadata

  • Download URL: atompacker-0.5.2.tar.gz
  • Upload date:
  • Size: 67.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for atompacker-0.5.2.tar.gz
Algorithm Hash digest
SHA256 707b9e1616615115d5c77bbaa9ce655ca6aebc2d6cb5f0140789c1964baeeb45
MD5 1d7ca97a45e5d332a106cfa5e55729ad
BLAKE2b-256 ecab30273e13ec8ab55a3caef427aab7f1f22b5bbe4802e6a53f045eda502f3d

See more details on using hashes here.

File details

Details for the file atompacker-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: atompacker-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 61.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for atompacker-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b9d9f61307ecaedc5da7d6536d525f5e348c3aef54a0d4933070ceefbe0f12a0
MD5 94a1507f34a81a0c77deaaea441d52e6
BLAKE2b-256 f4505a8f8656226147828fce5b5c57ca6a315928892746a64ef75404d69a1eb6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page