Skip to content

Commit 4199bb4

Browse files
committed
Add superconductivity screening modes
1 parent d3b2a67 commit 4199bb4

7 files changed

Lines changed: 64 additions & 10 deletions

File tree

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![CI](https://img.shields.io/github/actions/workflow/status/chatmaterials/superconductivity-analysis/ci.yml?branch=main&label=CI)](https://github.com/chatmaterials/superconductivity-analysis/actions/workflows/ci.yml) [![Release](https://img.shields.io/github/v/release/chatmaterials/superconductivity-analysis?display_name=tag)](https://github.com/chatmaterials/superconductivity-analysis/releases)
44

5-
Standalone skill for superconductivity-relevant DFT result analysis, including candidate ranking by Tc, phonon stability, and mu* robustness.
5+
Standalone skill for superconductivity-relevant DFT result analysis, including candidate ranking by Tc, phonon stability, mu* robustness, and application mode.
66

77
## Install
88

@@ -19,7 +19,9 @@ python3 scripts/analyze_alpha2f.py fixtures/alpha2f/alpha2f.dat --json
1919
python3 scripts/analyze_phonon_modes.py fixtures/phonon/phonon_modes.dat --json
2020
python3 scripts/estimate_tc.py --alpha2f-path fixtures/alpha2f/alpha2f.dat --mu-star 0.10 --json
2121
python3 scripts/analyze_tc_sensitivity.py --alpha2f-path fixtures/alpha2f/alpha2f.dat --json
22-
python3 scripts/compare_superconducting_candidates.py fixtures fixtures/candidates/stable-strong fixtures/candidates/unstable-strong --mu-star 0.10 --target-tc 0.5 --json
22+
python3 scripts/compare_superconducting_candidates.py fixtures fixtures/candidates/soft-high fixtures/candidates/stable-strong fixtures/candidates/unstable-strong --mu-star 0.10 --target-tc 0.5 --mode balanced --json
23+
python3 scripts/compare_superconducting_candidates.py fixtures fixtures/candidates/soft-high fixtures/candidates/stable-strong --mu-star 0.10 --target-tc 0.5 --mode high-tc --json
24+
python3 scripts/compare_superconducting_candidates.py fixtures fixtures/candidates/soft-high fixtures/candidates/stable-strong --mu-star 0.10 --target-tc 0.5 --mode robust --json
2325
python3 scripts/export_superconductivity_report.py --alpha2f-path fixtures/alpha2f/alpha2f.dat --phonon-path fixtures/phonon/phonon_modes.dat --mu-star 0.10
2426
python3 scripts/run_regression.py
2527
```

SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: "superconductivity-analysis"
3-
description: "Use when the task is to analyze superconductivity-relevant quantities from DFT or Eliashberg-style outputs, including electron-phonon coupling summaries, logarithmic phonon frequency estimates, phonon-stability checks, Allen-Dynes Tc estimates, mu*-sensitivity or Tc robustness checks, candidate ranking, and compact markdown reports from finished calculations."
3+
description: "Use when the task is to analyze superconductivity-relevant quantities from DFT or Eliashberg-style outputs, including electron-phonon coupling summaries, logarithmic phonon frequency estimates, phonon-stability checks, Allen-Dynes Tc estimates, mu*-sensitivity or Tc robustness checks, mode-specific candidate ranking, and compact markdown reports from finished calculations."
44
---
55

66
# Superconductivity Analysis
@@ -14,7 +14,7 @@ Use this skill for superconductivity-oriented post-processing rather than generi
1414
- check whether a phonon mode set contains soft or imaginary modes
1515
- estimate a simple Allen-Dynes `Tc`
1616
- estimate how sensitive Tc is to the chosen `mu*`
17-
- rank multiple superconducting candidates with a compact Tc-plus-stability heuristic
17+
- rank multiple superconducting candidates in balanced, high-Tc, robust, or stable modes
1818
- write a compact superconductivity-analysis report from existing data
1919

2020
## Use the bundled helpers
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
5.0 0.06
2+
10.0 0.30
3+
15.0 0.54
4+
20.0 0.48
5+
25.0 0.24
6+
30.0 0.09
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
0.60
2+
2.20
3+
3.80
4+
5.60
5+
7.90

references/superconductivity.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
- Soft modes can enhance coupling, but fully imaginary modes signal structural instability.
66
- Candidate ranking is useful for triage, but stability penalties should be treated as hard constraints before claiming a promising superconducting material.
77
- Tc sensitivity to `mu*` is a useful robustness check; a promising candidate should not collapse entirely under modest changes in Coulomb pseudopotential.
8+
- Application mode matters: a high-Tc screen may reasonably tolerate soft modes that a stability-first screen would reject.

scripts/compare_superconducting_candidates.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def locate_required(root: Path, relative_paths: list[str]) -> Path:
2020
raise SystemExit(f"Could not locate any of {relative_paths} in {root}")
2121

2222

23-
def analyze_case(root: Path, mu_star: float, target_tc: float) -> dict[str, object]:
23+
def analyze_case(root: Path, mu_star: float, target_tc: float, mode: str) -> dict[str, object]:
2424
alpha2f_path = locate_required(root, ["alpha2f.dat", "alpha2f/alpha2f.dat"])
2525
phonon_path = locate_required(root, ["phonon_modes.dat", "phonon/phonon_modes.dat"])
2626
epc = analyze_alpha2f(alpha2f_path)
@@ -36,7 +36,14 @@ def analyze_case(root: Path, mu_star: float, target_tc: float) -> dict[str, obje
3636
screening_tc *= 0.85
3737
elif phonons["stability_class"] == "unstable":
3838
screening_tc = 0.0
39-
score = tc_penalty + instability_penalty + softness_penalty + robustness_penalty
39+
if mode == "high-tc":
40+
score = -0.1 * screening_tc + 0.5 * instability_penalty + 0.1 * softness_penalty + 0.1 * robustness_penalty
41+
elif mode == "robust":
42+
score = 1.0 * tc_penalty + 1.5 * instability_penalty + 1.0 * softness_penalty + 1.5 * robustness_penalty
43+
elif mode == "stable":
44+
score = 0.5 * tc_penalty + 2.0 * instability_penalty + 1.5 * softness_penalty + 0.5 * robustness_penalty
45+
else:
46+
score = tc_penalty + instability_penalty + softness_penalty + robustness_penalty
4047
return {
4148
"case": root.name,
4249
"path": str(root),
@@ -60,13 +67,14 @@ def analyze_case(root: Path, mu_star: float, target_tc: float) -> dict[str, obje
6067
}
6168

6269

63-
def analyze_cases(roots: list[Path], mu_star: float, target_tc: float) -> dict[str, object]:
64-
cases = [analyze_case(root, mu_star, target_tc) for root in roots]
70+
def analyze_cases(roots: list[Path], mu_star: float, target_tc: float, mode: str) -> dict[str, object]:
71+
cases = [analyze_case(root, mu_star, target_tc, mode) for root in roots]
6572
ranked = sorted(cases, key=lambda item: item["screening_score"])
6673
return {
6774
"mu_star": mu_star,
6875
"target_tc_K": target_tc,
69-
"ranking_basis": "screening_score = tc_penalty + instability_penalty + softness_penalty + robustness_penalty",
76+
"mode": mode,
77+
"ranking_basis": "screening_score = weighted(tc_penalty, instability_penalty, softness_penalty, robustness_penalty)",
7078
"cases": ranked,
7179
"best_case": ranked[0]["case"] if ranked else None,
7280
"observations": [
@@ -80,9 +88,10 @@ def main() -> None:
8088
parser.add_argument("paths", nargs="+")
8189
parser.add_argument("--mu-star", type=float, default=0.10)
8290
parser.add_argument("--target-tc", type=float, default=1.0)
91+
parser.add_argument("--mode", choices=["balanced", "high-tc", "robust", "stable"], default="balanced")
8392
parser.add_argument("--json", action="store_true")
8493
args = parser.parse_args()
85-
payload = analyze_cases([Path(path).expanduser().resolve() for path in args.paths], args.mu_star, args.target_tc)
94+
payload = analyze_cases([Path(path).expanduser().resolve() for path in args.paths], args.mu_star, args.target_tc, args.mode)
8695
if args.json:
8796
print(json.dumps(payload, indent=2))
8897
return

scripts/run_regression.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,46 @@ def main() -> None:
4141
ranked = run_json(
4242
"scripts/compare_superconducting_candidates.py",
4343
"fixtures",
44+
"fixtures/candidates/soft-high",
4445
"fixtures/candidates/stable-strong",
4546
"fixtures/candidates/unstable-strong",
4647
"--mu-star",
4748
"0.10",
4849
"--target-tc",
4950
"0.5",
51+
"--mode",
52+
"balanced",
5053
"--json",
5154
)
5255
ensure(ranked["best_case"] == "stable-strong", "superconductivity-analysis should rank the strong and stable candidate ahead of the weaker or unstable cases")
56+
high_tc_ranked = run_json(
57+
"scripts/compare_superconducting_candidates.py",
58+
"fixtures",
59+
"fixtures/candidates/soft-high",
60+
"fixtures/candidates/stable-strong",
61+
"--mu-star",
62+
"0.10",
63+
"--target-tc",
64+
"0.5",
65+
"--mode",
66+
"high-tc",
67+
"--json",
68+
)
69+
ensure(high_tc_ranked["best_case"] == "soft-high", "superconductivity-analysis should rank the higher-Tc softened candidate first in high-tc mode")
70+
robust_ranked = run_json(
71+
"scripts/compare_superconducting_candidates.py",
72+
"fixtures",
73+
"fixtures/candidates/soft-high",
74+
"fixtures/candidates/stable-strong",
75+
"--mu-star",
76+
"0.10",
77+
"--target-tc",
78+
"0.5",
79+
"--mode",
80+
"robust",
81+
"--json",
82+
)
83+
ensure(robust_ranked["best_case"] == "stable-strong", "superconductivity-analysis should rank the robust stable candidate first in robust mode")
5384
temp_dir = Path(tempfile.mkdtemp(prefix="superconductivity-analysis-report-"))
5485
try:
5586
report_path = Path(

0 commit comments

Comments
 (0)