Commit dd1a240
authored
Refactor: structured INPUT parameter availability (Phase 1) (deepmodeling#7783)
* Tools: add structured parser for INPUT availability strings
The Input_Item availability field mixes prose and ad-hoc conditions as free
text, which cannot be consumed programmatically for tree-structured docs,
validation or agent tooling.
Add a small dependency-free parser (tools/03_code_analysis/availability_parser.py)
that normalises the historical spellings (==, =, 'is set to', 'contains')
onto a canonical form and classifies each value as an Expression, a bare
Label, or Unstructured prose waiting for review.
- availability_parser.py: parse_availability() -> Availability
- test_availability_parser.py: unit tests
- generate_input_main.py: add --check-availability to report the
Expression/Label/Unstructured distribution without changing the generated
markdown.
On the current docs/parameters.yaml this classifies 217 non-empty values as
82 Expression / 84 Label / 51 Unstructured.
* feat(input): structured availability for INPUT parameters (Phase 1)
Make the Input_Item availability field a concrete, machine-readable boolean
condition (single source of truth) so the INPUT docs, validation and tooling
can consume the actual condition instead of free text or bare tags.
- Add AvailabilityKind/AvailabilityCondition/AvailabilityExpr and
parse_availability() in a new module (availability.{h,cpp}, wired into CMake).
- Input_Item now carries availability_kind + availability_expr and a
set_availability() helper that keeps the canonical string and the structured
form in sync (single source of truth).
- Rewrite all 217 non-empty availability registrations to canonical boolean
syntax; the exported YAML classifies them as 216 Expression / 0 Unstructured.
- Export the structured fields from --generate-parameters-yaml (input_help.cpp).
- Consume the structured fields in generate_input_main.py; extend
availability_parser.py to the canonical grammar and cover it with tests.
- Regenerate docs/parameters.yaml and input-main.md.
Former bare "label"-style tags (e.g. "OFDFT", "Numerical atomic orbital basis")
are now expressed as concrete conditions (esolver_type==ofdft, basis_type==lcao,
...) so they can be evaluated by validation/error tooling. mixing_tau has no hard
gate, so its availability is empty (always available); its meta-GGA relevance is
kept in the description.
* fix(input): enforce canonical availability metadata
* refactor(input): drop redundant python availability tooling
The strict C++ parse_availability() in Input_Item::set_availability() is now
the single source of truth for the availability grammar (it throws on any
non-canonical non-empty string). The legacy python classifier, its unit tests,
and the --check-availability report plumbing in generate_input_main.py were an
earlier design step and are no longer referenced by any workflow; remove them
to keep a single grammar implementation.
* fix(input): harden availability metadata
* docs(input): keep review context out of repository
* docs(input): generalize availability guide
* fix(input): validate availability prerequisites
* fix(input): quote multi-token availability values
* fix(input): standardize vector containment syntax
* fix(input): keep contains for vector availability
* fix(build): include availability objects in Makefile
* fix(input): align mixing_dmr availability
---------
Co-authored-by: Stardust0831 <169599847+Stardust0831@users.noreply.github.com>1 parent 65a5039 commit dd1a240
33 files changed
Lines changed: 1930 additions & 901 deletions
File tree
- docs
- advanced/input_files
- developers_guide
- source
- source_io
- module_parameter
- test
- test_serial
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
| 175 | + | |
176 | 176 | | |
177 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
178 | 181 | | |
179 | 182 | | |
180 | 183 | | |
| |||
198 | 201 | | |
199 | 202 | | |
200 | 203 | | |
201 | | - | |
| 204 | + | |
202 | 205 | | |
203 | 206 | | |
204 | 207 | | |
205 | 208 | | |
206 | 209 | | |
207 | | - | |
| 210 | + | |
208 | 211 | | |
209 | 212 | | |
210 | 213 | | |
| |||
218 | 221 | | |
219 | 222 | | |
220 | 223 | | |
221 | | - | |
| 224 | + | |
222 | 225 | | |
223 | 226 | | |
224 | 227 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
223 | 227 | | |
224 | 228 | | |
225 | 229 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
144 | 165 | | |
145 | 166 | | |
146 | 167 | | |
| |||
153 | 174 | | |
154 | 175 | | |
155 | 176 | | |
156 | | - | |
157 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
158 | 180 | | |
159 | 181 | | |
160 | 182 | | |
| |||
184 | 206 | | |
185 | 207 | | |
186 | 208 | | |
187 | | - | |
| 209 | + | |
| 210 | + | |
188 | 211 | | |
189 | 212 | | |
190 | 213 | | |
191 | 214 | | |
192 | 215 | | |
193 | 216 | | |
194 | | - | |
| 217 | + | |
195 | 218 | | |
196 | 219 | | |
197 | 220 | | |
| |||
266 | 289 | | |
267 | 290 | | |
268 | 291 | | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
269 | 295 | | |
270 | 296 | | |
271 | 297 | | |
| |||
281 | 307 | | |
282 | 308 | | |
283 | 309 | | |
284 | | - | |
| 310 | + | |
285 | 311 | | |
286 | 312 | | |
287 | 313 | | |
| |||
0 commit comments