I think I fixed the part of the code where the Hamiltonian is generated by multiplying by the correct values.