Skip to content

docs: the interfaces supercell gap is the cell-dependent kernel radius and grid - #254

Merged
yonghakim merged 3 commits into
mainfrom
claude/brave-pascal-y6pk4q
Nov 24, 2026
Merged

yonghakim merged 3 commits into
mainfrom
claude/brave-pascal-y6pk4q

Conversation

@yonghakim

Copy link
Copy Markdown
Member

Why

#250 traced the default NVF's supercell/primitive gap to the closed-form normal field. It left one gap untraced: under shape_normal_method='interfaces', a supercell of four identical TiO2 pillars still differs from the primitive cell by 3.7e-7 in T and 6.1e-4 rad in phase at M = 3. This PR traces that gap and writes the cause down.

The cause

The boundary-integral field (known limits §1c) reads two inputs off the cell rather than the structure:

  • Kernel radius R. R is half the longest diagonal of the reduced cell (src/wavebit/rcwa/_engine/integrated_normal.py). It is 303.109 nm for the primitive hexagonal cell and 630.971 nm for the (4*a1, a2) supercell, whose reduced basis is (4*a1 + 2*a2, a2). The wider kernel moves the projector coefficients by up to 1.1e-2.
  • Sample grid. The grid is shape_nvf_grid_size per side of the cell (boundary.py), so the supercell takes 256 samples per primitive period along a1 instead of 1024.

R carries 96% of the T difference and nearly all of the phase difference; the grid carries the rest. The two parts add: their interaction is at most 2e-11 in T. Once both inputs are matched, nothing else differs between the cells.

Evidence (committed study)

The new --part cause of studies/rcwa/supercell_normal_field/ runs these arms:

  • the primitive cell with none, one or both of the supercell's inputs;
  • the supercell with the primitive cell's R.

It forces the inputs by wrapping integrated_normal._sparse_fields and boundary.normal_projector_coeffs for the duration of a solve. It asserts that each wrapper ran exactly once per solve and that the closure arms agree below 1e-12.

At M = 3 (M = 4 in the record):

arm minus primitive T phase (rad) largest coefficient (constant term)
supercell +3.739e-7 -6.129e-4 1.1e-2 (4.3e-7)
primitive, R(4) +3.582e-7 -6.116e-4 1.1e-2 (1.5e-14)
primitive, grid / 4 +1.573e-8 -1.359e-6 5.5e-7 (4.3e-7)
primitive, R(4), grid / 4 +3.739e-7 -6.129e-4 1.1e-2 (4.3e-7)
supercell, R(1) +1.573e-8 -1.359e-6 5.5e-7 (4.3e-7)

The closures hold at M = 3 and M = 4:

  • Given both of the supercell's inputs, the primitive cell reproduces the supercell to 1.3e-14 in T, 9e-14 in the zero-order amplitude and 6e-17 in the coefficients.
  • Given the primitive cell's R, the supercell reproduces the primitive cell on the coarse grid to 5.6e-14, 3.5e-13 and 3e-17.

What changes

  • studies/rcwa/supercell_normal_field/: the --part cause code, and its run appended to the record log. The run took about 41 minutes on four cores at 2.30 GHz (Python 3.12.3, NumPy 2.5.5).
  • docs/validation/rcwa/normal-field-known-limits.md §10: a new paragraph, "Under 'interfaces'", with the tables above. "What to do" and "Status" now name the cause. Whether R should be a length of the structure rather than of the cell is left open as a design question. Changing it would alter every 'interfaces' answer at the truncation level.
  • §1c: a cross-reference noting that R depends on how the cell is written.
  • docs/guide/rcwa/boundary-modeling.md: one clause in the supercell paragraph.
  • studies/README.md: the study's row.
  • The Korean overlays change in the same commits, following docs/locales/ko/GLOSSARY.md (사영자 for projector, as the rest of the page uses).

There are no solver source changes. The third commit applies fixes from an independent review of the first two.

Checks

  • ruff check studies/: clean.
  • tests/api: docs contract, text encoding and study record tests, 264 passed, 1 skipped.
  • tools/run_verification.py --profile quick: 17 passed.
  • sphinx -W -D wavebit_bilingual=1, English and Korean, from empty output directories: exit 0.
  • Both new tables render one line per row at 1200 px in both languages.
  • Not run locally: the full regression (CI). test_study_bootstrap.py has 5 local failures from a missing mpmath in this environment; they fail on main too.
  • The branch rebases cleanly onto current main (05b3251).

Generated by Claude Code

…nd grid

Add `--part cause` to studies/rcwa/supercell_normal_field. Under
shape_normal_method='interfaces' a supercell of four identical TiO2 pillars
still differs from the primitive cell by 3.7e-7 in T at M = 3. Two inputs of
the boundary-integral normal field are read off the cell, not the structure:
the kernel radius R (half the longest diagonal of the reduced cell) and the
sample grid (shape_nvf_grid_size per side of the cell). The part solves each
cell with neither, one or both of the other cell's inputs at M = 3 and 4,
by wrapping integrated_normal._sparse_fields and
boundary.normal_projector_coeffs for the duration of a solve, and compares
the projector coefficients each solve builds at the primitive orders. It
asserts that each wrapper ran once per solve and that the closure arms agree
below 1e-12 in T, zero-order amplitude and coefficients.

Checks: ruff; two cheap arms reproduce the investigation (grid alone at
M = 3: dT +1.5727e-8, dphase -1.359e-6). The full run and its record follow
in the next commit. No solver source changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKzHy8heBBfVfYe8dKvUdR
…d grid

Record the run of `--part cause` and write its result into known limits
§10 (English and Korean), with a cross-reference from §1c, the boundary
guide's supercell paragraph and the studies index row.

Under shape_normal_method='interfaces' the boundary-integral field reads
two inputs off the cell rather than the structure: the kernel radius R,
half the longest diagonal of the reduced cell (303.109 nm primitive,
630.971 nm for the (4*a1, a2) supercell), and the sample grid, which is
shape_nvf_grid_size per side of the cell. Given both of the supercell's
inputs, the primitive cell reproduces the supercell to 1.3e-14 in T,
9e-14 in the zero-order amplitude and 6e-17 in the projector
coefficients at M = 3 and 4; the reverse closure holds to 5.6e-14,
3.5e-13 and 3e-17. R carries 95.8% (M = 3) and 96.4% (M = 4) of the T
difference and nearly all of the phase; the grid carries the rest. The
two add to 2e-11 in T. Status stays open: whether R should be a length
of the structure is a design question this change does not decide.

Measured 2026-11-24, Linux x86_64, Intel Xeon 2.30 GHz, four logical
cores, Python 3.12.3, NumPy 2.5.5, SciPy 1.18.1; about 41 minutes.

Checks: ruff; tests/api docs contract, text encoding and study tests
(293 passed, 4 skipped; 5 test_study_bootstrap failures from a missing
mpmath in this local environment, also failing on main); quick profile
17 passed; sphinx -W English and Korean builds from an empty directory;
the new tables checked at 1200 px for wrapping in both languages.
Not run locally: the full regression (CI).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKzHy8heBBfVfYe8dKvUdR
Independent review of the previous two commits found wording that went
beyond the measurement; correct it in English and Korean together.

- The study runs the primitive cell with neither, one or both of the
  supercell's inputs and the supercell with the primitive R only; say so
  instead of "each cell with ... the other cell's inputs", in §10, the
  study docstring and the studies index row.
- The grid's share is not shown to act "mostly through the constant
  term": state what was printed (coefficients up to 5.5e-7, constant
  terms 4.3e-7).
- A structure-based kernel radius would remove the radius part (about
  96% in T), not make the field independent of the description: the grid
  part remains.
- "The two add, to 2e-11" read as a sum; say the interaction is at most
  2e-11 in T.
- Name the two hosts (2.10 GHz; the --part cause runs at 2.30 GHz),
  define grid / 4 by axis (1024 along a2, 256 along a1) and the three
  coefficient arrays, and use 사영자 for projector as the rest of the
  Korean page does.
- Study docstring runtime: about 40 minutes (the logged arms sum to
  41 minutes); _difference docstring matches what it computes.

No change to printed output or the record.

Checks: ruff; docs contract, text encoding and study record tests
(264 passed, 1 skipped); sphinx -W English and Korean from an empty
directory; both new tables render one line per row at 1200 px.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKzHy8heBBfVfYe8dKvUdR
@yonghakim
yonghakim marked this pull request as ready for review November 24, 2026 17:34
@yonghakim
yonghakim enabled auto-merge (rebase) November 24, 2026 17:34
@yonghakim
yonghakim merged commit 9bb439f into main Nov 24, 2026
68 checks passed
@yonghakim
yonghakim deleted the claude/brave-pascal-y6pk4q branch November 24, 2026 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants