Skip to content

Disordered carbons ​

Convolution surface ​

A net (dia or pcu) is repeated over the recipe's supercell, its vertices and edge midpoints are distorted by a seeded draw, and every edge is sampled with beads 0.3 Angstrom apart. The field is the sum of Gaussians of width 0.5 R over those beads, not a distance to the nearest edge: four struts add smoothly at a node, while a distance field creases there. The marched level is the field a distance R from an endless row of beads has, so along an edge the sheet is a tube of radius R = radius_ratio * edge_length.

The periodic grid spans one cell including both faces, and the marching tetrahedra output is welded by fractional position. The sheet is closed and its Euler characteristic is 2(V - E) of the net quotient.

Remesh ​

The fine sheet is remeshed towards an even triangulation:

  1. split every edge longer than the upper threshold,
  2. collapse every edge shorter than the lower threshold, refusing a collapse that would pinch the sheet or turn a triangle over,
  3. flip towards valence six,
  4. move each vertex tangentially to its neighbours and project it back onto the level set with a capped Newton step.

The target is 3.55 Angstrom, which settles the dual's bonds near 1.50 Angstrom. The reference aims at 2.46 Angstrom and reaches 1.42 Angstrom bonds; the difference is documented below.

Ribbons ​

The recipe keeps a fraction of the sheet, not the whole tube network. Each net edge gets a shortest path over the triangle graph from the anchor of one net vertex to the anchor of the other; the anchors are shared, so the paths form the net's own connected network. The kept carbon is the set of graph nodes nearest that network, grown until the largest piece holds the carbon count the density asks for and percolates in all three directions.

Dual and termination ​

One carbon sits at every kept triangle centre, bonded across every shared edge; the graph is three-coordinate by construction. Edge carbons (fewer than three neighbours) receive the recipe's hydroxyl, carbonyl, fluorine and hydrogen counts, with the ethers taking a carbon's place. Edge carbons beyond the requested ratios are left bare and said in the notes.

The structure states its bonds explicitly. The ring census reads those stored bonds (ring_counts_explicit), so a close contact across a pore is never perceived as a bond.

Recipe and report ​

CarbonRecipe holds the net, repeat, density, radius ratio, coverage, layer count, distortions, Stone-Wales rate, termination ratios and seed. build_carbon returns CarbonBuild with the structure, ring census, carbon density, H/C, F/C and O/C, edge fraction, mean C-C bond, pieces, periodicity, closed-sheet carbon count, bare edges and notes.

Validation ​

tests/carbon_golden.rs reads tests/golden/phase-6/carbon/dia.json, generated by scripts/golden/carbon.py from Crystal-Builder's recipe builder (diamond 1x1x1, 0.42 g/cm3, 38 % coverage, seed 0, relaxation off). The RNG and the remesh differ, so the test is statistical:

  • atom count within 10 % (reference 420),
  • carbon density within 0.03 g/cm3,
  • H/C, F/C and O/C within 0.03,
  • edge fraction within 0.08 (reference 0.43),
  • one piece percolating in three directions,
  • mean C-C between 1.25 and 1.56 Angstrom,
  • closed-sheet carbon count within 15 %,
  • six-membered rings are the mode, and the total ring count is at least half the reference.

Documented deviations ​

  • The seeded RNG is not numpy's, so the atom list is not identical.
  • The remesh target is chosen for 1.50 Angstrom dual bonds; the reference's 2.46 Angstrom target gives 1.42 Angstrom. The density and the counts still agree within the tolerances above.
  • Stone-Wales pairs are accepted by CarbonRecipe but not placed.
  • Only one layer is supported; a multi-layer recipe is refused.
  • The ribbon path is a shortest path over the triangle graph, not the reference's noise-weighted spine.