Skip to content

Changes from the thesis code

nanofoams replaces the scripts written for the thesis (kept unmodified in legacy/). With the same directions and phases it computes the same field and the same classification. The differences are listed here.

Corrections

thesis code / text nanofoams
surface density in the log \(e^{-\xi/2}\) \(e^{-\xi^2/2}\) (Soyarslan eq. 12); ~50 % difference at \(\phi_B = 0.3\)
reduced genus \(G_V S^{-3}\) (thesis text) \(\frac{3\pi}{32}(1-\xi^2)e^{\xi^2/2}\) \(\frac{\pi}{32}(1-\xi^2)e^{\xi^2}\), which follows from eqs. 12 and 15; 0.094 instead of 0.245 at \(\phi_B = 0.3\)
scaled genus g_v in the log \(G_V L^3\) with \(L\) the ligament diameter kept as genus_per_ligament_volume; Soyarslan's \(G_V\tilde{L}^3\) is scaled_genus_density
normalisation in the TensorFlow version \(\sqrt{2/N}\) with the requested \(N\) \(\sqrt{2/N}\) with the number of waves actually summed

Behaviour

  • Reproducibility. The legacy direction generator used Python's unseeded random to choose signs, so the same seed could give different foams unless the H2_<n>.txt cache file already existed. Directions are now deterministic and a single seed controls the phases.
  • No cache files. H2_database.txt and H2_<n>.txt are replaced by valid_h2 and miller_indices.
  • Box size. The box is a whole number of unit cells. The legacy code computed int(size / a0) cells, which left a gap at the periodic boundary when the size was not an exact multiple.
  • Validation. The period must divide the box, so samples are always periodic.
  • Random numbers. Phases come from numpy.random.default_rng(seed) instead of the legacy global np.random.seed. A converted legacy input gives a foam with the same statistics, not the same realisation.
  • Output. A LAMMPS data file (solid atoms) by default; the legacy dump format with f is still available. Writing is vectorised.
  • Speed. See Backends.