Updates the spin hamiltonian and recalculates its eigenbasis

def update_H(self, mean_field, l):
        """Updates the spin hamiltonian and recalculates its eigenbasis"""

        self.H_s = self.spin_hamiltonian(mean_field, l)
        try:
            self.eig_energies, self.eig_states = diagonalize(self.H_s)
        except np.linalg.linalg.LinAlgError:
            np.savez('errorhamil', H=self.H_s, fiel=mean_field, lamb=l)
            raise
        except ValueError:
            np.savez('errorhamil', H=self.H_s, fiel=mean_field, lamb=l)
            print(mean_field, l)
            raise