Skip to content

Commit

Permalink
Fix case insensitive file system bug
Browse files Browse the repository at this point in the history
  • Loading branch information
obackhouse committed Sep 28, 2024
1 parent 68f8424 commit 1dadfca
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions ebcc/core/ansatz.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ def name_to_identifier(name: str) -> str:
'CCSDxTx'
>>> name_to_identifier("CCSD-SD-1-2")
'CCSD_SD_1_2'
>>> name_to_identifier("CCSDt'")
'CCSDwtwp'
"""
iden = "".join([f"w{c}w" if c.isalpha() and c.islower() else c for c in name])
iden = name.replace("(", "x").replace(")", "x")
iden = iden.replace("[", "y").replace("]", "y")
iden = iden.replace("-", "_")
Expand All @@ -72,8 +75,11 @@ def identifity_to_name(iden: str) -> str:
'CCSD(T)'
>>> identifier_to_name("CCSD_SD_1_2")
'CCSD-SD-1-2'
>>> identifier_to_name("CCSDwtwp")
"CCSDt'"
"""
name = iden.replace("-", "_")
name = name.replace("w", "")
while "x" in name:
name = name.replace("x", "(", 1).replace("x", ")", 1)
while "y" in name:
Expand Down

0 comments on commit 1dadfca

Please sign in to comment.