Conversation
There was a problem hiding this comment.
🟡 Changes recommended
There are confirmed backward-compatibility and UX bugs in option parsing (draw_xmo flag form) and in plotting option semantics (projection silently ignored for --connectivity rdkit, plus related CLI/help inconsistencies).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR restructures and documents the command-line interface of autoVB, consolidating XMO plotting under a unified xmo2svg implementation (with draw_xmo as an alias), and renaming legacy script entry points (autovb_nbo → xyz2nbo, autovb_xmi → nbo2xmi) to clearer user-facing commands.
Changes:
- Added a reusable plotting implementation in
vbkit/xmo2svg.pyand updated the CLI to use it (including a new--connectivityoption). - Updated
VBSettings/parsing to support additional weight tables (inverse,renormalized) and to aliasdraw_xmo→xmo2svg. - Expanded/updated Chinese & English user guides and README to reflect the new CLI tools and plotting behavior.
File summaries
| File | Description |
|---|---|
| UserGuide.md | Updates plotting parameter docs and adds a comprehensive “Command-Line Tools” section (CN). |
| UserGuide_en.md | Same as above for the English guide. |
| src/autoVB/vbkit/xmo2svg.py | Introduces a shared xmo2svg_file() implementation plus report-line generation. |
| src/autoVB/nbo/nbo.py | Uses origin_filename for molecule_name when generating XMI data. |
| src/autoVB/main.py | Removes legacy draw_xmo workflow step; routes plotting through xmo2svg and logs report lines. |
| src/autoVB/io/readers.py | Adds draw_xmo → xmo2svg aliasing in option parsing. |
| src/autoVB/draw_xmo/xmo_drawer_input_converter.py | Extends supported weight tables and updates legend labeling accordingly. |
| src/autoVB/cli/xmo2svg.py | Refactors CLI to call the shared vbkit implementation; adds --connectivity. |
| src/autoVB/cli/xmi.py | Updates CLI program name to nbo2xmi. |
| src/autoVB/cli/nbo.py | Updates CLI program name to xyz2nbo. |
| src/autoVB/cli/draw_xmo.py | Turns draw_xmo into a thin alias of xmo2svg. |
| README.md | Refreshes installation instructions and documents the new CLI commands. |
| pyproject.toml | Renames script entry points and adds fch2xmi as an alias of fch2vb. |
Review details
Suppressed comments (2)
src/autoVB/io/readers.py:360
draw_xmois aliased toxmo2svg, but when users specify it as a flag (e.g.autovb{draw_xmo}) this code setsvalue=Trueand then tries to parse it asOptional[str], which triggers an AttributeError (boolhas no.startswith) and silently skips the option. This breaks backward compatibility and meansdraw_xmomay do nothing without an explicit value.
for pair in pair_list:
if "=" not in pair:
key = pair.strip()
value = True
else:
src/autoVB/cli/xmo2svg.py:54
- The CLI description still claims it generates SVGs "using $orb labels for molecular connectivity", but
--connectivity rdkitis now supported. The help text should reflect both modes (or indicate$orbis only the default).
parser = argparse.ArgumentParser(
prog="xmo2svg",
description=(
"Read an XMO file and generate valence-bond SVG files using "
"$orb labels for molecular connectivity."
),
)
- Files reviewed: 13/13 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if connectivity == "orb": | ||
| drawer = OrbitalConnectivityMoleculeDrawer( | ||
| **drawer_kwargs, | ||
| orbital_atom_rows=parsed_data.orb, | ||
| projection=projection, | ||
| condense_hydrogens=condense_hydrogens, | ||
| ) | ||
| elif connectivity == "rdkit": | ||
| drawer = MoleculeBondVariantDrawer(**drawer_kwargs) | ||
| else: | ||
| raise ValueError(f"Unsupported connectivity mode: {connectivity}") |
| xyz2nbo = "autoVB.cli.nbo:autovb_nbo" | ||
| nbo2xmi = "autoVB.cli.xmi:autovb_xmi" | ||
| autovb = "autoVB.cli.autovb:autovb_main" | ||
| autovb_test = "autoVB.cli.autovb_test:autovb_test" | ||
| draw_xmo = "autoVB.cli.draw_xmo:draw_xmo" | ||
| draw_xmo = "autoVB.cli.xmo2svg:xmo2svg" | ||
| fch2vb = "autoVB.cli.fch2vb:fch2vb" | ||
| fch2xmi = "autoVB.cli.fch2vb:fch2vb" |
| from ..vbkit.xmo2svg import ( | ||
| DEFAULT_XMO_ACTIVE_SPACE_COLOR, | ||
| DEFAULT_XMO_ACTIVE_SPACE_WIDTH, | ||
| DEFAULT_XMO_MAX_STRUCTURES, | ||
| DEFAULT_XMO_STRUCTURES_PER_ROW, | ||
| DEFAULT_XMO_WEIGHT_TABLE, | ||
| parse_draw_xmo_max_structures, | ||
| parse_draw_xmo_structures_per_row, | ||
| xmo2svg_file, | ||
| xmo2svg_report_lines, | ||
| ) |
No description provided.