Skip to main content

nanofoams

CI License: MIT

Periodic stochastic bicontinuous structures for atomistic simulations.

nanofoams builds atomistic samples of nanoporous metals with the Gaussian-random-field method of Soyarslan et al. (2018), and writes them as LAMMPS data files ready for molecular dynamics.

Nanoporous bcc foam
  • Exactly periodic sc, bcc and fcc samples.
  • Fast. Exact FFT evaluation generates a 54-million-atom sample in ~3 s on a laptop CPU; the original implementation took ~32 h. Optional GPU backend.
  • Reproducible. One seed controls everything, and each run writes a JSON log that regenerates identical files.
  • Analytical morphology (surface density, curvatures, genus) and numerical measurement to check it.
  • Sanity checks for percolation, anisotropy and representative volume size.

Install

pip install nanofoams

Until the first PyPI release: pip install "git+https://github.com/nicolasvazquez95/nanofoams". Python 3.10+, NumPy and SciPy.

Use

From the command line, with a TOML config:

# foam.toml
lattice = "bcc"
lattice_parameter = 3.303   # Ta, Angstrom
cells = 100
solid_fraction = 0.30
h2 = 54                     # or: ligament_diameter = 25.0
seed = 42
nanofoams generate foam.toml          # -> foam.data (+ foam.json log)
nanofoams info foam.toml              # predicted morphology and warnings

From Python:

import nanofoams

foam = nanofoams.generate(
    lattice="bcc",
    lattice_parameter=3.303,
    cells=100,
    solid_fraction=0.30,
    h2=54,
    seed=42,
)
foam.write_lammps_data("foam.data")
foam.morphology.ligament_diameter  # 25.6 Angstrom

See examples/quickstart.ipynb and the documentation (theory, parameter guide, CLI, API, validation).

How to cite

If you use this code, please cite:

N. Vazquez von Bibow, E. N. Millán, C. J. Ruestes, Topological changes and deformation mechanisms of nanoporous Ta under compression, Computational Materials Science 236 (2024) 112884. doi:10.1016/j.commatsci.2024.112884

and the method, C. Soyarslan, S. Bargmann, M. Pradas, J. Weissmüller, Acta Materialia 149 (2018) 326-340. BibTeX entries are in references.bib.

History

This package rewrites the code of the undergraduate thesis of N. Vazquez (FCEN-UNCuyo, 2023). The original scripts are kept, unmodified, in legacy/ and serve as regression references for the test-suite. Changes from the thesis code lists the corrections made since.

Acknowledgements

Python implementation by Nicolás Vazquez and Carlos J. Ruestes, based on the article by Soyarslan et al. Funded by ANPCyT PICT-2018-0773 and European Commission Grant Agreement 101062254 (MeNaWir, MSCA Postdoctoral Fellowships).

License

MIT

Metadata

Release files for nanofoams 0.1.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 nanofoams 0.1.0
File Size Uploaded Provenance Actions
nanofoams-0.1.0.tar.gz 240.1 kB With provenance Details for nanofoams-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nanofoams 0.1.0
File Interpreter ABI Platform Actions
nanofoams-0.1.0-py3-none-any.whl Python 3 none any Details for nanofoams-0.1.0-py3-none-any.whl

Total release size: 272.0 kB

Release files / nanofoams-0.1.0.tar.gz

Download URL nanofoams-0.1.0.tar.gz
Size 240.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7eb07661f3977c38cc9c29b47da5dffed32da44da92e1b486d37cf7ff96f6c10
BLAKE2b-256 checksum
How to use checksums
8798d09e75abcb7f755f5a1ccce3aa7c2e4fc848bcbf5073a0737868f53a7514
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 28, 2026.

Transparency log

Release files / nanofoams-0.1.0-py3-none-any.whl

Download URL nanofoams-0.1.0-py3-none-any.whl
Size 32.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e0444fbd83e3f1a06e96d348b71da1c2679c1c705be774599e19a3d2992d1ea1
BLAKE2b-256 checksum
How to use checksums
96ae5e92fc1bfb0483c783a87331a9ab8efdafb9010ef96174f5fd837dcd6b41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 28, 2026.

Transparency log

Security for nanofoams 0.1.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 nanofoams-0.1.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 Nov 28, 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