Commit 54eb6c5b authored by mgassner's avatar mgassner
Browse files

can rune this file alone now

parent aca42a01
......@@ -45,7 +45,37 @@ def github_test(number_spins=10, spin_inversion=-1, use_symmetries=True):
hamiltonian = ls.Operator(basis, [ls.Interaction(matrix, edges)])
# Diagonalize the Hamiltonian using ARPACK
eigenvalues, eigenstates = ls.diagonalize(hamiltonian, k=1)
eigenvalues, _ = ls.diagonalize(hamiltonian, k=1)
print("Ground state energy is {:.10f}".format(eigenvalues[0]))
check = {'4': None, '6': None, '8': None, '10': -18.06178542}
#assert np.isclose(eigenvalues[0], check[str(number_spins)])
\ No newline at end of file
#check = {'4': None, '6': None, '8': None, '10': -18.06178542}
#assert np.isclose(eigenvalues[0], check[str(number_spins)])
if __name__ == "__main__":
print('----------- NUMBER SPINS = 8 -----------')
print('---With symmetries and spin inversion---')
github_test(8)
print('---Without symmetries, but spin inversion---')
github_test(8, use_symmetries=False)
print('---With symmetries, but no spin inversion---')
github_test(8, spin_inversion=None)
print('---Without symmetries and spin inversion---')
github_test(8, spin_inversion=None, use_symmetries=False)
print('----------- NUMBER SPINS = 10 -----------')
print('---With symmetries and spin inversion---')
github_test()
print('---Without symmetries, but spin inversion---')
github_test(use_symmetries=False)
print('---With symmetries, but no spin inversion---')
github_test(spin_inversion=None)
print('---Without symmetries and spin inversion---')
github_test(spin_inversion=None, use_symmetries=False)
print('----------- NUMBER SPINS = 12 -----------')
print('---With symmetries and spin inversion---')
github_test(12)
print('---Without symmetries, but spin inversion---')
github_test(12,use_symmetries=False)
print('---With symmetries, but no spin inversion---')
github_test(12,spin_inversion=None)
print('---Without symmetries and spin inversion---')
github_test(12,spin_inversion=None, use_symmetries=False)
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment