Simulating the beam propagation in the reaction chamber is of great interest for heavy ion inertial fusion. Although results have already been obtained at Berkeley and Livermore, CA, using two-dimensional RZ electromagnetic particle-in-cell (PIC) codes, developing a three-dimensional code allows the study of all parameters and geometries. Developing such a code on existing supercomputers required special care for the numerical techniques used. We present here the description of the three-dimensional electromagnetic PIC code that we developed at Orsay, including new numerical features: new outgoing-wave boundary algorithm; modified set of Maxwell equations; propagation of the discrepancy to the Poisson equation; dynamic grid following the beam; calculation of the initial values of the electromagnetic fields without a priori boundary values.