nanofoams 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. nanofoams-0.1.0/.gitattributes +2 -0
  2. nanofoams-0.1.0/.gitignore +163 -0
  3. nanofoams-0.1.0/.pre-commit-config.yaml +19 -0
  4. nanofoams-0.1.0/.zenodo.json +30 -0
  5. nanofoams-0.1.0/CHANGELOG.md +51 -0
  6. nanofoams-0.1.0/CITATION.cff +50 -0
  7. nanofoams-0.1.0/LICENSE +21 -0
  8. nanofoams-0.1.0/PKG-INFO +154 -0
  9. nanofoams-0.1.0/README.md +101 -0
  10. nanofoams-0.1.0/benchmarks/run_benchmarks.py +129 -0
  11. nanofoams-0.1.0/docs/api.md +75 -0
  12. nanofoams-0.1.0/docs/backends.md +63 -0
  13. nanofoams-0.1.0/docs/citing.md +27 -0
  14. nanofoams-0.1.0/docs/cli.md +91 -0
  15. nanofoams-0.1.0/docs/index.md +71 -0
  16. nanofoams-0.1.0/docs/installation.md +41 -0
  17. nanofoams-0.1.0/docs/javascripts/mathjax.js +19 -0
  18. nanofoams-0.1.0/docs/legacy.md +34 -0
  19. nanofoams-0.1.0/docs/parameters.md +63 -0
  20. nanofoams-0.1.0/docs/quickstart.md +78 -0
  21. nanofoams-0.1.0/docs/scripts/make_figures.py +81 -0
  22. nanofoams-0.1.0/docs/theory.md +126 -0
  23. nanofoams-0.1.0/docs/validation.md +53 -0
  24. nanofoams-0.1.0/examples/foam.toml +17 -0
  25. nanofoams-0.1.0/examples/quickstart.ipynb +187 -0
  26. nanofoams-0.1.0/legacy/H_generator.py +126 -0
  27. nanofoams-0.1.0/legacy/README.md +23 -0
  28. nanofoams-0.1.0/legacy/build_nanofoams.py +258 -0
  29. nanofoams-0.1.0/legacy/build_nanofoams_serial.py +250 -0
  30. nanofoams-0.1.0/legacy/build_nanofoams_tensorflow_colab_version.ipynb +726 -0
  31. nanofoams-0.1.0/legacy/nanofoams_input.txt +33 -0
  32. nanofoams-0.1.0/mkdocs.yml +80 -0
  33. nanofoams-0.1.0/pyproject.toml +105 -0
  34. nanofoams-0.1.0/references.bib +20 -0
  35. nanofoams-0.1.0/src/nanofoams/__init__.py +37 -0
  36. nanofoams-0.1.0/src/nanofoams/__main__.py +5 -0
  37. nanofoams-0.1.0/src/nanofoams/_version.py +1 -0
  38. nanofoams-0.1.0/src/nanofoams/backends/__init__.py +44 -0
  39. nanofoams-0.1.0/src/nanofoams/backends/_kernels.py +112 -0
  40. nanofoams-0.1.0/src/nanofoams/backends/cupy_gpu.py +57 -0
  41. nanofoams-0.1.0/src/nanofoams/backends/numpy_collapsed.py +23 -0
  42. nanofoams-0.1.0/src/nanofoams/backends/numpy_direct.py +35 -0
  43. nanofoams-0.1.0/src/nanofoams/backends/numpy_fft.py +25 -0
  44. nanofoams-0.1.0/src/nanofoams/cli.py +266 -0
  45. nanofoams-0.1.0/src/nanofoams/config.py +185 -0
  46. nanofoams-0.1.0/src/nanofoams/diagnostics.py +105 -0
  47. nanofoams-0.1.0/src/nanofoams/directions.py +86 -0
  48. nanofoams-0.1.0/src/nanofoams/field.py +126 -0
  49. nanofoams-0.1.0/src/nanofoams/foam.py +150 -0
  50. nanofoams-0.1.0/src/nanofoams/io/__init__.py +5 -0
  51. nanofoams-0.1.0/src/nanofoams/io/lammps.py +139 -0
  52. nanofoams-0.1.0/src/nanofoams/lattice.py +58 -0
  53. nanofoams-0.1.0/src/nanofoams/measure.py +61 -0
  54. nanofoams-0.1.0/src/nanofoams/morphology.py +111 -0
  55. nanofoams-0.1.0/src/nanofoams/params.py +198 -0
  56. nanofoams-0.1.0/tests/conftest.py +79 -0
  57. nanofoams-0.1.0/tests/data/golden/bcc_h14.npz +0 -0
  58. nanofoams-0.1.0/tests/data/golden/fcc_h6.npz +0 -0
  59. nanofoams-0.1.0/tests/data/golden/sc_h54.npz +0 -0
  60. nanofoams-0.1.0/tests/data/golden/sc_h9.npz +0 -0
  61. nanofoams-0.1.0/tests/test_backends.py +150 -0
  62. nanofoams-0.1.0/tests/test_cli.py +255 -0
  63. nanofoams-0.1.0/tests/test_directions.py +89 -0
  64. nanofoams-0.1.0/tests/test_examples.py +64 -0
  65. nanofoams-0.1.0/tests/test_field.py +127 -0
  66. nanofoams-0.1.0/tests/test_foam.py +26 -0
  67. nanofoams-0.1.0/tests/test_golden.py +111 -0
  68. nanofoams-0.1.0/tests/test_io.py +84 -0
  69. nanofoams-0.1.0/tests/test_lattice.py +50 -0
  70. nanofoams-0.1.0/tests/test_morphology.py +134 -0
  71. nanofoams-0.1.0/tests/test_package.py +9 -0
  72. nanofoams-0.1.0/tests/test_params.py +114 -0
  73. nanofoams-0.1.0/tests/test_statistics.py +79 -0
  74. nanofoams-0.1.0/tools/make_golden.py +206 -0
@@ -0,0 +1,2 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
@@ -0,0 +1,163 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
105
+ __pypackages__/
106
+
107
+ # Celery stuff
108
+ celerybeat-schedule
109
+ celerybeat.pid
110
+
111
+ # SageMath parsed files
112
+ *.sage.py
113
+
114
+ # Environments
115
+ .env
116
+ .venv
117
+ env/
118
+ venv/
119
+ ENV/
120
+ env.bak/
121
+ venv.bak/
122
+
123
+ # Spyder project settings
124
+ .spyderproject
125
+ .spyproject
126
+
127
+ # Rope project settings
128
+ .ropeproject
129
+
130
+ # mkdocs documentation
131
+ /site
132
+
133
+ # mypy
134
+ .mypy_cache/
135
+ .dmypy.json
136
+ dmypy.json
137
+
138
+ # Pyre type checker
139
+ .pyre/
140
+
141
+ # pytype static type analyzer
142
+ .pytype/
143
+
144
+ # Cython debug symbols
145
+ cython_debug/
146
+
147
+ # PyCharm
148
+ # JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
149
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
150
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
151
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
152
+ #.idea/
153
+
154
+ # Cosas ocultas
155
+ doc_hidden/
156
+ code/future_releases/
157
+
158
+ # Development
159
+ .venv/
160
+ .ruff_cache/
161
+ .pytest_cache/
162
+ .claude/
163
+ site/
@@ -0,0 +1,19 @@
1
+ exclude: ^legacy/
2
+
3
+ repos:
4
+ - repo: https://github.com/pre-commit/pre-commit-hooks
5
+ rev: v5.0.0
6
+ hooks:
7
+ - id: trailing-whitespace
8
+ - id: end-of-file-fixer
9
+ - id: check-yaml
10
+ - id: check-toml
11
+ - id: check-added-large-files
12
+ args: ["--maxkb=1000"]
13
+
14
+ - repo: https://github.com/astral-sh/ruff-pre-commit
15
+ rev: v0.17.6
16
+ hooks:
17
+ - id: ruff
18
+ args: [--fix]
19
+ - id: ruff-format
@@ -0,0 +1,30 @@
1
+ {
2
+ "title": "nanofoams: periodic stochastic bicontinuous structures for atomistic simulations",
3
+ "upload_type": "software",
4
+ "description": "Python package to generate periodic atomistic samples of nanoporous metals (and other bicontinuous two-phase materials) with the Gaussian-random-field method of Soyarslan et al. (2018), and to write them as LAMMPS data files. Includes exact FFT evaluation, analytical morphology predictions and parameter diagnostics.",
5
+ "license": "MIT",
6
+ "creators": [
7
+ {"name": "Vazquez von Bibow, Nicolás"},
8
+ {"name": "Ruestes, Carlos J."}
9
+ ],
10
+ "keywords": [
11
+ "nanoporous metals",
12
+ "bicontinuous structures",
13
+ "Gaussian random field",
14
+ "molecular dynamics",
15
+ "LAMMPS"
16
+ ],
17
+ "related_identifiers": [
18
+ {
19
+ "identifier": "10.1016/j.commatsci.2024.112884",
20
+ "relation": "isSupplementTo",
21
+ "scheme": "doi"
22
+ },
23
+ {
24
+ "identifier": "10.1016/j.actamat.2018.01.005",
25
+ "relation": "references",
26
+ "scheme": "doi"
27
+ }
28
+ ],
29
+ "notes": "Funded by ANPCyT PICT-2018-0773 and European Commission Grant Agreement 101062254 (MeNaWir, MSCA Postdoctoral Fellowships)."
30
+ }
@@ -0,0 +1,51 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses
5
+ [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [0.1.0] - 2026-11-28
8
+
9
+ First release as an installable package, `nanofoams`. It is a rewrite of the
10
+ scripts written for the undergraduate thesis (2022-2023), which are kept
11
+ unmodified in `legacy/`.
12
+
13
+ ### Added
14
+
15
+ - `nanofoams` package with a Python API: `FoamParameters`, `generate()`,
16
+ `Foam`, `GaussianRandomField`, `miller_indices()`, `lattice_points()`.
17
+ - Backends: `direct` (the thesis formula), `collapsed` (exact phase collapse),
18
+ `fft` (exact inverse FFT on the lattice, the default) and `cupy` (GPU).
19
+ Generating a 54-million-atom bcc sample takes ~3 s on a laptop CPU.
20
+ - Analytical morphology (`predict()`): surface density, curvatures, genus
21
+ density, scaled genus (Soyarslan eq. 16) and reduced genus `G_V/S^3`.
22
+ - Numerical measurement of solid fraction and surface area with marching cubes
23
+ (`nanofoams.measure`, optional `analysis` extra).
24
+ - Parameter diagnostics (`check()`): percolation, anisotropy, representative
25
+ volume size, resolution and unreachable ligament diameters.
26
+ - LAMMPS data-file and dump writers and readers.
27
+ - Command line: `nanofoams generate | info | directions | suggest-h2 |
28
+ convert-legacy`, TOML configs, and a JSON log per run that reproduces the
29
+ output byte for byte.
30
+ - Documentation site (MkDocs), quickstart notebook, `CITATION.cff`.
31
+ - Test-suite with regression fixtures produced by the original scripts, checks
32
+ against Soyarslan et al. (2018) Table 1, and statistical tests.
33
+
34
+ ### Fixed (with respect to the thesis code)
35
+
36
+ - Surface density in the log used `exp(-xi/2)` instead of `exp(-xi^2/2)`.
37
+ - Reduced genus `G_V/S^3`: the thesis text quotes
38
+ `(3 pi/32)(1 - xi^2) exp(xi^2/2)`; the correct form is
39
+ `(pi/32)(1 - xi^2) exp(xi^2)`.
40
+ - The TensorFlow version normalised with the requested instead of the actual
41
+ number of waves.
42
+ - Directions were chosen with an unseeded random generator, so a seed did not
43
+ determine the foam.
44
+ - Boxes that were not a whole number of unit cells left a gap at the periodic
45
+ boundary; non-periodic configurations were accepted silently.
46
+
47
+ None of these affect the results of Vazquez von Bibow et al., Comput. Mater.
48
+ Sci. 236 (2024) 112884, which use only the generation step and measure
49
+ topology with OVITO.
50
+
51
+ [0.1.0]: https://github.com/nicolasvazquez95/nanofoams/releases/tag/v0.1.0
@@ -0,0 +1,50 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use this software, please cite the article below."
3
+ title: "nanofoams: periodic stochastic bicontinuous structures for atomistic simulations"
4
+ type: software
5
+ license: MIT
6
+ repository-code: "https://github.com/nicolasvazquez95/nanofoams"
7
+ authors:
8
+ - family-names: "Vazquez von Bibow"
9
+ given-names: "Nicolás"
10
+ - family-names: "Ruestes"
11
+ given-names: "Carlos J."
12
+ keywords:
13
+ - nanoporous metals
14
+ - bicontinuous structures
15
+ - Gaussian random field
16
+ - molecular dynamics
17
+ - LAMMPS
18
+ preferred-citation:
19
+ type: article
20
+ title: "Topological changes and deformation mechanisms of nanoporous Ta under compression"
21
+ authors:
22
+ - family-names: "Vazquez von Bibow"
23
+ given-names: "Nicolás"
24
+ - family-names: "Millán"
25
+ given-names: "Emmanuel N."
26
+ - family-names: "Ruestes"
27
+ given-names: "Carlos J."
28
+ journal: "Computational Materials Science"
29
+ volume: 236
30
+ start: 112884
31
+ year: 2024
32
+ doi: "10.1016/j.commatsci.2024.112884"
33
+ references:
34
+ - type: article
35
+ title: "3D stochastic bicontinuous microstructures: Generation, topology and elasticity"
36
+ authors:
37
+ - family-names: "Soyarslan"
38
+ given-names: "Celal"
39
+ - family-names: "Bargmann"
40
+ given-names: "Swantje"
41
+ - family-names: "Pradas"
42
+ given-names: "Marc"
43
+ - family-names: "Weissmüller"
44
+ given-names: "Jörg"
45
+ journal: "Acta Materialia"
46
+ volume: 149
47
+ start: 326
48
+ end: 340
49
+ year: 2018
50
+ doi: "10.1016/j.actamat.2018.01.005"
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Nicolas Vazquez
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,154 @@
1
+ Metadata-Version: 2.5
2
+ Name: nanofoams
3
+ Version: 0.1.0
4
+ Summary: Generation of periodic stochastic bicontinuous (nanoporous) atomistic samples, after Soyarslan et al. (2018).
5
+ Project-URL: Homepage, https://github.com/nicolasvazquez95/nanofoams
6
+ Project-URL: Documentation, https://nicolasvazquez95.github.io/nanofoams/
7
+ Project-URL: Changelog, https://github.com/nicolasvazquez95/nanofoams/blob/main/CHANGELOG.md
8
+ Project-URL: Source, https://github.com/nicolasvazquez95/nanofoams
9
+ Project-URL: Issues, https://github.com/nicolasvazquez95/nanofoams/issues
10
+ Author: Nicolás Vazquez von Bibow, Carlos J. Ruestes
11
+ License-Expression: MIT
12
+ License-File: LICENSE
13
+ Keywords: bicontinuous,gaussian random field,lammps,materials science,molecular dynamics,nanoporous,spinodal
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Scientific/Engineering :: Chemistry
24
+ Classifier: Topic :: Scientific/Engineering :: Physics
25
+ Requires-Python: >=3.10
26
+ Requires-Dist: numpy>=1.24
27
+ Requires-Dist: scipy>=1.10
28
+ Requires-Dist: tomli>=1.1; python_version < '3.11'
29
+ Provides-Extra: analysis
30
+ Requires-Dist: scikit-image>=0.21; extra == 'analysis'
31
+ Provides-Extra: dev
32
+ Requires-Dist: ase>=3.22; extra == 'dev'
33
+ Requires-Dist: matplotlib>=3.7; extra == 'dev'
34
+ Requires-Dist: pre-commit>=3; extra == 'dev'
35
+ Requires-Dist: pytest>=8; extra == 'dev'
36
+ Requires-Dist: ruff>=0.6; extra == 'dev'
37
+ Requires-Dist: scikit-image>=0.21; extra == 'dev'
38
+ Provides-Extra: docs
39
+ Requires-Dist: matplotlib>=3.7; extra == 'docs'
40
+ Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
41
+ Requires-Dist: mkdocstrings[python]>=0.26; extra == 'docs'
42
+ Provides-Extra: gpu
43
+ Requires-Dist: cupy-cuda12x>=13; extra == 'gpu'
44
+ Provides-Extra: legacy
45
+ Requires-Dist: loky; extra == 'legacy'
46
+ Requires-Dist: tqdm; extra == 'legacy'
47
+ Provides-Extra: test
48
+ Requires-Dist: ase>=3.22; extra == 'test'
49
+ Requires-Dist: matplotlib>=3.7; extra == 'test'
50
+ Requires-Dist: pytest>=8; extra == 'test'
51
+ Requires-Dist: scikit-image>=0.21; extra == 'test'
52
+ Description-Content-Type: text/markdown
53
+
54
+ # nanofoams
55
+
56
+ [![CI](https://github.com/nicolasvazquez95/nanofoams/actions/workflows/ci.yml/badge.svg)](https://github.com/nicolasvazquez95/nanofoams/actions/workflows/ci.yml)
57
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
58
+
59
+ **Periodic stochastic bicontinuous structures for atomistic simulations.**
60
+
61
+ `nanofoams` builds atomistic samples of nanoporous metals with the
62
+ Gaussian-random-field method of
63
+ [Soyarslan et al. (2018)](https://doi.org/10.1016/j.actamat.2018.01.005), and
64
+ writes them as LAMMPS data files ready for molecular dynamics.
65
+
66
+ <img src="https://raw.githubusercontent.com/nicolasvazquez95/nanofoams/main/docs/assets/foam_100a0_54.png" width="360" alt="Nanoporous bcc foam">
67
+
68
+ - **Exactly periodic** sc, bcc and fcc samples.
69
+ - **Fast.** Exact FFT evaluation generates a 54-million-atom sample in ~3 s on a
70
+ laptop CPU; the original implementation took ~32 h. Optional GPU backend.
71
+ - **Reproducible.** One seed controls everything, and each run writes a JSON log
72
+ that regenerates identical files.
73
+ - **Analytical morphology** (surface density, curvatures, genus) and numerical
74
+ measurement to check it.
75
+ - **Sanity checks** for percolation, anisotropy and representative volume size.
76
+
77
+ ## Install
78
+
79
+ ```console
80
+ pip install nanofoams
81
+ ```
82
+
83
+ Until the first PyPI release:
84
+ `pip install "git+https://github.com/nicolasvazquez95/nanofoams"`.
85
+ Python 3.10+, NumPy and SciPy.
86
+
87
+ ## Use
88
+
89
+ From the command line, with a TOML config:
90
+
91
+ ```toml
92
+ # foam.toml
93
+ lattice = "bcc"
94
+ lattice_parameter = 3.303 # Ta, Angstrom
95
+ cells = 100
96
+ solid_fraction = 0.30
97
+ h2 = 54 # or: ligament_diameter = 25.0
98
+ seed = 42
99
+ ```
100
+
101
+ ```console
102
+ nanofoams generate foam.toml # -> foam.data (+ foam.json log)
103
+ nanofoams info foam.toml # predicted morphology and warnings
104
+ ```
105
+
106
+ From Python:
107
+
108
+ ```python
109
+ import nanofoams
110
+
111
+ foam = nanofoams.generate(
112
+ lattice="bcc",
113
+ lattice_parameter=3.303,
114
+ cells=100,
115
+ solid_fraction=0.30,
116
+ h2=54,
117
+ seed=42,
118
+ )
119
+ foam.write_lammps_data("foam.data")
120
+ foam.morphology.ligament_diameter # 25.6 Angstrom
121
+ ```
122
+
123
+ See [`examples/quickstart.ipynb`](examples/quickstart.ipynb) and the
124
+ [documentation](https://nicolasvazquez95.github.io/nanofoams/) (theory, parameter guide, CLI, API, validation).
125
+
126
+ ## How to cite
127
+
128
+ If you use this code, please cite:
129
+
130
+ > N. Vazquez von Bibow, E. N. Millán, C. J. Ruestes, *Topological changes and
131
+ > deformation mechanisms of nanoporous Ta under compression*, Computational
132
+ > Materials Science 236 (2024) 112884.
133
+ > [doi:10.1016/j.commatsci.2024.112884](https://doi.org/10.1016/j.commatsci.2024.112884)
134
+
135
+ and the method, C. Soyarslan, S. Bargmann, M. Pradas, J. Weissmüller, Acta
136
+ Materialia 149 (2018) 326-340. BibTeX entries are in
137
+ [`references.bib`](references.bib).
138
+
139
+ ## History
140
+
141
+ This package rewrites the code of the undergraduate thesis of N. Vazquez
142
+ (FCEN-UNCuyo, 2023). The original scripts are kept, unmodified, in
143
+ [`legacy/`](legacy/) and serve as regression references for the test-suite.
144
+ [Changes from the thesis code](docs/legacy.md) lists the corrections made since.
145
+
146
+ ## Acknowledgements
147
+
148
+ Python implementation by Nicolás Vazquez and Carlos J. Ruestes, based on the
149
+ article by Soyarslan et al. Funded by ANPCyT PICT-2018-0773 and European
150
+ Commission Grant Agreement 101062254 (MeNaWir, MSCA Postdoctoral Fellowships).
151
+
152
+ ## License
153
+
154
+ [MIT](LICENSE)
@@ -0,0 +1,101 @@
1
+ # nanofoams
2
+
3
+ [![CI](https://github.com/nicolasvazquez95/nanofoams/actions/workflows/ci.yml/badge.svg)](https://github.com/nicolasvazquez95/nanofoams/actions/workflows/ci.yml)
4
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
5
+
6
+ **Periodic stochastic bicontinuous structures for atomistic simulations.**
7
+
8
+ `nanofoams` builds atomistic samples of nanoporous metals with the
9
+ Gaussian-random-field method of
10
+ [Soyarslan et al. (2018)](https://doi.org/10.1016/j.actamat.2018.01.005), and
11
+ writes them as LAMMPS data files ready for molecular dynamics.
12
+
13
+ <img src="https://raw.githubusercontent.com/nicolasvazquez95/nanofoams/main/docs/assets/foam_100a0_54.png" width="360" alt="Nanoporous bcc foam">
14
+
15
+ - **Exactly periodic** sc, bcc and fcc samples.
16
+ - **Fast.** Exact FFT evaluation generates a 54-million-atom sample in ~3 s on a
17
+ laptop CPU; the original implementation took ~32 h. Optional GPU backend.
18
+ - **Reproducible.** One seed controls everything, and each run writes a JSON log
19
+ that regenerates identical files.
20
+ - **Analytical morphology** (surface density, curvatures, genus) and numerical
21
+ measurement to check it.
22
+ - **Sanity checks** for percolation, anisotropy and representative volume size.
23
+
24
+ ## Install
25
+
26
+ ```console
27
+ pip install nanofoams
28
+ ```
29
+
30
+ Until the first PyPI release:
31
+ `pip install "git+https://github.com/nicolasvazquez95/nanofoams"`.
32
+ Python 3.10+, NumPy and SciPy.
33
+
34
+ ## Use
35
+
36
+ From the command line, with a TOML config:
37
+
38
+ ```toml
39
+ # foam.toml
40
+ lattice = "bcc"
41
+ lattice_parameter = 3.303 # Ta, Angstrom
42
+ cells = 100
43
+ solid_fraction = 0.30
44
+ h2 = 54 # or: ligament_diameter = 25.0
45
+ seed = 42
46
+ ```
47
+
48
+ ```console
49
+ nanofoams generate foam.toml # -> foam.data (+ foam.json log)
50
+ nanofoams info foam.toml # predicted morphology and warnings
51
+ ```
52
+
53
+ From Python:
54
+
55
+ ```python
56
+ import nanofoams
57
+
58
+ foam = nanofoams.generate(
59
+ lattice="bcc",
60
+ lattice_parameter=3.303,
61
+ cells=100,
62
+ solid_fraction=0.30,
63
+ h2=54,
64
+ seed=42,
65
+ )
66
+ foam.write_lammps_data("foam.data")
67
+ foam.morphology.ligament_diameter # 25.6 Angstrom
68
+ ```
69
+
70
+ See [`examples/quickstart.ipynb`](examples/quickstart.ipynb) and the
71
+ [documentation](https://nicolasvazquez95.github.io/nanofoams/) (theory, parameter guide, CLI, API, validation).
72
+
73
+ ## How to cite
74
+
75
+ If you use this code, please cite:
76
+
77
+ > N. Vazquez von Bibow, E. N. Millán, C. J. Ruestes, *Topological changes and
78
+ > deformation mechanisms of nanoporous Ta under compression*, Computational
79
+ > Materials Science 236 (2024) 112884.
80
+ > [doi:10.1016/j.commatsci.2024.112884](https://doi.org/10.1016/j.commatsci.2024.112884)
81
+
82
+ and the method, C. Soyarslan, S. Bargmann, M. Pradas, J. Weissmüller, Acta
83
+ Materialia 149 (2018) 326-340. BibTeX entries are in
84
+ [`references.bib`](references.bib).
85
+
86
+ ## History
87
+
88
+ This package rewrites the code of the undergraduate thesis of N. Vazquez
89
+ (FCEN-UNCuyo, 2023). The original scripts are kept, unmodified, in
90
+ [`legacy/`](legacy/) and serve as regression references for the test-suite.
91
+ [Changes from the thesis code](docs/legacy.md) lists the corrections made since.
92
+
93
+ ## Acknowledgements
94
+
95
+ Python implementation by Nicolás Vazquez and Carlos J. Ruestes, based on the
96
+ article by Soyarslan et al. Funded by ANPCyT PICT-2018-0773 and European
97
+ Commission Grant Agreement 101062254 (MeNaWir, MSCA Postdoctoral Fellowships).
98
+
99
+ ## License
100
+
101
+ [MIT](LICENSE)