Skip to main content

Automated reaction network generator for NASAP (Numerical Analysis of Self-Assembly Process)

Project description

nasap-net

nasap-net is a Python library for automatically constructing elementary reaction networks within the NASAP (Numerical Analysis for Self-Assembly Process) framework, developed by the Hiraoka Group.

Installation

pip install nasap-net

Requires Python ≥ 3.12.

What it does

Given a target assembly (a metal–organic cage) and the components that make it up, nasap-net:

  1. Enumerates all subassemblies — finds every chemically meaningful partial structure
  2. Enumerates all elementary reactions — generates every ligand-exchange step connecting those subassemblies
  3. Classifies reactions — applies a user-defined rule to assign a reaction type to each elementary reaction
  4. Saves and loads results — serializes assemblies and reactions to YAML/CSV files for downstream use

Quick start

from nasap_net import (
    Assembly, Bond, Component, MLEKind,
    enumerate_assemblies, enumerate_reactions,
    classify_reactions, IncompleteReactionClassifierError,
    save_assemblies, save_reactions, save_classification_result,
)

# Define components
M = Component(kind='M', sites=[0, 1])
L = Component(kind='L', sites=[0, 1])
X = Component(kind='X', sites=[0])

# Define target assembly
target = Assembly(
    components={'M0': M, 'M1': M, 'L0': L, 'L1': L},
    bonds=[
        Bond('M0', 1, 'L0', 0), Bond('L0', 1, 'M1', 0),
        Bond('M1', 1, 'L1', 0), Bond('L1', 1, 'M0', 0),
    ]
)

# Enumerate subassemblies and reactions
assemblies = list(enumerate_assemblies(target, leaving_ligand=X, metal_kinds='M'))
reactions = list(enumerate_reactions(
    assemblies=assemblies,
    mle_kinds=[
        MLEKind(metal='M', leaving='X', entering='L'),
        MLEKind(metal='M', leaving='L', entering='X'),
    ],
))

# Classify reactions with a user-defined rule
def my_classifier(reaction):
    reaction = reaction.as_reaction_to_classify()
    if reaction.leaving_kind == 'X' and reaction.entering_kind == 'L':
        return 'X-to-L'
    elif reaction.leaving_kind == 'L' and reaction.entering_kind == 'X':
        return 'L-to-X'
    raise IncompleteReactionClassifierError(reaction)

reaction_to_class = classify_reactions(reactions, my_classifier)

# Save results
save_assemblies(assemblies, 'assemblies.yaml')
save_reactions(reactions, 'reactions.csv')
save_classification_result(reaction_to_class, 'classification_result.csv')

Example

A worked example for an M4L4/M10L11 system is available as a Jupyter notebook:

examples/M4L4_reaction_classification/

Open In Colab

License

MIT

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

nasap_net-1.2.1.tar.gz (65.2 kB view details)

Uploaded Source

Built Distribution

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

nasap_net-1.2.1-py3-none-any.whl (138.5 kB view details)

Uploaded Python 3

File details

Details for the file nasap_net-1.2.1.tar.gz.

File metadata

  • Download URL: nasap_net-1.2.1.tar.gz
  • Upload date:
  • Size: 65.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nasap_net-1.2.1.tar.gz
Algorithm Hash digest
SHA256 1fa328fec8834cebe4dd769de52fa942ff0cd63a3878aeb8ae7555b86d87c5ff
MD5 dde41253e9eb3e3250c4a0dab5962f81
BLAKE2b-256 aa456b8a4f1a786e0d3535c42cb9d1322214a644d430b274f4c3c4064011fcab

See more details on using hashes here.

Provenance

The following attestation bundles were made for nasap_net-1.2.1.tar.gz:

Publisher: release.yml on Hiraoka-Group/nasap-net

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nasap_net-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: nasap_net-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 138.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nasap_net-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 46fa9222a4a557b867ce8b59bd822a52bf12ea5096e8e84ea62587ddbf076aa5
MD5 3587bc47b5148ee9209b1961f13891e1
BLAKE2b-256 4c9b788b8e59505aebc7d0d37ec193a75f0c2ed0bc5e96bcbdd1f58940966771

See more details on using hashes here.

Provenance

The following attestation bundles were made for nasap_net-1.2.1-py3-none-any.whl:

Publisher: release.yml on Hiraoka-Group/nasap-net

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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