PAOFLOW.sparse.doubling#
Cell doubling as pure index arithmetic on the bond list.
Replicates hamiltonian.do_doubling.doubling_HRs exactly, without ever
materializing the dense (2 nawf, 2 nawf, nk1, nk2, nk3, nspin) array.
The dense kernel indexes its cell_index map by the negated folded
lattice coordinate (ix = -round(Rx*nk1), “the minus sign is due to
the Fourier transformation”), so in the true folded coordinates produced
by folded_R_triples() it builds
and the inverse map per bond with folded axis index m is:
meven: contributes the (0,0) and (1,1) blocks atM = m/2(dnmkept — same replica);modd: contributes the (0,1) block atM = (m+1)/2and the (1,0) block atM = (m-1)/2(dnm = 0— the densedoubling_attr_arrydoublesDnmblock-diagonally, zeroing cross-replica pairs).
Each doubling therefore exactly doubles nnz: memory grows linearly in
the number of orbitals, not quadratically as in the dense kernel. The
truncation eig_bound carries over unchanged (doubling only rearranges
and duplicates row content). Thresholding commutes with doubling.
The driver remains responsible for the accompanying metadata updates
(tau/a_vectors in the DataController plus the dense
doubling_attr_arry for scalar attributes); double_axis updates the
container’s own a_vectors copy.
Functions#
|
Return a new bond list for the cell doubled along one axis. |
Module Contents#
- PAOFLOW.sparse.doubling.double_axis(sph, axis)[source]#
Return a new bond list for the cell doubled along one axis.
- Parameters:
sph (SparseHamiltonian) – Bond list of the current cell. Left unmodified; its raw bond arrays must still be present, i.e. it must not have been compacted.
axis (int) – Lattice axis to double, 0, 1 or 2.
- Returns:
Bond list of the doubled cell:
2 * nawforbitals,2 * nnzbonds, the same R grid, anda_vectorswith the doubled axis scaled by two.- Return type:
- Raises:
AssertionError – If a mapped lattice index leaves the folded window of the R grid, which would mean the halved index no longer names a vector of the supercell’s own lattice.
RuntimeError – If
sphhas been compacted and no longer holds the bond arrays.
Notes
Doubling a cell along an axis means describing the same crystal with a unit cell twice as long, holding two copies of the original basis. The orbital index therefore doubles: orbital
iof the first replica keeps indexi, orbitaliof the second getsi + nawf. A hopping that used to reach from cellmto cell0now either stays inside one supercell (connecting the two replicas) or crosses to a neighbouring supercell, depending on whethermis even or odd:even
mconnects like-numbered replicas and lands on supercellm/2, contributing to both diagonal blocks;odd
mconnects the two different replicas and lands on supercells(m ± 1) / 2, contributing to the two off-diagonal blocks.
Python’s floor division implements the even case exactly, negative indices included, and the
±1offsets of the odd case pick out the two supercells a cross-replica hopping reaches. So the whole operation is integer arithmetic on the axis component of each bond plus an offset on its row or column index — no matrix is ever built, and the bond count merely doubles. The dense kernel, by contrast, allocates the full(2 nawf, 2 nawf, ...)array and pays four times the memory per doubling.The intra-cell orbital position differences
dnm, which enter the velocity operator, are kept on the diagonal blocks and zeroed on the off-diagonal ones. This follows the dense convention exactly: the dense driver rebuildsDnmfor the doubled cell as a block-diagonal repeat, which leaves cross-replica pairs at zero.