Extended Hubbard model in the presence of a magnetic field