Inspiration

Designing terahertz metasurfaces is usually a slow, trial-and-error process. A researcher proposes a geometry, runs an electromagnetic simulation, inspects the spectrum, modifies several parameters, and repeats the process. This becomes especially difficult when the desired response contains a narrow resonance, because small geometric changes can strongly affect the resonance frequency, linewidth, and transmission depth.

We built Spectra2Structure to reverse this workflow: instead of starting from a geometry, the researcher starts from a desired transmission spectrum. The system then proposes multiple geometry-constrained metasurface candidates and organizes them into a reproducible simulation and validation workflow.

What it does

Spectra2Structure is an AI-assisted research workflow for inverse design of terahertz double-gap split-ring resonator metasurfaces.

The current prototype can:

  • Accept a target terahertz transmission spectrum.
  • Predict candidate geometric parameters for the metasurface.
  • Generate and rank multiple inverse-design candidates rather than returning only one solution.
  • Evaluate resonance properties such as center frequency, dip depth, linewidth, and Q factor.
  • Reject candidates that violate geometric or spectral constraints.
  • Prepare selected candidates for CST electromagnetic simulation.
  • Track simulation status, failures, exported spectra, and validation evidence.
  • Separate machine-learning predictions from actual electromagnetic validation.

This last point is important: a neural-network prediction is treated as a candidate proposal, not as physical proof. Final claims are based on CST-screened results and reproducible evaluation criteria.

How we built it

The project combines a tandem neural-network architecture with a failure-aware scientific workflow.

A forward model learns the mapping from six geometric parameters to the transmission spectrum. The inverse model receives a target spectrum and predicts candidate geometries. Because inverse electromagnetic design is non-unique, the system retains multiple candidates and ranks them using spectral agreement, manufacturability constraints, and resonance-quality metrics.

The workflow is implemented primarily in Python and PyTorch. NumPy, pandas, SciPy, and Matplotlib are used for spectrum processing, resonance extraction, data analysis, and visualization. CST Studio Suite is used for full-wave electromagnetic validation.

OpenAI Codex was used as a research engineering copilot to:

  • Audit and refactor the existing scientific codebase.
  • Trace data and simulation workflows across multiple scripts.
  • Design reproducible candidate-screening procedures.
  • Separate spectrum extraction from field-export failures.
  • Add structured status files and failure reporting.
  • Review experiment logic and identify unsupported scientific claims.
  • Improve documentation so that each result can be traced back to its model, geometry, simulation configuration, and evaluation criteria.

Challenges we faced

One major challenge was accurately representing narrow, high-Q-like resonances. These features may occupy only a small number of frequency samples, making them difficult for both neural networks and electromagnetic simulations to reproduce consistently.

A second challenge was the one-to-many nature of inverse design. Different geometries may produce similar spectra, so evaluating only parameter error can be misleading. We therefore focus on response-level agreement and retain several physically plausible candidates.

We also encountered practical simulation failures, including solver termination, memory limitations, missing field exports, and incomplete batch runs. This motivated us to build a failure-aware pipeline in which a field-export problem does not automatically invalidate an otherwise successful spectrum calculation.

Finally, we had to maintain a strict validation hierarchy: surrogate-model agreement, candidate ranking, CST spectral screening, and field or refractive-index analysis are recorded as different levels of evidence.

What we learned

We learned that successful scientific AI requires more than an accurate model. Physical constraints, provenance tracking, failure handling, and reproducible validation are equally important.

We also learned that inverse design should not be presented as a single “best answer.” A more useful system proposes a diverse set of candidates, explains why they were selected, and makes the next simulation step clear.

Codex was especially useful for turning a collection of research scripts into a more auditable workflow. It helped us identify hidden assumptions, connect disconnected stages, and define clear boundaries between AI-generated proposals and physics-based validation.

What's next

Next, we plan to integrate the final CST simulation template, improve narrow-resonance sampling, add uncertainty-aware candidate ranking, and perform controlled refractive-index sweeps for selected candidates.

We also plan to build an interactive interface where researchers can draw or upload a target spectrum, inspect proposed geometries, compare predicted responses, and export a reproducible CST validation package.

Built With

Share this project:

Updates