Skip to content

Source

Engine quan_loncar_v1 · package package/quan_loncar_optimizer · assembled 2026-07-29 15:57 UTC.


Trust contract

The optimizer is allowed to propose analytical designs. It is not allowed to declare them physically better without matched FDTD evidence.

Analytical state

The current state contains the complete geometry, converged complex pole, complex right eigenvector, Q, wavelength, channel observables, 45-coordinate gradient, resonance gradient, trust radius, BFGS matrix, full history, and accepted FDTD incumbent.

There is no persistent global frequency derivative. The full custom VJP is recomputed at every accepted geometry.

Trial evaluation

For every line-search trial:

  1. Project the proposed direction to remove first-order real-frequency drift.
  2. Limit its scaled L2 displacement by the physical trust radius and exact geometry constraints.
  3. Use the implicit resonance prediction only as a pole seed.
  4. Reassemble the frequency-dependent operator and solve a fresh complex pole.
  5. Track the previous right eigenvector.
  6. Evaluate the candidate with the production P2-z1/y3-z1 operator.

The candidate is rejected if any gate fails:

  • exact geometry constraints;
  • passive pole, \(\operatorname{Im}\tilde\omega<0\);
  • local branch overlap at least 0.999 after initialization;
  • physical-template overlap at least 0.80;
  • operator residual at most \(10^{-8}\);
  • reciprocity error at most \(10^{-10}\);
  • strictly higher analytical Q;
  • the Q-form Armijo condition with \(c_1=0.05\);
  • absolute local log-Q gain no larger than 0.25.

The last gate prevents a local model from accepting implausible exponential growth. It is a rejection heuristic, not evidence that smaller gains are correct.

The line search starts with the current trust radius and halves it at most five times. If no candidate passes, the global trust radius is halved and BFGS is reset. The run stalls rather than going below 0.0625 nm.

Accepted analytical step

Passing the pole gate is not enough. The optimizer then recomputes the complete custom VJP at that exact pole. The step is retained only if:

  • the pole and VJP Q values agree to \(2\times10^{-9}\) relative;
  • the custom-VJP operator residual is at most \(10^{-8}\);
  • right and left equation errors are at most \(2\times10^{-8}\);
  • scattering-residue reciprocity error is at most \(10^{-10}\);
  • all gradient entries are finite.

The complete state and trial history are written atomically after each accepted step.

BFGS

The default method is projected steepest descent because it is the method with positive FDTD history.

Optional inverse BFGS:

  • begins only after two steepest-descent warm-up steps;
  • updates only after an accepted analytical step;
  • skips when \(s^Ty\le10^{-8}\lVert s\rVert\lVert y\rVert\);
  • symmetrizes the update and verifies positive definiteness;
  • resets if the proposed direction is not a descent direction;
  • resets when the projected gradient cosine falls below 0.25;
  • resets after a failed line search;
  • resets after any FDTD rollback.

BFGS is never an acceptance authority.

FDTD checkpoint

The default cadence is two accepted analytical steps.

Each checkpoint serializes:

  • the immutable accepted-incumbent geometry;
  • the analytical candidate geometry;
  • distinct geometry hashes and simulation names;
  • the analytical prediction;
  • the exact state file and acceptance rule.

Both geometries must be simulated under the same FDTD settings. The CLI requires the matched incumbent and candidate result when a convergence pass is claimed. The candidate is accepted only when both results are converged and its Q exceeds the matched incumbent Q.

A rejected candidate:

  • is appended to fdtd_history;
  • never becomes the incumbent geometry;
  • triggers rollback to the accepted incumbent;
  • halves the trust radius;
  • clears BFGS curvature.

A new converged measurement of the same incumbent geometry may update the incumbent's recorded Q. This is measurement refinement, not promotion of a rejected candidate.

Stop conditions

Stop and diagnose when:

  • the local perturbation panel loses FDTD sign or rank correlation;
  • the stricter basis audit fails;
  • repeated line searches reach the minimum trust radius;
  • the physical branch or symmetry sector becomes ambiguous;
  • FDTD improvement cannot be reproduced under convergence refinement;
  • analytical Q rises while matched FDTD Q falls.

Do not continue by lowering overlap standards, enlarging the step, or accepting an unconverged FDTD result.