Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 19, 2025

The fcidump and openfermion models used separate model_name and model_path parameters, constructing file paths as model_path/model_name. This consolidates them into a single model_path parameter containing the complete file path.

Changes

ModelConfig

  • Replaced model_name and model_path with single required model_path: pathlib.Path | str parameter
  • Removed QMP_MODEL_PATH environment variable fallback logic
  • __post_init__ now only converts string to pathlib.Path

Model class

  • default_group_name() extracts name from path by stripping file extensions inline using removesuffix()
  • __init__() uses the full path directly without extracting or displaying model names
  • Simplified logging to not include model names
  • YAML lookup in fcidump.py extracts filename inline for key lookup

Migration

# Before
ModelConfig(model_name="h2o", model_path="models/")
# → models/h2o.FCIDUMP.gz

# After  
ModelConfig(model_path="models/h2o.FCIDUMP.gz")
# or
ModelConfig(model_path="models/h2o")

Both relative and absolute paths are supported via native pathlib behavior.

Original prompt

This section details on the original issue you should resolve

<issue_title>更改qmp/models 下 fcidump和openfermion的数据输入格式</issue_title>
<issue_description>目前有model name和model path, 实际上取的是 model_path/model_name 现在用同一个变量 model_path 来表示输入文件的完整地址(可以是相对的,直接用默认行为,不用特殊处理相对地址)</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Dec 19, 2025
Copilot AI and others added 5 commits December 19, 2025 01:53
- Replace model_name and model_path parameters with single model_path
- Remove QMP_MODEL_PATH environment variable handling
- Update ModelConfig in both fcidump.py and openfermion.py
- Update default_group_name to extract name from path
- Remove unused os import
- Pass linter and formatter checks

Co-authored-by: hzhangxyz <[email protected]>
Add _extract_model_name_from_path helper function in both fcidump.py and openfermion.py to avoid duplicating extension removal logic between default_group_name and __init__ methods.

Co-authored-by: hzhangxyz <[email protected]>
Remove redundant pathlib.Path(model_name).name since model_name is already the filename without path components.

Co-authored-by: hzhangxyz <[email protected]>
Remove redundant intermediate variables since model_path is already converted to pathlib.Path in __post_init__.

Co-authored-by: hzhangxyz <[email protected]>
Remove redundant pathlib.Path() calls since config.model_path is already a Path object after __post_init__.

Co-authored-by: hzhangxyz <[email protected]>
Copilot AI changed the title [WIP] Change input format for fcidump and openfermion Consolidate model_name and model_path into single model_path parameter Dec 19, 2025
Copilot AI requested a review from hzhangxyz December 19, 2025 02:01
Copy link
Member

@hzhangxyz hzhangxyz left a comment

Choose a reason for hiding this comment

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

你已经有全名了,不用提取后再合并得到路径,直接用输入的全名来读取就行了。

一些日志相关的东西之前用了model name, 但是可以直接把这一项目给去掉, 不显示model name了。

- Remove _extract_model_name_from_path helper function
- Remove all model_name variables from __init__ methods
- Simplify logging to not include model names
- Keep extension stripping logic inline in default_group_name
- Keep YAML key extraction inline in fcidump.py for ref_energy lookup

Co-authored-by: hzhangxyz <[email protected]>
Copy link
Contributor Author

Copilot AI commented Dec 19, 2025

你已经有全名了,不用提取后再合并得到路径,直接用输入的全名来读取就行了。

一些日志相关的东西之前用了model name, 但是可以直接把这一项目给�...

Done. Removed the _extract_model_name_from_path helper function and all model_name variables. Logging now only shows the file path without extracting or displaying model names. (5bb239e)

Replace string slicing with removesuffix() method for better readability and intent clarity. This is available in Python 3.9+ and the project requires Python 3.12.

Co-authored-by: hzhangxyz <[email protected]>
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.

更改qmp/models 下 fcidump和openfermion的数据输入格式

2 participants