In spite of decades of theoretical efforts, the physical origin of the stellar initial mass function (IMF) is still debated. We aim at understanding the influence of various physical processes such as radiative stellar feedback, magnetic field and non-ideal magneto-hydrodynamics on the IMF. We present a series of numerical simulations of collapsing 1000 M$_\odot$ clumps taking into account radiative feedback and magnetic field with spatial resolution down to 1 AU. Both ideal and non-ideal MHD runs are performed and various radiative feedback efficiencies are considered. We also develop analytical models that we confront to the numerical results. The sum of the luminosities produced by the stars in the calculations is computed and it compares well with the bolometric luminosities reported in observations of massive star forming clumps. The temperatures, velocities and densities are also found to be in good agreement with recent observations. The stellar mass spectrum inferred for the simulations is, generally speaking, not strictly universal and in particular varies with magnetic intensity. It is also influenced by the choice of the radiative feedback efficiency. In all simulations, a sharp drop in the stellar distribution is found at about $M_{min} \simeq$ 0.1 M$_\odot$, which is likely a consequence of the adiabatic behaviour induced by dust opacities at high densities. As a consequence, when the combination of magnetic and thermal support is not too large, the mass distribution presents a peak located at 0.3-0.5 M$_\odot$. When magnetic and thermal support are large, the mass distribution is better described by a plateau, i.e. $d N / d \log M \propto M^{-\Gamma}$, $\Gamma \simeq 0$. Abridged
Comment: accepted for publication in A&A