Feature inventory¶
Two copies of one list¶
cpmdc keeps its capability list twice.
src/cpmdc_features.c compiles it into the library, where
cpmdc_feature_count(), cpmdc_feature_table(), and cpmdc_feature_find()
serve it at run time.
schema/inventory/cpmd_features.json holds the same rows with metadata for
the checks.
The Meson suite fails when the two copies, the schema, the headers, or the
docs drift apart.
Feature IDs¶
Namespace |
Kind |
Example |
Means |
|---|---|---|---|
|
|
|
an exported C function |
|
|
|
a top-level |
|
|
|
a typed field inside a section arm |
|
|
|
a deck section OpenCPMD’s parser reads with |
|
|
|
a |
|
|
|
a |
|
inventory only |
|
a |
A params.* row names a field you can write.
A catalog.* row says that the renderer can emit a keyword or section,
often through a text field of a typed section rather than a field of its own.
stub_applicable and embed_applicable say whether the stub build and the
OpenCPMD build expose the row.
Query it from C¶
const CPMDCFeatureEntry *e = cpmdc_feature_find("params.inputSections.cpmd.odiisVectors");
if (e != NULL && e->embed_applicable) {
/* this library renders ODIIS with a vector count */
}
for (size_t i = 0; i < cpmdc_feature_count(); ++i) {
const CPMDCFeatureEntry *row = &cpmdc_feature_table()[i];
/* row->feature_id, row->kind, row->stub_applicable, row->embed_applicable */
}
The inventory file¶
Top-level keys of schema/inventory/cpmd_features.json:
Key |
Holds |
|---|---|
|
inventory format version |
|
the schema file it describes |
|
the OpenCPMD source it was probed against, as a description, never a local path |
|
the 25 sections OpenCPMD parses with |
|
the |
|
the top-level |
|
every public |
|
keyword and functional catalogs |
|
one object per row: |
Plain-text companions in schema/inventory/: opencpmd_sections.txt (the
section allowlist), cpmd_cp_keywords.txt (base &CPMD keywords),
dft_functionals.txt, and surface_map_abi.txt.
The checks¶
All run in the default Meson suite; the inventory suite selects most of
them.
Test |
Fails when |
|---|---|
|
the JSON inventory disagrees with |
|
a base |
|
a top-level |
|
a public |
|
the stub test does not assert every |
|
the |
|
a typed |
|
an inline option token in a fixture has no render coverage |
|
a typed |
|
a |
|
|
Run them together:
meson test -C build --suite inventory --print-errorlogs
To include the live probe, point CPMD_ROOT at an OpenCPMD source tree:
CPMD_ROOT=/path/to/opencpmd meson test -C build feature-inventory -v
A passing live probe prints probed /path/to/opencpmd: 25 inscan sections.
Without CPMD_ROOT the test prints a warning and skips that part.
Add a row¶
Adding a typed keyword touches the schema, the renderer, the C table, the inventory file, and the option docs in one change; the contributing guide lists the files and the focused test command.