Skip to main content
Glama

Fit or optimise a SCAPS device

scaps_optimize

Fit measured J-V, QE or C-V curves and optimize solar-cell efficiency, Voc, Jsc or FF using bounded Nelder-Mead parameter searches.

Instructions

Fit device parameters to measured curves, or optimise efficiency, Voc, Jsc or FF, by bounded Nelder-Mead.

Replaces the GUI-only SCAPS curve fitter and supports several measurements at once (light and dark J-V, QE, C-V). Each simplex step is one SCAPS session per measurement condition; long runs continue as a job past wait_seconds, so poll with scaps_jobs.

Input Schema

NameRequiredDescriptionDefault
goalYesfit measured curves, maximise or minimise a J-V metric, or reach a target value.
metricNoMetric for maximize, minimize and target.
targetNoTarget value of the metric for goal 'target'.
actionsNoSCAPS action commands, e.g. {'iv.startV': 0, 'iv.stopV': 1.2, 'iv.increment': 0.02, 'qe.startlambda': 300, 'cf.points.per.decade': 5, 'intensity.ND': 1, 'spectrumcutoff.on': null, 'spectrumcutoff.longlambda': 800}. Omitted settings keep SCAPS defaults.
measuredNoFor fit: curves to match together, e.g. [{'kind': 'iv', 'file': 'Numos Ex 1 light.iv'}, {'kind': 'iv', 'x': [...], 'y': [...], 'illumination': 'dark', 'log': true, 'weight': 1}]. Files come from SCAPS measurements/ and are scaled by their area and units headers. Inline data: x in V, Hz or nm; y in mA/cm2 (SCAPS sign), nF/cm2 or %. Default illumination is light for iv and qe, dark for cv and cf.
spectrumNoSpectrum file in SCAPS spectrum/; default AM1.5G 1 sun.
variablesYesSet or action keys to vary with bounds, e.g. {'layer1.defect1.Ntotal': {'min': 1e12, 'max': 1e16, 'log': true}, 'layer2.thickness': {'min': 0.03, 'max': 0.12, 'start': 0.05}}.
definitionYesDefinition file in SCAPS def/, e.g. 'example CIGS.def'.
parametersNoOrdered SCAPS set commands in script units, e.g. {'layer1.thickness': 2, 'layer1.NA': 1e16, 'layer1.defect1.Ntotal': 1e14, 'layer1.defect1.singleacceptor': null, 'interface1.IFdefect1.Ntotal': 1e10, 'contactleft.flatband.off': null, 'contactleft.workfunction': 5.1, 'external.Rs': 0.5, 'illumination.fromleft': null, 'numerical.Shockley-Queisser_limit.always': null}. null marks commands without a value.
wait_secondsNoWait this long for the result; longer runs continue as a job.
temperature_kNoWorking point temperature in K.
max_evaluationsNo

Output Schema

NameRequiredDescriptionDefault
bestYes
checksYes
run_idYes
statusYes
historyYes
progressYes
objectiveYes
best_valueYes
evaluationsYes
best_metricsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.9/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Adds meaningful behavior beyond annotations: bounded Nelder-Mead, one SCAPS session per measurement condition per simplex step, multi-measurement support, and job continuation after wait_seconds. With annotations already declaring non-read-only/non-idempotent status, this is rich process context, though side effects on files are not fully spelled out.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded and compact: it states the core action first, then measurement support, then job behavior. Every sentence contributes, though the GUI-fitter replacement context is somewhat secondary.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complex 12-parameter schema, existing output schema, and 92% schema coverage, the description supplies the needed process context: fitting vs optimisation, multiple measurements, and long-run job polling. It is complete enough for invocation, with only minor gaps around side effects and sibling alternatives.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 92%, so the schema already documents parameters such as goal, measured curves, variables, and actions. The description adds conceptual context for fitting/optimisation but little parameter-level detail beyond what the schema provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States specific actions (fit measured curves, optimise efficiency/Voc/Jsc/FF) on SCAPS device parameters and names the method (bounded Nelder-Mead). It is clear what the tool does, but it does not explicitly contrast itself with simulation siblings such as scaps_simulate or scaps_batch.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives clear usage context for fitting versus metric optimisation, and explicitly says long runs past wait_seconds should be polled with scaps_jobs. It does not provide explicit when-not-to-use guidance or contrast with scaps_simulate/scaps_batch.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.