Skip to content

Commit

Permalink
added test with nonorthogonal hamiltonian
Browse files Browse the repository at this point in the history
  • Loading branch information
tfrederiksen committed Jan 27, 2025
1 parent 74134b4 commit 9620902
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/sisl/io/tests/test_ham.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,25 @@ def test_ham_3nn(sisl_tmp, hermitian):
if not hermitian:
H1 = hamiltonianSile(f).read_hamiltonian(hermitian=hermitian)
assert np.allclose((H1 - H)._csr._D, 0)


@pytest.mark.parametrize("hermitian", [True, False])
def test_ham_3nn_no(sisl_tmp, hermitian):
f = sisl_tmp("gr.ham")

g = si.geom.graphene()
H = si.Hamiltonian(g, orthogonal=False)

# build a 3rd nearest neighbor, nonorthogonal model
H.construct(
[[0.1, 1.6, 2.6, 3.1], [(1, 1), (-2.7, 0.073), (-0.09, 0.045), (-0.33, 0.026)]]
)

H.write(f, hermitian=hermitian)

H1 = hamiltonianSile(f).read_hamiltonian()
assert np.allclose((H1 - H)._csr._D, 0)

if not hermitian:
H1 = hamiltonianSile(f).read_hamiltonian(hermitian=hermitian)
assert np.allclose((H1 - H)._csr._D, 0)

0 comments on commit 9620902

Please sign in to comment.