A possible solution to the unexplained high intensity hard x-ray (HXR) emission observable during solar flares was investigated via 3D fully relativistic, electromagnetic particle-in-cell (PIC) simulations with realistic ion to electron mass ratio. A beam of accelerated electrons was injected into a magnetised, Maxwellian, homogeneous and inhomogeneous background plasma. The electron distribution function was unstable to the beam-plasma instability and was shown to generate Langmuir waves, while relaxing to plateau formation. In order to estimate the role of the background density gradient on an unbound (infinite spatial extent) beam, three different scenarios were investigated: a) a uniform density background; b) a weak density gradient, n_R/n_L=3; c) a strong gradient case, n_R/n_L=10, where n_R and n_L denote background electron densities on the left and right edges of the simulation box respectively. The strong gradient case produced the largest fraction of electrons beyond 15 v_th. Further, two cases (uniform and strong gradient background) with spatially localized beam injections were performed aiming to show drifts of the generated Langmuir wave wavenumbers, as suggested in previous studies. For the strong gradient case, the Langmuir wave power is shown to drift to smaller wavenumbers, as found in previous quasi-linear simulations.