added hh, ss symmetry test

class-solution
Daniel Pozsar 2 months ago
parent fbdd121135
commit 8dc209be9c

@ -219,6 +219,10 @@ def main(simulation_parameters: dict, magnetic_entities: list, pairs: list) -> N
# reformat Hamiltonian and Overlap matrix for manipulations
hh, ss = build_hh_ss(dh)
# copy arrays for tests
if rank == root_node:
hh_test, ss_test = hh.copy(), ss.copy()
# symmetrizing Hamiltonian and Overlap matrix to make them hermitian
for i in range(dh.lattice.sc_off.shape[0]):
j = dh.lattice.sc_index(-dh.lattice.sc_off[i])
@ -227,6 +231,19 @@ def main(simulation_parameters: dict, magnetic_entities: list, pairs: list) -> N
s1, s1d = ss[i], ss[j]
ss[i], ss[j] = (s1 + s1d.T.conj()) / 2, (s1d + s1.T.conj()) / 2
# test symmetrization
if rank == root_node:
diff_hh = abs(hh - hh_test).max()
diff_ss = abs(ss - ss_test).max()
if diff_hh > 1e-12:
warnings.warn(
f"Hamiltonian changed after symmetrization. Largest change is {diff_hh}"
)
if diff_ss > 1e-12:
warnings.warn(
f"Overlap matrix changed after symmetrization. Largest change is {diff_hh}"
)
# identifying TRS and TRB parts of the Hamiltonian
TAUY: np.array = np.kron(np.eye(NO), TAU_Y)
hTR: np.array = np.array(

Loading…
Cancel
Save