Skip to content

Commit 6836cdd

Browse files
authored
Remove unused default_group_name from ModelProto and implementations (#144)
The `default_group_name` method was defined in the `ModelProto` protocol but no longer needed. ## Changes - **`qmp/utility/model_dict.py`**: Removed `default_group_name` classmethod from `ModelProto` protocol - **`qmp/models/{fcidump,hubbard,free_fermion,ising,openfermion}.py`**: Removed `default_group_name` implementations from all model classes Total: 53 lines removed across 6 files. <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>/qmp/utility/model_dict.py 中的 default_group_name 和 qmp/models 下各个实现不需要了, 把这个default group name删了</issue_title> > <issue_description></issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > </comments> > </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes #143 <!-- START COPILOT CODING AGENT TIPS --> --- 💡 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](https://gh.io/copilot-coding-agent-tips) in the docs.
2 parents fe70f8b + eb8233d commit 6836cdd

File tree

6 files changed

+0
-53
lines changed

6 files changed

+0
-53
lines changed

qmp/models/fcidump.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,6 @@ class Model(ModelProto[ModelConfig]):
132132

133133
config_t = ModelConfig
134134

135-
@classmethod
136-
def default_group_name(cls, config: ModelConfig) -> str:
137-
return config.model_name
138-
139135
def __init__(self, args: ModelConfig) -> None:
140136
# pylint: disable=too-many-locals
141137
logging.info("Input arguments successfully parsed")

qmp/models/free_fermion.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ class Model(ModelProto[ModelConfig]):
4242

4343
config_t = ModelConfig
4444

45-
@classmethod
46-
def default_group_name(cls, config: ModelConfig) -> str:
47-
return f"FreeFermion_{config.m}x{config.n}_e{config.electron_number}"
48-
4945
@classmethod
5046
def _prepare_hamiltonian(cls, args: ModelConfig) -> dict[tuple[tuple[int, int], ...], complex]:
5147
def _index(i: int, j: int) -> int:

qmp/models/hubbard.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ class Model(ModelProto[ModelConfig]):
5555

5656
config_t = ModelConfig
5757

58-
@classmethod
59-
def default_group_name(cls, config: ModelConfig) -> str:
60-
return f"Hubbard_{config.m}x{config.n}_t{config.t}_u{config.u}_e{config.electron_number}"
61-
6258
@classmethod
6359
def _prepare_hamiltonian(cls, args: ModelConfig) -> dict[tuple[tuple[int, int], ...], complex]:
6460
def _index(i: int, j: int, o: int) -> int:

qmp/models/ising.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -70,27 +70,6 @@ class Model(ModelProto[ModelConfig]):
7070

7171
config_t = ModelConfig
7272

73-
@classmethod
74-
def default_group_name(cls, config: ModelConfig) -> str:
75-
# pylint: disable=too-many-locals
76-
x = f"_x{config.x}" if config.x != 0 else ""
77-
y = f"_y{config.y}" if config.y != 0 else ""
78-
z = f"_z{config.z}" if config.z != 0 else ""
79-
xh = f"_xh{config.xh}" if config.xh != 0 else ""
80-
yh = f"_yh{config.yh}" if config.yh != 0 else ""
81-
zh = f"_zh{config.zh}" if config.zh != 0 else ""
82-
xv = f"_xv{config.xv}" if config.xv != 0 else ""
83-
yv = f"_yv{config.yv}" if config.yv != 0 else ""
84-
zv = f"_zv{config.zv}" if config.zv != 0 else ""
85-
xd = f"_xd{config.xd}" if config.xd != 0 else ""
86-
yd = f"_yd{config.yd}" if config.yd != 0 else ""
87-
zd = f"_zd{config.zd}" if config.zd != 0 else ""
88-
xa = f"_xa{config.xa}" if config.xa != 0 else ""
89-
ya = f"_ya{config.ya}" if config.ya != 0 else ""
90-
za = f"_za{config.za}" if config.za != 0 else ""
91-
desc = x + y + z + xh + yh + zh + xv + yv + zv + xd + yd + zd + xa + ya + za
92-
return f"Ising_{config.m}_{config.n}" + desc
93-
9473
@classmethod
9574
def _prepare_hamiltonian(cls, args: ModelConfig) -> dict[tuple[tuple[int, int], ...], complex]:
9675
# pylint: disable=too-many-branches

qmp/models/openfermion.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ class Model(ModelProto[ModelConfig]):
4040

4141
config_t = ModelConfig
4242

43-
@classmethod
44-
def default_group_name(cls, config: ModelConfig) -> str:
45-
return config.model_name
46-
4743
def __init__(self, args: ModelConfig) -> None:
4844
logging.info("Input arguments successfully parsed")
4945
logging.info("Model path: %s", args.model_path)

qmp/utility/model_dict.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -107,22 +107,6 @@ class ModelProto(typing.Protocol[ModelConfig]):
107107

108108
config_t: type[ModelConfig]
109109

110-
@classmethod
111-
def default_group_name(cls, config: ModelConfig) -> str:
112-
"""
113-
Get the default group name for logging purposes.
114-
115-
Parameters
116-
----------
117-
config : ModelConfig
118-
The config of model.
119-
120-
Returns
121-
-------
122-
str
123-
The group name for logging purposes.
124-
"""
125-
126110
def __init__(self, config: ModelConfig) -> None:
127111
"""
128112
Create a model from the given config.

0 commit comments

Comments
 (0)