uclchem.advanced.generate_metadata#

Utility to regenerate the fortran_parameters section of fortran_metadata.yaml.

Parses all Fortran source files in src/fortran_src/ and extracts module-scope PARAMETER declarations, then writes the result back into the YAML file. The internal_parameters and file_path_parameters sections are left untouched as they require manual curation.

Usage:

uclchem-generate-metadata            # update YAML in-place
uclchem-generate-metadata --dry-run  # print diff, do not write
uclchem-generate-metadata --check    # exit 1 if YAML would change (CI use)

Module Contents#

Functions#

main(→ None)

Entry point for uclchem-generate-metadata.

parse_fortran_parameters(→ dict[str, list[str]])

Parse all .f90 files in src_dir and return module-scope PARAMETERs.

uclchem.advanced.generate_metadata.main(argv: list[str] | None = None) None[source]#

Entry point for uclchem-generate-metadata.

uclchem.advanced.generate_metadata.parse_fortran_parameters(src_dir: pathlib.Path) dict[str, list[str]][source]#

Parse all .f90 files in src_dir and return module-scope PARAMETERs.

Handles Fortran continuation lines (ending with & and starting next line with &).

Parameters:

src_dir (Path) – Path to the directory containing Fortran source files.

Returns:

Mapping of f2py module name (lowercase) to sorted list of PARAMETER names.

Return type:

dict[str, list[str]]