First code for constructing the Bloch Hamiltonian and solving it