Skip to content

docs: regenerate INPUT parameter docs in RTD build#7621

Open
zhubonan wants to merge 6 commits into
deepmodeling:developfrom
bonan-group:codex/rtd-parameter-docs
Open

docs: regenerate INPUT parameter docs in RTD build#7621
zhubonan wants to merge 6 commits into
deepmodeling:developfrom
bonan-group:codex/rtd-parameter-docs

Conversation

@zhubonan

Copy link
Copy Markdown
Collaborator

Linked Issue

Related to #7592.

Unit Tests and/or Case Tests for my changes

No unit/case tests added. This changes the documentation build path and regenerated docs artifacts only.

Exact Verification Performed

  • Built reduced serial binary: abacus_pw_ser
  • Regenerated docs/parameters.yaml with --generate-parameters-yaml
  • Regenerated docs/advanced/input_files/input-main.md
  • Built Sphinx HTML docs locally
  • Tested the same flow in readthedocs/build:ubuntu-22.04-2024.01.29
  • Smoke-tested a temporary source metadata edit in the RTD container and confirmed it appeared in:
    • docs/parameters.yaml
    • docs/advanced/input_files/input-main.md
    • final HTML

Result: builds passed; Sphinx completed with existing docs warnings.

What's changed?

  • RTD now installs the apt dependencies needed for a reduced ABACUS build.
  • RTD builds abacus_pw_ser before Sphinx runs.
  • RTD regenerates docs/parameters.yaml from the freshly built binary.
  • Regenerated docs/parameters.yaml and input-main.md.
  • Fixed multiline default-value rendering in generate_input_main.py to avoid trailing whitespace.

INPUT Parameter Changes

  • Parameters added/removed/changed: no manual parser behavior changes.
  • docs/parameters.yaml updated: yes
  • docs/advanced/input_files/input-main.md updated: yes

Core Module Impact

None. No ABACUS runtime behavior changes.

Governance Exception

None.

Copilot AI review requested due to automatic review settings July 12, 2026 05:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Read the Docs (RTD) build to compile a reduced ABACUS binary and regenerate INPUT parameter documentation artifacts during the Sphinx build, keeping published docs aligned with the current executable’s parameter metadata.

Changes:

  • Extend .readthedocs.yaml to install build deps, build abacus_pw_ser, and regenerate docs/parameters.yaml before Sphinx runs.
  • Regenerate docs/parameters.yaml and docs/advanced/input_files/input-main.md from the binary/YAML.
  • Adjust docs/generate_input_main.py default-value rendering for multiline defaults.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

File Description
.readthedocs.yaml Adds RTD pre-build steps to compile a reduced binary and regenerate docs/parameters.yaml before Sphinx.
docs/generate_input_main.py Updates markdown generation for multiline default values.
docs/parameters.yaml Regenerated parameter metadata YAML committed to the repo.
docs/advanced/input_files/input-main.md Regenerated INPUT keyword reference markdown from parameters.yaml.

Comment thread docs/parameters.yaml Outdated
Comment on lines 1391 to 1395
@@ -1379,7 +1393,6 @@ parameters:
* berendsen: Berendsen thermostat, see md_nraise in detail.
* rescaling: velocity Rescaling method 1, see md_tolerance in detail.
* rescale_v: velocity Rescaling method 2, see md_nraise in detail.
Comment thread docs/parameters.yaml Outdated
Comment on lines 839 to 841
description: |
It's the density threshold for electronic iteration. It represents the charge density error between two sequential densities from electronic iterations. This criterion is always enabled. If `scf_ene_thr` is set, the total-energy criterion (`scf_ene_thr`) is evaluated conditionally after the charge-density criterion (`scf_thr`) is satisfied, and not on the first iteration. For local-orbital calculations, 1e-6 is usually accurate enough.
It's the density threshold for electronic iteration. It represents the charge density error between two sequential densities from electronic iterations. Usually for local orbitals, usually 1e-6 may be accurate enough.
default_value: "1.0e-9 (plane-wave basis), or 1.0e-7 (localized atomic orbital basis)."
Comment thread docs/parameters.yaml Outdated
Comment on lines 847 to 849
description: |
It's the energy threshold for electronic iteration. The compared quantity is the total-energy difference evaluated from the charge densities before and after the `Hpsi` operation in one SCF step. It is not the same as the screen-output `EDIFF`, which is the energy difference before `Hpsi` and after charge mixing (i.e., across both `Hpsi` and charge-mixing operations).
It's the energy threshold for electronic iteration. It represents the total energy error between two sequential densities from electronic iterations.
default_value: "-1.0. If the user does not set this parameter, it will not take effect."
Comment thread docs/parameters.yaml Outdated
Comment on lines +4365 to +4369
* bfgs: BFGS quasi-Newton method
* linear_response: linear response (Scheme B)
* augmented_lagrangian: augmented Lagrangian (Scheme C)
* hybrid_delayed: hybrid delayed update (Scheme D)
* linear_scan: linear sweep of lambda for testing magnetic moment response
if param.get('default_value', '') != '':
default_text = escape_md_text(str(param['default_value']))
lines.append(f"- **Default**: {default_text}")
default_text = escape_md_text(str(param['default_value'])).strip('\n')
Comment thread docs/parameters.yaml Outdated
Comment on lines +4373 to +4377
- name: sc_scan_lambda_start
category: Spin-Constrained DFT
type: Float
description: |
Starting lambda value for linear_scan strategy. Only used when sc_lambda_strategy=linear_scan.
Comment on lines 1851 to +1855
- 3: Apart from 1, also output the total local potential of the initial charge density. The files are named as:
- nspin = 1: pots1_ini.cube;
- nspin = 2: pots1_ini.cube and pots2_ini.cube;
- nspin = 4: pots1_ini.cube, pots2_ini.cube, pots3_ini.cube, and pots4_ini.cube
- out_freq_ion = 0:
- nspin = 1: `pot_ini.cube`;
- nspin = 2: `pots1_ini.cube` and `pots2_ini.cube`;
- nspin = 4: `pots1_ini.cube`, `pots2_ini.cube`, `pots3_ini.cube`, and `pots4_ini.cube`;
@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review

- ./build-rtd-docs/abacus_pw_ser --generate-parameters-yaml > docs/parameters.yaml

P2 Badge Preserve EXX inputs when regenerating parameter YAML

This RTD step now regenerates docs/parameters.yaml from --generate-parameters-yaml, whose implementation skips Input_Items with an empty category; the EXX inputs out_unshrinked_v, exx_coul_moment, exx_rotate_abfs, exx_multip_moments_threshold, shrink_abfs_pca_thr, and shrink_lu_inv_thr are still registered/read in source/source_io/module_parameter/read_input_item_exx_dftu.cpp:568-601 but have no category, so the regenerated docs drop supported INPUT keywords entirely. Please add their metadata before relying on this regeneration path.


- rescale_v: velocity Rescaling method 2, see md_nraise in detail.

P2 Badge Keep csvr listed as a thermostat option

For NVT users who need CSVR, this regenerated list no longer includes csvr, but the runtime still handles mdp.md_thermostat == "csvr" in source/source_md/verlet.cpp:103-106, and the same docs still expose md_csvr_tau as available when md_thermostat = csvr. This makes the public INPUT docs inconsistent and hides the only value that activates the documented CSVR parameter.


- **Description**: Whether to print Hamiltonian matrices H(R) in npz format. This feature does not work for gamma-only calculations.

P2 Badge Document the CNPY requirement for npz outputs

For users following the docs from a build without CNPY, this regenerated description drops the previous CNPY prerequisite even though read_input_item_output.cpp:829-837 still aborts with recompile with -DENABLE_CNPY=1 when out_hr_npz is enabled without __USECNPY. The docs now imply the only caveat is not using gamma-only calculations, so inputs copied from this page can fail at startup unless the build requirement is restored in the generated metadata.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@zhubonan

Copy link
Copy Markdown
Collaborator Author

Addressed the Codex review items:

  • Added generator-visible metadata for the six existing EXX INPUT keywords so they are not dropped by --generate-parameters-yaml.
  • Restored csvr in the generated md_thermostat option list.
  • Restored the CNPY build prerequisite in the generated out_*_npz descriptions.
  • Updated the RTD YAML generation command for the rebased CMake layout: build-rtd-docs/source/abacus_pw_ser.

Ignored Copilot wording/format comments intentionally, since those are generated docs and broader parameter wording cleanup is outside this PR scope.

Verification:

  • cmake -S . -B build-rtd-docs -G Ninja ...
  • cmake --build build-rtd-docs --target abacus_pw_ser --parallel 2
  • OMP_NUM_THREADS=1 ./build-rtd-docs/source/abacus_pw_ser --generate-parameters-yaml > docs/parameters.yaml
  • python docs/generate_input_main.py docs/parameters.yaml --output docs/advanced/input_files/input-main.md
  • git diff --check ...
  • sphinx-build -b html docs /tmp/abacus-rtd-sphinx-html-review-fix-rebased

Result: build and docs generation passed; Sphinx completed with the existing docs warnings.

@Growl1234

Copy link
Copy Markdown

If this workflow is successful, we can even drop docs/parameters.yaml‎ from the repository so that it's fully assigned to manual-generation workflow. And could you please add docs/READMD.md to describe how to generate manual locally (Here's an example).

@zhubonan

zhubonan commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed this in commit 003c1a5 by adding docs/README.md with local manual build instructions, INPUT-reference regeneration steps, and an optional RTD container smoke test.

Checked the generated-file question as well: RTD no longer depends on a committed docs/parameters.yaml because .readthedocs.yaml regenerates it before Sphinx runs, and a local Sphinx build succeeds without docs/parameters.yaml when the checked-in input-main.md is present.

@zhubonan

Copy link
Copy Markdown
Collaborator Author

I think parameters.yaml can be dropped from the repository. However, we still need instructions/checks to make sure that the inputs-main.md is consistent with the actual source code. As in #7592.

@zhubonan

Copy link
Copy Markdown
Collaborator Author

Updated the PR to remove the checked-in docs/parameters.yaml middleware. The docs build now refreshes docs/advanced/input_files/input-main.md directly from an ABACUS executable during Sphinx startup. If no executable is available, it emits a warning and keeps the checked-in generated page.\n\nOther updates: .readthedocs.yaml now only builds the reduced binary, CI checks input-main.md against transient generated YAML, and the contributor/governance docs plus docs/README.md describe the new flow. Added focused unittest coverage for binary refresh and missing-binary warning behavior.\n\nVerification run:\n- cmake configure for reduced docs binary: passed\n- cmake --build build-rtd-docs --target abacus_pw_ser --parallel 2: passed\n- OMP_NUM_THREADS=1 ./build-rtd-docs/source/abacus_pw_ser --generate-parameters-yaml | python docs/generate_input_main.py - --output docs/advanced/input_files/input-main.md: passed, 525 parameters\n- python -m unittest docs.tests.test_conf_input_docs: passed, 2 tests\n- ABACUS_BINARY=./build-rtd-docs/source/abacus_pw_ser sphinx-build -b html docs /tmp/abacus-rtd-sphinx-html-no-yaml-middleware-final: passed, 37 existing warnings\n- git diff --check: passed

@Growl1234

Growl1234 commented Jul 12, 2026

Copy link
Copy Markdown

Sorry but, is advanced/input_files/input-main.md generated from parameters.yaml? If this is true, why not also drop this auto-generated Markdown file together with parameters.yaml from the repository.

I personally suggest to report error status if there is failure while generating parameters.yaml and advanced/input_files/input-main.md in the RTD workflow, as it most likely needs double-checking whether the change related to input paramater introduces regression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants