nanofoams¶
Periodic stochastic bicontinuous structures for atomistic simulations.
nanofoams builds atomistic samples of nanoporous metals (and any other
bicontinuous two-phase material) with the Gaussian-random-field method of
Soyarslan et al. (2018): a
superposition of waves with random phases and a fixed wavelength is evaluated on
a crystal lattice, and a level cut splits the atoms into solid and pore. The
result is written as a LAMMPS data file, ready for molecular dynamics.

Try it in your browser
The Colab notebook builds a sample of the metal you choose, shows it in 3-D and downloads the LAMMPS file, with nothing to install. See also the gallery and the ready-made samples.
Features¶
- Exactly periodic samples in sc, bcc and fcc lattices, with wave vectors restricted to integer Miller indices.
- Fast: exact FFT evaluation. A 54-million-atom bcc sample takes ~3 s on a laptop CPU instead of the ~32 h of the original implementation (see Backends). Optional GPU backend via CuPy.
- Reproducible: one seed controls everything. Every run writes a JSON log that regenerates the identical files.
- Analytical morphology: surface density, curvatures and genus density predicted from the input parameters, with numerical measurement to check them.
- Sanity checks for percolation, anisotropy, representative volume size and unreachable ligament diameters.
- Validated against the original thesis code and against the tables and equations of Soyarslan et al.
In one minute¶
lattice = "bcc"
lattice_parameter = 3.303 # Ta, in Angstrom
cells = 100
solid_fraction = 0.30
h2 = 54
seed = 42
$ nanofoams generate foam.toml
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")
print(foam.morphology.ligament_diameter)
Origin¶
The method was implemented for the undergraduate thesis of N. Vazquez (FCEN-UNCuyo, 2023) and used in Vazquez von Bibow, Millán & Ruestes, Comput. Mater. Sci. 236 (2024) 112884. This package is a rewrite of that code; see Citing and Changes from the thesis code.