quantui 0.5.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. quantui/__init__.py +311 -0
  2. quantui/analytics.py +609 -0
  3. quantui/app.py +5650 -0
  4. quantui/app_analysis.py +662 -0
  5. quantui/app_builders.py +2465 -0
  6. quantui/app_exports.py +194 -0
  7. quantui/app_formatters.py +493 -0
  8. quantui/app_history.py +624 -0
  9. quantui/app_runflow.py +1544 -0
  10. quantui/app_visualization.py +2620 -0
  11. quantui/ase_bridge.py +236 -0
  12. quantui/benchmarks.py +1543 -0
  13. quantui/c_stderr.py +124 -0
  14. quantui/cactus.py +88 -0
  15. quantui/calc_log.py +1116 -0
  16. quantui/calculator.py +204 -0
  17. quantui/cancellation.py +88 -0
  18. quantui/cli.py +288 -0
  19. quantui/comparison.py +306 -0
  20. quantui/config.py +725 -0
  21. quantui/data/js/3Dmol-min.js +2 -0
  22. quantui/data/js/3Dmol-min.js.LICENSE.txt +5 -0
  23. quantui/data/library/library.sqlite +0 -0
  24. quantui/data/manifests/bulk_qm9.json +1 -0
  25. quantui/data/manifests/curated.json +15482 -0
  26. quantui/data/manifests/presets.json +816 -0
  27. quantui/descriptor_cards.py +186 -0
  28. quantui/freq_calc.py +712 -0
  29. quantui/freq_ir_workers.py +229 -0
  30. quantui/gpu_offload.py +278 -0
  31. quantui/help_content.py +474 -0
  32. quantui/ir_plot.py +130 -0
  33. quantui/issue_tracker.py +170 -0
  34. quantui/live_log.py +387 -0
  35. quantui/log_utils.py +492 -0
  36. quantui/molecule.py +577 -0
  37. quantui/molecule_library.py +433 -0
  38. quantui/nmr_calc.py +437 -0
  39. quantui/optimizer.py +670 -0
  40. quantui/orbital_visualization.py +1102 -0
  41. quantui/pes_scan.py +420 -0
  42. quantui/preopt.py +355 -0
  43. quantui/progress.py +111 -0
  44. quantui/pubchem.py +1157 -0
  45. quantui/reorganization_energy.py +435 -0
  46. quantui/results_storage.py +902 -0
  47. quantui/security.py +14 -0
  48. quantui/session_calc.py +622 -0
  49. quantui/structure_providers.py +277 -0
  50. quantui/tddft_calc.py +307 -0
  51. quantui/user_settings.py +238 -0
  52. quantui/utils.py +287 -0
  53. quantui/vib_cache.py +247 -0
  54. quantui/visualization_py3dmol.py +593 -0
  55. quantui/viz_assets.py +101 -0
  56. quantui/viz_backend_router.py +243 -0
  57. quantui-0.5.1.dist-info/METADATA +533 -0
  58. quantui-0.5.1.dist-info/RECORD +62 -0
  59. quantui-0.5.1.dist-info/WHEEL +5 -0
  60. quantui-0.5.1.dist-info/entry_points.txt +2 -0
  61. quantui-0.5.1.dist-info/licenses/LICENSE +21 -0
  62. quantui-0.5.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,186 @@
1
+ """Method / basis descriptor cards.
2
+
3
+ Replaces the inline multi-paragraph educational-notes block next to the
4
+ method / basis dropdowns with two compact "descriptor cards" — an icon, a
5
+ one-line title, and a single distilled sentence — styled like the History-tab
6
+ result cards (light background + coloured left border).
7
+
8
+ Pure string builders (no widgets / no PySCF import) so the card content is
9
+ unit-testable in isolation. Icons are inline SVG (offline-safe — never a CDN
10
+ asset) drawn with ``stroke="currentColor"`` so they take the family accent
11
+ colour from the wrapping span and invert with the global dark-mode filter like
12
+ the rest of the UI (inline SVG is not one of the ``canvas/img/iframe/video``
13
+ tags the filter excludes).
14
+
15
+ Method family comes from ``config.METHOD_INFO[method]["type"]``
16
+ (``hf`` / ``dft`` / ``wavefunction``); the one-line body reuses that entry's
17
+ ``use_for`` so the card can never drift from the help text. Basis family is
18
+ derived from the basis-set name.
19
+ """
20
+
21
+ from __future__ import annotations
22
+
23
+ from . import config
24
+
25
+ # ── Icons (24×24 inline SVG, currentColor) ───────────────────────────────────
26
+
27
+ _SVG_OPEN = (
28
+ '<svg width="22" height="22" viewBox="0 0 24 24" fill="none" '
29
+ 'stroke="currentColor" stroke-width="2" stroke-linecap="round" '
30
+ 'stroke-linejoin="round">'
31
+ )
32
+
33
+ # Hartree-Fock — paired spins (↑↓).
34
+ _ICON_HF = (
35
+ _SVG_OPEN + '<line x1="8" y1="4" x2="8" y2="20"/>'
36
+ '<polyline points="5 7 8 4 11 7"/>'
37
+ '<line x1="16" y1="20" x2="16" y2="4"/>'
38
+ '<polyline points="13 17 16 20 19 17"/></svg>'
39
+ )
40
+
41
+ # DFT — electron-density cloud.
42
+ _ICON_DFT = (
43
+ _SVG_OPEN + '<path d="M7 18a4 4 0 0 1 0-8 5 5 0 0 1 9.6-1.5A3.5 3.5 0 0 1 '
44
+ '17 18Z" fill="currentColor" fill-opacity="0.15"/></svg>'
45
+ )
46
+
47
+ # Post-HF wavefunction — correlated wave.
48
+ _ICON_WAVE = _SVG_OPEN + '<path d="M3 12 q3 -7 6 0 t6 0 t6 0"/></svg>'
49
+
50
+ # Minimal basis — a single tight function.
51
+ _ICON_BASIS_MINIMAL = (
52
+ _SVG_OPEN + '<circle cx="12" cy="12" r="4" fill="currentColor"/></svg>'
53
+ )
54
+
55
+ # Split-valence (Pople) — a core function plus a split valence shell.
56
+ _ICON_BASIS_POPLE = (
57
+ _SVG_OPEN + '<circle cx="12" cy="12" r="3.5" fill="currentColor"/>'
58
+ '<circle cx="12" cy="12" r="9"/></svg>'
59
+ )
60
+
61
+ # Correlation-consistent — systematically nested shells.
62
+ _ICON_BASIS_CC = (
63
+ _SVG_OPEN + '<circle cx="12" cy="12" r="3"/>'
64
+ '<circle cx="12" cy="12" r="6.5"/>'
65
+ '<circle cx="12" cy="12" r="10"/></svg>'
66
+ )
67
+
68
+ # def2 (Karlsruhe) — a function with polarisation lobes.
69
+ _ICON_BASIS_DEF2 = (
70
+ _SVG_OPEN + '<circle cx="12" cy="12" r="5"/>'
71
+ '<line x1="12" y1="1.5" x2="12" y2="4.5"/>'
72
+ '<line x1="12" y1="19.5" x2="12" y2="22.5"/>'
73
+ '<line x1="1.5" y1="12" x2="4.5" y2="12"/>'
74
+ '<line x1="19.5" y1="12" x2="22.5" y2="12"/></svg>'
75
+ )
76
+
77
+ # ── Family → (accent fg, light bg, icon) ─────────────────────────────────────
78
+ # Palette mirrors the calc-type badge colours in app_formatters so the whole
79
+ # app reads as one system.
80
+
81
+ _METHOD_FAMILY_STYLE = {
82
+ "hf": ("#2563eb", "#eff6ff", _ICON_HF),
83
+ "dft": ("#7c3aed", "#f5f3ff", _ICON_DFT),
84
+ "wavefunction": ("#b45309", "#fffbeb", _ICON_WAVE),
85
+ }
86
+ _METHOD_FALLBACK_STYLE = ("#475569", "#f8fafc", _ICON_HF)
87
+
88
+ _BASIS_FAMILY_STYLE = {
89
+ "minimal": ("#64748b", "#f8fafc", _ICON_BASIS_MINIMAL),
90
+ "pople": ("#0d9488", "#f0fdfa", _ICON_BASIS_POPLE),
91
+ "cc": ("#15803d", "#f0fdf4", _ICON_BASIS_CC),
92
+ "def2": ("#c2410c", "#fff7ed", _ICON_BASIS_DEF2),
93
+ }
94
+
95
+ # ── Basis family classification + one-line copy ──────────────────────────────
96
+
97
+ _BASIS_COPY = {
98
+ "minimal": (
99
+ "Minimal",
100
+ "Fastest, lowest accuracy — great for learning, not research.",
101
+ ),
102
+ "pople": (
103
+ "Split-valence (Pople)",
104
+ "Balanced speed/accuracy; * and ** add polarisation for bonds "
105
+ "and lone pairs.",
106
+ ),
107
+ "cc": (
108
+ "Correlation-consistent",
109
+ "Systematic convergence; best paired with correlated methods " "(MP2 / CCSD).",
110
+ ),
111
+ "def2": (
112
+ "Karlsruhe (def2)",
113
+ "Optimised for DFT; def2-SVP a solid default, def2-TZVP near "
114
+ "complete-basis accuracy.",
115
+ ),
116
+ }
117
+
118
+
119
+ def basis_family(basis: str) -> str:
120
+ """Classify a basis-set name into an icon/copy family key."""
121
+ if basis == "STO-3G":
122
+ return "minimal"
123
+ if "cc-pV" in basis:
124
+ return "cc"
125
+ if "def2" in basis:
126
+ return "def2"
127
+ # 3-21G and the whole 6-31G family are Pople split-valence sets.
128
+ if basis.startswith("6-31") or basis == "3-21G" or basis.startswith("6-311"):
129
+ return "pople"
130
+ return "pople"
131
+
132
+
133
+ # ── Card HTML ────────────────────────────────────────────────────────────────
134
+
135
+
136
+ def _card_html(*, fg: str, bg: str, icon: str, title: str, body: str) -> str:
137
+ """Assemble one descriptor card (icon + title + one-line body)."""
138
+ return (
139
+ f'<div style="display:flex;gap:10px;align-items:flex-start;'
140
+ f"background:{bg};border-left:4px solid {fg};padding:8px 11px;"
141
+ f'border-radius:4px;margin:6px 0;max-width:250px">'
142
+ f'<span style="color:{fg};flex:0 0 auto;line-height:0;margin-top:1px">'
143
+ f"{icon}</span>"
144
+ f'<div style="min-width:0">'
145
+ f'<div style="font-weight:700;font-size:12px;color:{fg};'
146
+ f'letter-spacing:0.01em">{title}</div>'
147
+ f'<div style="font-size:11.5px;color:#475569;line-height:1.35;'
148
+ f'margin-top:2px">{body}</div>'
149
+ f"</div></div>"
150
+ )
151
+
152
+
153
+ def method_card_html(method: str) -> str:
154
+ """Return the descriptor-card HTML for *method*."""
155
+ info = config.METHOD_INFO.get(method)
156
+ if not info:
157
+ fg, bg, icon = _METHOD_FALLBACK_STYLE
158
+ return _card_html(fg=fg, bg=bg, icon=icon, title=method, body="")
159
+ fg, bg, icon = _METHOD_FAMILY_STYLE.get(
160
+ info.get("type", ""), _METHOD_FALLBACK_STYLE
161
+ )
162
+ # The label is "NAME — Descriptor…"; the part after the em dash is a tidy
163
+ # family descriptor ("DFT Hybrid Functional", "Restricted Hartree-Fock").
164
+ label = info.get("label", method)
165
+ suffix = label.split("—", 1)[1].strip() if "—" in label else ""
166
+ title = f"{method} · {suffix}" if suffix else method
167
+ body = info.get("use_for", info.get("description", ""))
168
+ return _card_html(fg=fg, bg=bg, icon=icon, title=title, body=body)
169
+
170
+
171
+ def basis_card_html(basis: str) -> str:
172
+ """Return the descriptor-card HTML for *basis*."""
173
+ fam = basis_family(basis)
174
+ fg, bg, icon = _BASIS_FAMILY_STYLE[fam]
175
+ fam_label, body = _BASIS_COPY[fam]
176
+ title = f"{basis} · {fam_label}"
177
+ # Starred Pople sets have an equivalent parenthesis spelling that textbooks
178
+ # use interchangeably (6-31G* == 6-31G(d)). Show it so the dropdown entry is
179
+ # recognisable to someone who only knows the other form. Deliberately ONE
180
+ # short line: these cards exist because the previous inline notes were "a lot
181
+ # of word clutter" (FR-DESCRIPTOR-CARDS), so the full notation table lives in
182
+ # the basis-set help topic instead.
183
+ alias = config.pople_notation_alias(basis)
184
+ if alias:
185
+ body += f' <span style="color:#64748b">Also written <b>{alias}</b>.</span>'
186
+ return _card_html(fg=fg, bg=bg, icon=icon, title=title, body=body)