Calculate the composition (concentration) of atom probe data. Handles range extraction, ion allocation, and concentration calculation. Use when the user asks about composition, concentration, or chemical analysis.
Calculate the bulk composition from the current mass spectrum and pos data. Use the MATLAB MCP server.
The MATLAB workspace must contain:
pos — loaded atom probe data (from /apt-load)spec — mass spectrum figure with ions and ranges defined (from /apt-spectrum + rangeAddAll)If ranges haven't been defined yet, tell the user they need to define ranges first:
rangeAddAll(spec, colorScheme, 0.04, true);
rangeTable = rangesExtractFromMassSpec(spec);
disp(rangeTable);
pos = posAllocateRange(pos, rangeTable, 'decomposed');
Use 'decomposed' mode to break molecular ions into constituent atoms. If the user specifically wants molecular ion identities, use 'direct' instead.
If the user provided an instrument as $ARGUMENTS, map it to detection efficiency:
Otherwise, read it from the config:
cfg = APTConfig.getInstance();
detEff = cfg.reconstruction.detectionEfficiency;
If the detection efficiency is still the default (0.37) and the user hasn't confirmed their instrument, ask which instrument was used.
conc = posCalculateConcentrationSimple(pos, detEff, {'unranged'}, '', 'mode', 'atomic');
disp(conc);
Exclude 'unranged' atoms by default. If the user wants to include them or exclude other species, adjust the exclude list.
unc = concentrationUncertainty(conc.counts);
Present results as a formatted table showing:
Ask if the user wants to:
writetable(conc, 'composition.csv')