tailwater 0.2.0__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.
- tailwater/__init__.py +114 -0
- tailwater/client.py +610 -0
- tailwater/constants.py +30 -0
- tailwater/finetune_heads.py +552 -0
- tailwater/heads_only_model.py +317 -0
- tailwater/hr_export.py +273 -0
- tailwater/make_heads_only.py +34 -0
- tailwater/subspace_utils.py +832 -0
- tailwater/wannier_wizard.py +1466 -0
- tailwater-0.2.0.dist-info/LICENSE +15 -0
- tailwater-0.2.0.dist-info/METADATA +343 -0
- tailwater-0.2.0.dist-info/RECORD +14 -0
- tailwater-0.2.0.dist-info/WHEEL +5 -0
- tailwater-0.2.0.dist-info/top_level.txt +1 -0
tailwater/__init__.py
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"""Tailwater — client and post-processing toolkit for the Tailwater Wannier-Hamiltonian inference API.
|
|
2
|
+
|
|
3
|
+
Three workflow layers:
|
|
4
|
+
|
|
5
|
+
1. HTTP CLIENT — talk to the inference API
|
|
6
|
+
from tailwater import tw_api_call
|
|
7
|
+
paths = tw_api_call(structure, user, password, "./out", "mat", project=True)
|
|
8
|
+
|
|
9
|
+
2. SUBSPACE PROJECTION — fine-tune the output heads on supplier-provided
|
|
10
|
+
embeddings to project predictions into a near-Fermi energy window
|
|
11
|
+
from tailwater import subspace_projection
|
|
12
|
+
subspace_projection(start_lr, end_lr, num_epochs, energy_range,
|
|
13
|
+
decay_sigma, device, save_path,
|
|
14
|
+
embed_path, graph_output_path)
|
|
15
|
+
|
|
16
|
+
3. POST-PROCESSING — load the HDF5 tight-binding model and run bulk DOS,
|
|
17
|
+
surface spectral density, surface Greens-function (Lopez-Sancho),
|
|
18
|
+
or Fermi-arc analyses
|
|
19
|
+
from tailwater import tb_model, BulkDOS, SurfaceGreensFunction
|
|
20
|
+
model = tb_model.load("wannier90_hr.hdf5")
|
|
21
|
+
result = SurfaceGreensFunction(model, ...).run()
|
|
22
|
+
result.figure_top.savefig(...)
|
|
23
|
+
|
|
24
|
+
The package is self-contained — it does NOT require the proprietary
|
|
25
|
+
backbone weights or training code. Only the customer-shippable head
|
|
26
|
+
checkpoint (HeadsOnly.pth) and HDF5 / .pt artifacts produced by the
|
|
27
|
+
API are needed.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
__version__ = "0.2.0"
|
|
31
|
+
|
|
32
|
+
# ---- HTTP client + HDF5 loader ----
|
|
33
|
+
from .client import (
|
|
34
|
+
tw_api_call,
|
|
35
|
+
tb_model,
|
|
36
|
+
remaining_credits,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
# ---- Heads-only inference model ----
|
|
40
|
+
from .heads_only_model import (
|
|
41
|
+
HeadsOnly,
|
|
42
|
+
CovariantOnsiteHead,
|
|
43
|
+
CovariantEdgeHead,
|
|
44
|
+
load_heads_only_checkpoint,
|
|
45
|
+
save_heads_only_checkpoint,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
# ---- Subspace fine-tuning ----
|
|
49
|
+
from .finetune_heads import subspace_projection
|
|
50
|
+
|
|
51
|
+
# ---- Subspace loss helpers (advanced — used by subspace_projection internally) ----
|
|
52
|
+
from .subspace_utils import (
|
|
53
|
+
Subspace_H_MSE_Loss,
|
|
54
|
+
Subspace_EigLoss,
|
|
55
|
+
Eigenvalue_Only_Loss,
|
|
56
|
+
make_eigenvalue_only_data,
|
|
57
|
+
build_subspace_active_mask,
|
|
58
|
+
write_subspace_basis_file,
|
|
59
|
+
SPATIAL_BASIS_LABELS,
|
|
60
|
+
SPIN_BASIS_LABELS,
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
# ---- tbmodels assembly from raw head output ----
|
|
64
|
+
from .hr_export import (
|
|
65
|
+
build_hr_model,
|
|
66
|
+
build_hr_model_fast,
|
|
67
|
+
write_hr_output,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
# ---- Post-processing (KPM / Lopez-Sancho / Fermi-arc / bands) ----
|
|
71
|
+
from .wannier_wizard import (
|
|
72
|
+
BulkDOS,
|
|
73
|
+
SurfaceSpectralDensity,
|
|
74
|
+
SurfaceGreensFunction,
|
|
75
|
+
FermiArcMap,
|
|
76
|
+
BandStructure,
|
|
77
|
+
BulkDOSResult,
|
|
78
|
+
SurfaceSpectralDensityResult,
|
|
79
|
+
SurfaceGreensFunctionResult,
|
|
80
|
+
FermiArcMapResult,
|
|
81
|
+
BandStructureResult,
|
|
82
|
+
generate_k_path,
|
|
83
|
+
bulk_band_structure,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
# ---- Constants (rarely needed directly; exposed for advanced users) ----
|
|
87
|
+
from .constants import NeighBrs, NUM_ELEMENTS
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
__all__ = [
|
|
91
|
+
"__version__",
|
|
92
|
+
# client
|
|
93
|
+
"tw_api_call", "tb_model", "remaining_credits",
|
|
94
|
+
# heads-only
|
|
95
|
+
"HeadsOnly", "CovariantOnsiteHead", "CovariantEdgeHead",
|
|
96
|
+
"load_heads_only_checkpoint", "save_heads_only_checkpoint",
|
|
97
|
+
# subspace
|
|
98
|
+
"subspace_projection",
|
|
99
|
+
"Subspace_H_MSE_Loss", "Subspace_EigLoss", "Eigenvalue_Only_Loss",
|
|
100
|
+
"make_eigenvalue_only_data", "build_subspace_active_mask",
|
|
101
|
+
"write_subspace_basis_file",
|
|
102
|
+
"SPATIAL_BASIS_LABELS", "SPIN_BASIS_LABELS",
|
|
103
|
+
# tbmodels assembly
|
|
104
|
+
"build_hr_model", "build_hr_model_fast", "write_hr_output",
|
|
105
|
+
# post-processing
|
|
106
|
+
"BulkDOS", "SurfaceSpectralDensity", "SurfaceGreensFunction",
|
|
107
|
+
"FermiArcMap", "BandStructure",
|
|
108
|
+
"BulkDOSResult", "SurfaceSpectralDensityResult",
|
|
109
|
+
"SurfaceGreensFunctionResult", "FermiArcMapResult",
|
|
110
|
+
"BandStructureResult",
|
|
111
|
+
"generate_k_path", "bulk_band_structure",
|
|
112
|
+
# constants
|
|
113
|
+
"NeighBrs", "NUM_ELEMENTS",
|
|
114
|
+
]
|