qten.bands
Module reference for qten.bands.
bands
Band-structure helpers for momentum-resolved QTen tensors.
This module provides utilities for transforming, folding, unfolding, filling,
and selecting bands represented as Tensor
objects. The common convention is that a band tensor has dimensions
(MomentumSpace, HilbertSpace, HilbertSpace): the
MomentumSpace axis indexes
crystal momenta and the two
HilbertSpace axes form the
Hamiltonian or operator matrix at each momentum.
Mathematical convention
A band tensor represents a family of matrices indexed by crystal momentum: \(H : k \mapsto H(k)\), with \(H(k)_{ab} = \langle a | H(k) | b \rangle\).
In code this is stored as a rank-3 Tensor with
dims (K, B_left, B_right), where K is a
MomentumSpace and the two
Hilbert-space axes provide the row and column basis labels for each matrix
block.
Geometry transformations act on both parts of this object: \(k \mapsto k'\) and \(H(k) \mapsto U(k)\,H(k)\,U(k)^\dagger\).
where the \(k\)-dependent change-of-basis matrix \(U(k)\) is assembled from symbolic Hilbert-space relabeling and finite Fourier transforms.
Repository usage
The functions here sit between geometry, symbolic Hilbert-space labels, and linear algebra. Geometry objects provide real and reciprocal lattice structure, symbolic state spaces label tensor axes, and linear algebra routines diagonalize the momentum-sector matrices when filling or selecting bands.
upsample
upsample(tensor: Tensor, scale: Tuple[int, ...]) -> Tensor
Interpolate a momentum-resolved matrix tensor onto a denser BZ grid.
The interpolation is performed in the localized (Wannier) representation:
the sampled matrices are inverse Fourier transformed to hopping matrices on
the original finite real-space cell, then evaluated on the momentum grid
dual to an enlarged periodic cell. Thus scale=(s1, ..., sd) multiplies
the real-space boundary generators by the corresponding positive integer
factors and increases the number of momentum sectors by prod(scale).
Centered representatives of the original translation quotient are used. At an even-period boundary, the half-period translation is assigned to the negative representative. This convention is deterministic and generally gives the locality-friendly interpolation used for Wannier Hamiltonians.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tensor
|
Tensor
|
Matrix tensor with dims |
required |
scale
|
Tuple[int, ...]
|
Positive integer enlargement factor for each real-space boundary generator. |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Interpolated tensor with dims |
Notes
This is exact on the original momentum grid but does not create additional physical information. Reliable interpolation requires a consistent, localized Bloch/orbital gauge; independently sorted eigenvalues are not a substitute for the matrix-valued input.
Source code in src/qten/bands.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | |
interpolate_path
interpolate_path(
recip: ReciprocalLattice,
waypoints: Sequence[str],
points: KPointSet,
n_points: int = 100,
wrap_fractional: bool = True,
) -> BzPath
Build a sampled Brillouin-zone path in a reciprocal lattice.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recip
|
ReciprocalLattice
|
Reciprocal lattice in which waypoint coordinates are interpreted. |
required |
waypoints
|
Sequence[str]
|
Waypoint names in path order, e.g. |
required |
n_points
|
int
|
Number of samples used along the full interpolated path. |
100
|
points
|
KPointSet
|
Named reciprocal-space points carrying their source reciprocal lattice.
They are rebased to |
required |
wrap_fractional
|
bool
|
If True, wrap each rebased waypoint into the canonical fractional cell before interpolation. Set to False to preserve raw rebased coordinates. |
True
|
Returns:
| Type | Description |
|---|---|
BzPath
|
Sampled Brillouin-zone path with momentum space, waypoint labels, and path-order metadata. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If |
ValueError
|
If fewer than two waypoints are supplied, if a named waypoint is not
present in |
Examples:
path = interpolate_path(
recip,
waypoints=["G", "X", "M"],
points=KPointSet.from_points(
recip,
{"G": (0.0, 0.0), "X": (0.5, 0.0), "M": (0.5, 0.5)},
),
)
path = interpolate_path(
recip=new_recip,
waypoints=["G", "X", "M"],
points=original_kpoints, # KPointSet tied to old reciprocal basis
)
Source code in src/qten/bands.py
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 | |
get_band_transform
get_band_transform(
t: Opr,
tensor: Tensor,
side: Literal["left", "right"] = "left",
) -> MomentumBlockTensor
get_band_transform(
t: Opr,
kspace: MomentumSpace,
target_space: HilbertSpace,
*,
device: Optional[Device] = None,
) -> MomentumBlockTensor
Construct a reusable one-sided geometric basis-change operator for a momentum-resolved band tensor.
Supported forms
get_band_transform(t, tensor, side=...)
Build the transform from a rank-3 band tensor with dims
(MomentumSpace, HilbertSpace, HilbertSpace), using side to choose
which Hilbert-space leg is sampled.
get_band_transform(t, kspace, target_space, device=...)
Build the same transform directly from an explicit
MomentumSpace kspace
and sampled HilbertSpace
target_space, without first packaging them into a rank-3 tensor.
Use cases
This helper is useful when the geometric action should be materialized once
and then reused across multiple band tensors, when only one matrix leg of a
non-Hermitian or rectangular band object should be transformed, or when the
transform itself should be inspected as a
MomentumBlockTensor rather than applied
immediately.
For example, a caller may build the left and right transforms separately, cache them, and apply them to several tensors sharing the same symbolic momentum and Hilbert spaces.
This function factors one side of the geometric basis change performed by
bandtransform into an explicit
MomentumBlockTensor \(T_g\). For a
momentum-resolved operator \(H\), the one-sided transformed tensor is
recovered by \(T_g H\) when side="left" and by
\(H T_g^\dagger\) when side="right". Applying both sides requires
composing the two separately constructed transforms.
The leading axis of \(T_g\) is a
MomentumBlockSpace
storing ordered pairs (t @ k, k): each block describes the basis map from
the source momentum sector k to the transformed sector t @ k.
Behavior
This function does not transform tensor data directly. Instead it builds a block operator whose momentum-pair axis records how source sectors feed transformed sectors. The Hilbert-space block at each such pair combines:
- the symbolic action of
ton the sampled basis, - fractional wrapping back to the home unit cell, and
- the Fourier phase needed to keep Bloch conventions consistent after the geometric relabeling.
The returned transform is therefore the reusable one-sided ingredient of
bandtransform, not merely a permutation of
momentum labels.
Basis sampling
The input tensor may have dims (K, B_left, B_right) with potentially
different left and right Hilbert spaces. The side argument chooses which
matrix leg supplies the canonical Hilbert space used to assemble \(T_g\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
Opr
|
required | |
tensor
|
Tensor
|
Rank-3 momentum-space tensor with dims
|
required |
side
|
Literal['left', 'right']
|
Which matrix leg to sample when constructing the transform basis.
|
'left'
|
Returns:
| Type | Description |
|---|---|
MomentumBlockTensor
|
Block transform tensor with dims
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
TypeError
|
If the tensor dims do not have the required
|
Notes
The generated API docs for this module show overload signatures, but the
prose is rendered from this public implementation docstring. The explicit
space overload accepts kspace and target_space directly, then
dispatches here through the shared construction path.
Examples:
Build and apply only the left transform:
T_left = get_band_transform(t, tensor, side="left")
routed = T_left @ tensor
Build both one-sided transforms explicitly and compose them:
T_left = get_band_transform(t, tensor, side="left")
T_right = get_band_transform(t, tensor, side="right")
transformed = T_left @ tensor @ T_right.h(-2, -1)
Build the transform directly from symbolic spaces:
T_left = get_band_transform(t, kspace, hilbert_space, device=device)
See Also
bandtransform(t, tensor, opt=...)
Public wrapper that applies one-sided or two-sided band transforms.
get_band_fold(transform, tensor, side=...)
Folding analogue that builds the corresponding block transform for a
basis-change-induced Brillouin-zone fold.
Source code in src/qten/bands.py
803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 | |
get_band_fold
get_band_fold(
transform: BasisTransform,
tensor: Tensor,
side: Literal["left", "right"] = "left",
) -> MomentumBlockTensor
get_band_fold(
transform: BasisTransform,
k_space: MomentumSpace,
target_space: HilbertSpace,
*,
device: Optional[Device] = None,
) -> MomentumBlockTensor
Construct a reusable one-sided Brillouin-zone folding operator for a momentum-resolved band tensor.
Supported forms
get_band_fold(transform, tensor, side=...)
Build the folding transform from a rank-3 band tensor with dims
(MomentumSpace, HilbertSpace, HilbertSpace), using side to choose
which Hilbert-space leg is sampled.
get_band_fold(transform, k_space, target_space, device=...)
Build the same folding transform directly from an explicit
MomentumSpace k_space
and sampled HilbertSpace
target_space, without first packaging them into a rank-3 tensor.
Use cases
This helper is useful when Brillouin-zone folding should be factored into a reusable one-sided operator, when left and right Hilbert-space legs should be folded independently, or when the folding map itself should be examined as a block tensor before applying it to data.
Typical workflows include caching folded-cell transforms for repeated use, applying folding to only one matrix leg of a tensor, or explicitly constructing the left and right folded operators before composing them.
This function factors one side of the Brillouin-zone folding operation
into an explicit MomentumBlockTensor \(T_g\).
For a momentum-resolved operator \(H\), the one-sided folded tensor is
recovered by \(T_g H\) when side="left" and by
\(H T_g^\dagger\) when side="right". Folding both sides requires
composing the two separately constructed transforms.
Each block of \(T_g\) is labelled by a pair
\((k_{\mathrm{fold}}, k)\) on its leading
MomentumBlockSpace,
where \(k\) is a momentum of the original Brillouin zone and
\(k_{\mathrm{fold}}\) is the momentum sector it maps to in the folded
zone.
The Hilbert-space legs encode the Fourier-based change of basis between the
original unit cell and the enlarged transformed cell.
Behavior
Folding changes both the momentum grid and the real-space basis. This helper builds the one-sided block operator that performs those two tasks together:
- each source momentum sector is routed to its folded-zone momentum,
- the sampled Hilbert-space basis is enlarged to the transformed unit cell, and
- the corresponding Fourier change of basis is assembled into each block.
The result is not just a relabeling of momentum sectors. It is the
reusable one-sided ingredient of bandfold that
carries both sector routing and enlarged-cell basis conversion.
When multiple basis states share the same fractional site within the
sampled Hilbert space, all of them are preserved in the enlarged folded
basis.
Basis sampling
The input tensor may have dims (K, B_left, B_right) with potentially
different left and right Hilbert spaces. The side argument chooses which
leg supplies the canonical basis from which the folding transform is built.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
transform
|
BasisTransform
|
Direct-lattice basis transformation that defines the folded Brillouin zone. |
required |
tensor
|
Tensor
|
Rank-3 momentum-space tensor with dims
|
required |
side
|
Literal['left', 'right']
|
Which matrix leg to sample when constructing the folding basis.
|
'left'
|
Returns:
| Type | Description |
|---|---|
MomentumBlockTensor
|
Block folding tensor with dims |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
TypeError
|
If the tensor dims do not have the required
|
Notes
The generated API docs for this module show overload signatures, but the
prose is rendered from this public implementation docstring. The explicit
space overload accepts k_space and target_space directly, then
dispatches here through the shared folding construction path.
Examples:
Build and apply only the right folding transform:
T_right = get_band_fold(transform, tensor, side="right")
routed = tensor @ T_right.h(-2, -1)
Build both one-sided folding transforms explicitly:
T_left = get_band_fold(transform, tensor, side="left")
T_right = get_band_fold(transform, tensor, side="right")
folded = T_left @ tensor @ T_right.h(-2, -1)
Build the folding transform directly from symbolic spaces:
T_left = get_band_fold(transform, k_space, hilbert_space, device=device)
See Also
bandfold(transform, tensor, opt=...)
Public wrapper that applies this block folding transform to a band
tensor.
get_band_transform(t, tensor, side=...)
Symmetry-transform analogue that constructs a momentum-block transform
without Brillouin-zone folding.
Source code in src/qten/bands.py
1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 | |
bandtransform
bandtransform(
t: Opr,
tensor: Tensor,
opt: Literal["left", "right", "both"] = "both",
) -> Tensor
Apply a basis transform to a momentum-resolved operator tensor.
The expected tensor shape is (K, B_left, B_right) where K is a
MomentumSpace and
B_left, B_right are
HilbertSpace axes. This
function applies the operator-induced basis transform on the selected
Hilbert-space legs of the band tensor.
For each transformed side, a k-dependent matrix is built from the action of
t on the Hilbert-space basis and Fourier transforms that connect Bloch and
real-space sectors.
Mathematical action
Let \(B_{\mathrm{left}}\) and \(B_{\mathrm{right}}\) be the input Hilbert-space bases and let the corresponding transformed bases be \(tB_{\mathrm{left}}\) and \(tB_{\mathrm{right}}\). After wrapping transformed sites back to the home unit cell, the finite Fourier transform contributes a momentum-dependent phase. The resulting basis-change matrices are denoted \(U_t^{(\mathrm{left})}(k)\) and \(U_t^{(\mathrm{right})}(k)\). When routed contributions are collapsed back onto the transformed momentum grid, the transformed band block is one of:
opt="left":
\(H'(t k) = U_t^{(\mathrm{left})}(k)\,H(k)\)
opt="right":
\(H'(t k) = H(k)\,U_t^{(\mathrm{right})}(k)^\dagger\)
opt="both":
\(H'(t k) = U_t^{(\mathrm{left})}(k)\,H(k)\,U_t^{(\mathrm{right})}(k)^\dagger\)
Momentum handling
The action on Momentum is treated as
a relabeling or permutation of sectors. For opt="both", the output
tensor carries the transformed momentum axis
mapped_kspace = {t @ k | k in kspace}. For opt="left" and
opt="right", the implementation instead preserves a routed
MomentumBlockSpace pair
axis so each source block remains attached to its transformed target
sector. In either case, the selected Hilbert-space transforms are applied
before any optional collapse back to a plain
MomentumSpace.
Notes
This function accepts a general Opr, but not every Opr is valid here.
In practice, t must act coherently across the real-space and
momentum-space labels carried by the tensor:
t @ k must be defined for each
Momentum in the first tensor axis.
t @ psi must be defined for each
U1Basis in the Hilbert-space
axes, in particular for the
Offset irrep stored inside each basis
state.
The Hilbert-space action and momentum action must be dual-compatible, so
that the Fourier transform remains consistent after applying t.
For each selected side, after applying
FuncOpr(Offset, Offset.fractional),
the transformed Hilbert space must have the same rays as the sampled input
basis on that side. Otherwise the transformed basis does not close on that
band leg and this function raises ValueError.
Operators that only act on abstract U1Basis values or only on Momentum
values are not sufficient. The operator must provide matching actions on
site offsets and crystal momentum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
Opr
|
Operator to apply. It must satisfy the compatibility conditions described in the notes below. |
required |
tensor
|
Tensor
|
Momentum-space tensor with dims
|
required |
opt
|
Literal['left', 'right', 'both']
|
Which matrix legs to transform. |
'both'
|
Returns:
| Type | Description |
|---|---|
Tensor
|
If |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
TypeError
|
If the tensor dims do not have the required
|
Source code in src/qten/bands.py
1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 | |
bandfold
bandfold(
transform: BasisTransform,
tensor: Tensor,
opt: Literal["left", "right", "both"] = "both",
) -> Tensor
Fold a momentum-resolved band tensor into the Brillouin zone of a transformed lattice basis.
The input tensor is expected to have dimensions
(MomentumSpace, HilbertSpace, HilbertSpace). The basis transformation is
applied to the direct lattice underlying the
MomentumSpace axis, which
produces a new Brillouin zone and a corresponding momentum remapping. One
or both HilbertSpace legs
are enlarged to match the transformed unit cell, Fourier-space changes of
basis are applied, and the momentum sectors are then gathered into the new
momentum grid. If multiple basis states share the same site offset in the
sampled Hilbert space, folding preserves all of them at the corresponding
folded-cell site.
Mathematical action
A forward basis transform coarsens the direct lattice basis, so the reciprocal Brillouin zone shrinks and multiple old momenta fold onto one new momentum sector. If \(F_{\mathrm{left}}(k)\) and \(F_{\mathrm{right}}(k)\) are the Fourier-based change-of-basis maps on the selected tensor legs, then, after routed contributions are collapsed onto the folded momentum grid, the folded block is one of:
opt="left":
\(H_{\mathrm{fold}}(k') \mathrel{+}= F_{\mathrm{left}}(k)^\dagger H(k)\)
opt="right":
\(H_{\mathrm{fold}}(k') \mathrel{+}= H(k) F_{\mathrm{right}}(k)\)
opt="both":
\(H_{\mathrm{fold}}(k') \mathrel{+}= F_{\mathrm{left}}(k)^\dagger H(k) F_{\mathrm{right}}(k)\)
with \(k' = \mathrm{fold}(k)\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
transform
|
BasisTransform
|
Basis change applied to the direct lattice associated with the momentum axis. |
required |
tensor
|
Tensor
|
Rank-3 tensor with dimensions
|
required |
opt
|
Literal['left', 'right', 'both']
|
Which matrix legs to fold. |
'both'
|
Returns:
| Type | Description |
|---|---|
Tensor
|
If |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the tensor is not rank-3, if the momentum space is empty, or if the momentum axis does not belong to a single Brillouin zone. Also raised if the sampled Hilbert basis on a selected side has no states at a required unit-cell offset during the folding construction. |
TypeError
|
If the momentum axis is not a
|
Source code in src/qten/bands.py
1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 | |
bandunfold
bandunfold(
inverse_transform: InverseBasisTransform, tensor: Tensor
) -> Tensor
Unfold a folded momentum-resolved band tensor using an inverse basis transform.
The input is expected to have dimensions (MomentumSpace, HilbertSpace,
HilbertSpace) where the
MomentumSpace axis lives on a
transformed (folded) Brillouin zone. The inverse transform maps that folded
lattice back to the primitive one and recovers dimensions
(K_primitive, B_primitive, B_primitive).
Mathematical action
Unfolding routes each primitive momentum \(k\) to its parent folded
momentum \(\bar{k}\), gathers \(H_{\mathrm{fold}}(\bar{k})\), and then
projects it back to the primitive-cell basis with a Fourier map \(F(k)\):
\(H_{\mathrm{unfold}}(k)
= F(k)\,H_{\mathrm{fold}}(\bar{k})\,F(k)^\dagger\). In code, the parent-sector lookup is tensor.data[k_indices.data], and the
final basis projection is f @ gathered @ f.h(-2, -1).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inverse_transform
|
InverseBasisTransform
|
Inverse basis transform that maps the folded direct lattice back to the primitive lattice. |
required |
tensor
|
Tensor
|
Rank-3 folded band tensor with dimensions
|
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Unfolded tensor on the primitive Brillouin-zone
|
Raises:
| Type | Description |
|---|---|
TypeError
|
If |
ValueError
|
If |
Source code in src/qten/bands.py
1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 | |
bandcounts
bandcounts(tensor: Tensor) -> Tensor
Count nonzero columns in each momentum-sector matrix.
The input tensor is expected to have dimensions
(MomentumSpace, HilbertSpace, StateSpace). For each momentum sector, the
trailing two axes are treated as a matrix with rows labelled by the
HilbertSpace axis and
columns labelled by the trailing
StateSpace axis. A column is
counted if any entry in that column is nonzero.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tensor
|
Tensor
|
Rank-3 tensor with dimensions |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Integer-valued tensor with dimensions |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
TypeError
|
If the tensor axes are not |
Source code in src/qten/bands.py
1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 | |
von_neumann
von_neumann(
tensor: Tensor,
mode: Literal["sum", "mean", "per-k"] = "mean",
) -> Union[Tensor, float]
Compute the free-fermion von Neumann entropy of a momentum-resolved band tensor.
The input is interpreted as a family of single-particle correlation
matrices C(k) with dimensions (MomentumSpace, HilbertSpace,
HilbertSpace). For each momentum sector, the spectrum
lambda_n(k) is used to evaluate the binary entropy
\(S(k) = -\sum_n [\lambda_n \log(\lambda_n) + (1-\lambda_n)\log(1-\lambda_n)]\).
This vanishes exactly when every eigenvalue is 0 or 1, which is the
projector criterion for a pure Slater state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tensor
|
Tensor
|
Rank-3 tensor with dimensions |
required |
mode
|
Literal['sum', 'mean', 'per-k']
|
Reduction mode for the momentum-resolved entropy:
- |
"mean"
|
Returns:
| Type | Description |
|---|---|
Tensor | float
|
Momentum-resolved entropy tensor if |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/qten/bands.py
1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 | |
assert_pure
assert_pure(
tensor: Tensor,
threshold: float = 1e-10,
report_limit: int = 8,
) -> None
Assert that a momentum-resolved correlation tensor is pure at every momentum.
Purity is checked through von_neumann(). A
tensor is considered pure when every momentum-sector entropy is zero up to
floating-point tolerance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tensor
|
Tensor
|
Rank-3 tensor with dimensions |
required |
threshold
|
float
|
Maximum allowed von Neumann entropy per momentum sector. Momentum sectors with entropy larger than this threshold are reported as impure. |
1e-10
|
report_limit
|
int
|
Maximum number of violating momentum sectors to include in the error message. |
8
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
AssertionError
|
If one or more momentum sectors have nonzero entropy. |
Source code in src/qten/bands.py
1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 | |
bandfillings
bandfillings(tensor: Tensor, frac: float) -> Tensor
Return eigenvectors for occupied bands up to a filling fraction.
The input tensor is expected to have dimensions
(MomentumSpace, HilbertSpace, HilbertSpace), where the
MomentumSpace axis indexes
momentum sectors and the two
HilbertSpace axes form the
Hamiltonian matrix at each momentum. The tensor is diagonalized at each
momentum, then eigenvectors with energies below the global filling
threshold are packed into an output
IndexSpace.
Mathematical convention
Each momentum block is diagonalized as \(H(k) V(k) = V(k) E(k)\), and the eigenvectors whose energies fall below the global filling threshold
are retained. If frac = f, the target number of occupied states is
\(N_{\mathrm{occ}} = \left\lfloor f\,N_k\,N_b \right\rfloor\), where \(N_k\) is the number of momentum sectors and \(N_b\) is the number of bands per sector. Degenerate states at the threshold are included together.
Degenerate threshold behavior
If one state in a degenerate set is filled, all states in that set are filled. The output index dimension is therefore the maximum number of filled states over all momentum sectors, and sectors with fewer filled states are padded with zeros.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tensor
|
Tensor
|
Band-resolved tensor with dimensions
|
required |
frac
|
float
|
Filling fraction in the inclusive range |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Eigenvector tensor with dimensions |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the tensor axes are not |
ValueError
|
If |
Source code in src/qten/bands.py
1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 | |
svd_projection
svd_projection(
target: Tensor[Any],
source: Tensor[Any],
svd_threshold: float = 0.1,
infer_lattice: bool = False,
) -> Tensor[Any]
Align target states to a source-defined gauge via sectorwise SVD.
This function computes the sectorwise overlap between target and source states, extracts the polar/unitary factor of that overlap via SVD, and rotates the target columns into the source-selected gauge.
Mathematical convention
For each momentum sector \(k\), collect the target columns into a matrix \(T(k)\) and the source columns into a matrix \(S(k)\). If the target Hilbert dimension is \(N\), the target rank is \(r_t\), and the source rank is \(r_s\), then \(T(k) \in \mathbb{C}^{N \times r_t}\) and \(S(k) \in \mathbb{C}^{N \times r_s}\).
The method proceeds sector by sector:
-
Form the overlap matrix \(M(k) = T(k)^\dagger S(k)\), so \(M(k) \in \mathbb{C}^{r_t \times r_s}\).
-
Compute the singular value decomposition \(M(k) = U(k)\,\Sigma(k)\,V(k)^\dagger\).
-
Discard the singular values and keep only the unitary/polar factor \(Q(k) = U(k)\,V(k)^\dagger\).
-
Rotate the target states by that factor: \(T_{\mathrm{proj}}(k) = T(k)\,Q(k)\).
This output has the same row space as the target states, but its column gauge is chosen to optimally match the source states in the orthogonal Procrustes sense. Equivalently, \(Q(k)\) solves \(\min_Q \|T(k)Q - S(k)\|_F\) over partial isometries \(Q\) of the form \(Q = U V^\dagger\) induced by the SVD of \(T(k)^\dagger S(k)\).
When \(r_t \neq r_s\), the overlap \(M(k)\) is rectangular, so the method still makes sense: it returns the best SVD-induced alignment from the target column space toward the source column space without requiring equal rank.
If either target or source uses zero-padded columns to represent
an inconsistent number of states across the Brillouin zone, those padded
columns are ignored on a per-momentum basis when forming the SVD. The
projection therefore acts only on the intersection of nonzero target
columns and nonzero source columns at each momentum sector.
In the default branch, or whenever the source metadata is insufficient to
infer a lattice-backed column space, the result is a plain rank-3
Tensor with the input
MomentumSpace axis preserved.
If infer_lattice=True and the source column space is a
HilbertSpace carrying
Offset labels, the function tries to
build a lattice description directly from those labels.
A simple example is:
- suppose the source-side basis contains states such as \(|r_1\rangle \otimes |\alpha\rangle\), \(|r_2\rangle \otimes |\beta\rangle\), \(|r_1\rangle \otimes |\gamma\rangle\);
- then the new unit cell is built from the distinct site positions \(r_1, r_2\) in the order they first appear;
- the extra labels \(|\alpha\rangle\), \(|\beta\rangle\), \(|\gamma\rangle\) are kept, but they are now understood as living on that newly built unit cell.
More concretely, the construction:
- rebases the source offsets onto the direct lattice of the input momentum grid;
- converts those offsets to fractional coordinates;
- uses the distinct fractional positions as the sites of a new unit cell;
- keeps the same overall lattice basis and boundary conditions, so only the unit-cell contents are being rebuilt.
In that branch, the return value becomes a
MomentumBlockTensor. Its leading
MomentumBlockSpace
stores pairs (k_old, k_new), where k_old is the original momentum
sector from the input tensor and k_new is the momentum sector in the
newly created reciprocal lattice with the same fractional momentum
coordinate.
The last two tensor legs also become more specific:
- the middle leg stays in the original target/band Hilbert space;
- the last leg becomes the Bloch space built from the newly created lattice, so its basis states now refer to the newly constructed unit-cell sites rather than the original source labels.
If this lattice inference cannot be carried out, the function simply falls back to the plain rank-3 projected tensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
Tensor
|
Target states with dims
|
required |
source
|
Tensor
|
Source states with dims |
required |
svd_threshold
|
float
|
Warn if the minimum singular value of the overlap drops below this threshold, which signals linearly dependent source states or poor projection onto the target subspace after zero-padded columns have been ignored. |
0.1
|
infer_lattice
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
Tensor
|
Projected states. The fallback result has dims
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If either input tensor is not rank 3. |
TypeError
|
If either input tensor does not have
|
Source code in src/qten/bands.py
2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 | |
bandselect
bandselect(
tensor: Tensor,
**kwargs: Dict[
str,
Union[
slice,
Tuple[int, ...],
Tuple[float, float],
Callable[[float], bool],
],
],
) -> Dict[str, Tensor]
Select specific bands from a band-resolved Tensor based on criteria provided in kwargs.
The input Tensor is diagonalized at each
MomentumSpace sector. Each
keyword argument defines one named selection criterion, and the returned
dictionary maps each name to a tensor containing the matching eigenvectors.
Outputs have dimensions (MomentumSpace, HilbertSpace, IndexSpace), where
HilbertSpace labels the band
basis and IndexSpace labels the
selected states for each criterion.
Mathematical convention
For each momentum sector, \(H(k) v_n(k) = \epsilon_n(k) v_n(k)\), and each criterion selects a subset of band labels \(n\). The returned
tensor packs the matching eigenvectors \(v_n(k)\) into an
IndexSpace, padding sectors with
fewer matches by zero columns.
Supported criteria
slice: select bands by sorted energy index, such asslice(0, 2)for the two lowest-energy bands.Tuple[int, ...]: select explicit sorted band indices, such as(0, 2)for the lowest and third-lowest bands.Tuple[float, float]: select an inclusive energy range.Callable[[float], bool]: select energies for which the callable returnsTrue.
If a criterion matches no bands in all momentum sectors, the corresponding
output tensor has an IndexSpace of dimension zero.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tensor
|
Tensor
|
Band-resolved tensor with dimensions
|
required |
kwargs
|
Dict[str, Union[slice, Tuple[int, ...], Tuple[float, float], Callable[[float], bool]]]
|
Named band-selection criteria. |
{}
|
Returns:
| Type | Description |
|---|---|
Dict[str, Tensor]
|
Mapping from criterion name to selected eigenvector tensor with
dimensions |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the tensor axes are not |
ValueError
|
If |
IndexError
|
If an explicit integer band index is outside the available band range. |
Source code in src/qten/bands.py
2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 | |
nearest_bands
nearest_bands(
h_k: Tensor,
point: Union[str, Sequence[float]] = "Gamma",
close_to: float = 0.0,
tol: float = 1e-06,
points: Optional[Dict[str, Sequence[float]]] = None,
) -> Tensor
Project a momentum-resolved Hamiltonian onto bands selected at one k-point.
The input h_k is diagonalized at a single anchor momentum \(k_0\).
Eigenvectors whose anchor eigenvalues lie within tol of close_to are
collected into a rectangular matrix \(V\). If the input Hilbert dimension is
\(N\) and \(S\) bands are selected, then V has shape (N, S) and the
returned tensor stores \(V^\dagger H(k) V\) for every momentum \(k\).
Projection convention
At the selected anchor sector, the code computes
eigenvalues, eigenvectors = torch.linalg.eigh(H_anchor). The columns of
eigenvectors with \(|\epsilon_n(k_0) - \mathrm{close\_to}| \le \mathrm{tol}\)
form \(V\). The projected block at each momentum is
\(H_{\mathrm{proj}}(k) = V^\dagger H(k) V\).
In implementation terms, this projection is the einsum
torch.einsum("ia,kab,bj->kij", V_dag, h_k.data, V).
Anchor selection
- A string
pointis looked up inpoints. "Gamma"defaults to the fractional origin when absent frompoints.- A coordinate sequence is interpreted directly as fractional coordinates.
- Fractional-coordinate differences are wrapped by subtracting the nearest integer, so equivalent periodic coordinates select the same anchor.
If no eigenvalue falls inside the tolerance window, the result has two
zero-dimensional IndexSpace axes
and data shape (len(kspace), 0, 0).
Notes
The selected subspace is fixed by the anchor momentum only. The same anchor eigenvector matrix \(V\) is applied to every \(H(k)\); this is a projection onto an anchor-defined subspace, not a separately diagonalized band selection at each momentum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
h_k
|
Tensor
|
Hamiltonian tensor with dims
( |
required |
point
|
str or Sequence[float]
|
Anchor k-point. String labels are resolved through |
"Gamma"
|
close_to
|
float
|
Target eigenvalue for the subspace selection. |
0.0
|
tol
|
float
|
Half-width of the eigenvalue window around |
1e-6
|
points
|
dict[str, Sequence[float]]
|
Mapping from labels to fractional coordinates. |
None
|
Returns:
| Type | Description |
|---|---|
Tensor
|
Projected Hamiltonian with dims
( |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
TypeError
|
If the input dimensions are not
|
KeyError
|
If |
Source code in src/qten/bands.py
2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 | |
proj_wannierization
proj_wannierization(
eigenvectors: Tensor[Any],
seeds: Tensor[Any],
svd_threshold: float = 0.1,
wannierize_lattice: bool = True,
) -> Tensor[Any]
Perform projective Wannierization from localized real-space trial orbitals.
This helper implements the standard two-stage projective-Wannier workflow:
- Fourier transform localized seed states into momentum space.
- At each momentum sector, rotate the target band subspace into the gauge that best matches those transformed seeds via the polar/SVD factor of the overlap matrix.
The function is therefore a thin orchestration layer around
fourier_transform() and
svd_projection().
Mathematical convention
Let
\(k \in \mathcal{K}\) denote a sampled momentum,
let \(\{|b\rangle\}_{b=1}^{N_b}\) be the Bloch basis stored on the second
axis of eigenvectors, and let
\(\{|r\rangle\}_{r=1}^{N_r}\) be the localized basis stored on the first
axis of seeds.
Suppose the seed tensor stores coefficients \(A_{r n}\), where \(n = 1, \dots, N_s\) labels the trial orbitals. In matrix form, \(A \in \mathbb{C}^{N_r \times N_s}\).
The discrete Fourier-transform tensor returned by
fourier_transform(k_space, bloch_space, local_seed_space)
is a rank-3 object with entries
where the Kronecker-style matching factor indicates that only localized and Bloch basis states with matching non-offset irreps are connected. In the repository's fractional-coordinate convention, this phase is equivalently \(\exp(-2\pi\mathrm{i}\,\kappa \cdot n)\).
For each momentum sector, the real-space seeds are lifted to Bloch form as
with \(S(k) \in \mathbb{C}^{N_b \times N_s}\).
The input eigenvectors stores the target subspace as matrices
whose columns span the band manifold to be Wannierized.
The gauge-fixing step then forms the overlap
computes its singular value decomposition
discards the singular values, and keeps only the polar/unitary factor
The projected Wannier-gauge states are then
This is exactly the orthogonal-Procrustes solution used by
svd_projection(): it preserves the target
column space while choosing the column gauge that best aligns the target
states with the Fourier-transformed trial orbitals.
Step-by-step behavior
Given eigenvectors and seeds, the code performs:
- Read the shared momentum grid
k_space = eigenvectors.dims[0]. - Read the Bloch Hilbert space
bloch_space = eigenvectors.dims[1]. - Read the localized seed row basis
local_seed_space = seeds.dims[0]. - Build the discrete Fourier transform tensor
F = fourier_transform(k_space, bloch_space, local_seed_space). - Convert localized trial orbitals into momentum-resolved trial orbitals
by the tensor contraction
crystal_seeds = F @ seeds. - Call
svd_projection(eigenvectors, crystal_seeds, svd_threshold, infer_lattice=wannierize_lattice). - Return the projected states.
Interpretation of the tensor legs
eigenvectorsmust have dims(MomentumSpace, HilbertSpace, D_target), where the first two axes represent momentum and Bloch basis, and the last axis enumerates the target band columns.seedsmust have dims(HilbertSpace_local, D_seed), where the first axis is a localized real-space basis containingOffsetlabels, and the second axis enumerates trial orbitals.- After Fourier transformation,
crystal_seedshas dims(MomentumSpace, HilbertSpace, D_seed).
Here D_target and D_seed may be different state-space types. The most
common case is that both are
IndexSpace, but the seed-column
space may also be a
HilbertSpace.
Lattice-aware output
The wannierize_lattice flag is forwarded to
svd_projection(), but lattice rebuilding is
only possible when the column space of the transformed seeds still
carries a HilbertSpace
with meaningful Offset labels.
Concretely:
- if
seeds.dims[1]is anIndexSpace, projection still works exactly as described above, but no lattice-backed output basis can be inferred, so the result remains a plain rank-3 tensor; - if
seeds.dims[1]is aHilbertSpace, then after Fourier transformation the source columns retain those symbolic labels, andsvd_projection(..., infer_lattice=True)may return aMomentumBlockTensorwhose final Hilbert leg has been rebuilt on the inferred Wannier lattice.
Numerical behavior
The SVD warning threshold is interpreted exactly as in
svd_projection(): if the minimum singular
value of the overlap becomes smaller than svd_threshold, a warning is
emitted because the trial orbitals may poorly span the target subspace or
may be nearly linearly dependent after projection. Zero-padded columns, if
present in the target or source, are ignored sector by sector by the
underlying projection routine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eigenvectors
|
Tensor
|
Target band states with dims
|
required |
seeds
|
Tensor
|
Localized trial orbitals with dims
|
required |
svd_threshold
|
float
|
Warning threshold passed to
|
0.1
|
wannierize_lattice
|
bool
|
Forwarded as |
True
|
Returns:
| Type | Description |
|---|---|
Tensor
|
Projected Wannier-gauge states. Usually this is a rank-3 tensor with
dims |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
TypeError
|
If |
Source code in src/qten/bands.py
2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 | |
cartesian_scale
cartesian_scale(
tensor: Tensor, scale: Sequence[Expr | int]
) -> Tensor
Rescale the Cartesian geometry of a momentum-resolved tensor in place of selecting or interpolating its information.
For Cartesian scale matrix \(S=\operatorname{diag}(s_1,\ldots,s_d)\), a direct-lattice basis \(A\) becomes \(SA\). Its reciprocal basis therefore becomes \(S^{-T}G\). Fractional real-space and momentum coordinates, periodic boundaries, unit-cell sites, tensor data, and every axis size are preserved.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tensor
|
Tensor
|
Momentum-resolved tensor whose first axis is a
|
required |
scale
|
Sequence[Expr | int]
|
Nonzero Cartesian scale factor for each spatial direction. Entries must be Python integers or symbolic SymPy expressions. |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
A tensor sharing the original data with geometrically rescaled
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If a scale entry is zero or its length differs from the spatial dimension. |
TypeError
|
If the first tensor dimension is not a |
Source code in src/qten/bands.py
2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 | |