Effective model Hamiltonian downfolded from first principles