Skip to main content

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.

Documentation: https://hiraoka-group.github.io/nasap-net/

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

Metadata

Release files for nasap-net 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nasap-net 1.3.0
File Size Uploaded Provenance Actions
nasap_net-1.3.0.tar.gz 46.0 kB With provenance Details for nasap_net-1.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nasap-net 1.3.0
File Interpreter ABI Platform Actions
nasap_net-1.3.0-py3-none-any.whl Python 3 none any Details for nasap_net-1.3.0-py3-none-any.whl

Total release size: 136.9 kB

Release files / nasap_net-1.3.0.tar.gz

Download URL nasap_net-1.3.0.tar.gz
Size 46.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b00cb6fd854cc67dd0d43db7727dbbfdec28c4744bba56e3cc31f3e287ac7974
BLAKE2b-256 checksum
How to use checksums
51b546fbe056963486d08dd5c9fe240088f68acdb08229cee72c8b96fbbe731e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 24, 2026.

Transparency log

Release files / nasap_net-1.3.0-py3-none-any.whl

Download URL nasap_net-1.3.0-py3-none-any.whl
Size 90.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eccf81555253d9d8b6cdf1cbd731e4a34e608b29f566ba02db91b7f1dce73d5f
BLAKE2b-256 checksum
How to use checksums
c9feff629672f58c7b76bcd39ede2f51b39a80cb82242eb7d581c94a3d6e247e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 24, 2026.

Transparency log

Security for nasap-net 1.3.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nasap_net-1.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 24, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page