From 1dadfca29240640e0269a912630c29fafbf16083 Mon Sep 17 00:00:00 2001 From: Oliver Backhouse Date: Sat, 28 Sep 2024 12:31:57 +0100 Subject: [PATCH] Fix case insensitive file system bug --- ebcc/codegen/{GCCSDtp.py => GCCSDwtwp.py} | 0 ebcc/codegen/{RCCSDtp.py => RCCSDwtwp.py} | 0 ebcc/codegen/{UCCSDtp.py => UCCSDwtwp.py} | 0 ebcc/core/ansatz.py | 6 ++++++ 4 files changed, 6 insertions(+) rename ebcc/codegen/{GCCSDtp.py => GCCSDwtwp.py} (100%) rename ebcc/codegen/{RCCSDtp.py => RCCSDwtwp.py} (100%) rename ebcc/codegen/{UCCSDtp.py => UCCSDwtwp.py} (100%) diff --git a/ebcc/codegen/GCCSDtp.py b/ebcc/codegen/GCCSDwtwp.py similarity index 100% rename from ebcc/codegen/GCCSDtp.py rename to ebcc/codegen/GCCSDwtwp.py diff --git a/ebcc/codegen/RCCSDtp.py b/ebcc/codegen/RCCSDwtwp.py similarity index 100% rename from ebcc/codegen/RCCSDtp.py rename to ebcc/codegen/RCCSDwtwp.py diff --git a/ebcc/codegen/UCCSDtp.py b/ebcc/codegen/UCCSDwtwp.py similarity index 100% rename from ebcc/codegen/UCCSDtp.py rename to ebcc/codegen/UCCSDwtwp.py diff --git a/ebcc/core/ansatz.py b/ebcc/core/ansatz.py index d39b3968..d35c379c 100644 --- a/ebcc/core/ansatz.py +++ b/ebcc/core/ansatz.py @@ -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("-", "_") @@ -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: