The Hubbard model as an approximation to the entanglement in nanostructures