A two-mode cylindrical magnetic field is considered, the potential of which has a minimum. The object of this work is the study of the parameters of an electron beam when it moves in a solenoid field with the longitudinal trap formed by the magnetic field, and the construction of the computational model of the motion of an electron beam. The problem is posed of the stability of the motion of electrons in such solenoid magnetic field. The possibility of obtaining oscillatory modes of particle motion has been studied. It was found that for oscillations of particles with an energy of tens of kiloelectronvolts in the potential well in a well, the field with the amplitude of tens of thousands of Oersteds is required. For the solenoid magnetic field of the solenoid, the formation of electron beam with an energy of 55 keV in the longitudinal and radial directions during its transportation is studied. A section of a magnetron gun was used as the physical object. One possible direction is to combine the two matched magnetic systems of the gun to create the potential magnetic field well. It is shown that, for the chosen conditions, the motion of electrons can be associated with the model of three-dimensional oscillations. In this work, on the basis of the Hamiltonian formalism of the motion of electrons in a magnetic field and an algorithm for numerically finding solutions to the differential equations of dynamics, a software tool is constructed that allows one to obtain arrays of values of particle trajectories in the volume. The use of the software made it possible to simulate the main dependences of the motion of the electron beam in a given two-mode solenoid magnetic field. The results of numerical simulation of electron trajectories in the gradient magnetic field with the point secondary emission cathode located in the middle of the system are presented. The formation of the beam with energy of 55 keV in the radial and longitudinal directions during its transportation in a solenoid magnetic field with a large gradient is considered. For significant time intervals, the possibility of three-dimensional oscillations is shown and the operating modes of the magnetic system are obtained, in which the particle undergoes stable three-dimensional oscillations. The influence of the initial conditions during emission on the occurrence of the reciprocating oscillatory effect has been studied. It is shown that for a given electron energy and fixed magnetic field, the parameter that determines the reflection of a particle, is the polar angle of entry relative to the axis of the cylindrical magnetic field. The dependence of the formation of the final distribution of particles on the amplitude and gradient of the magnetic field along the axis of the system is investigated. The results of numerical simulation on the motion of the electron flow are presented. The characteristics of the resulting electron beam are considered on the basis of a model of electron flow motion. The obtained simulation results show that it is possible to establish the phenomenon of oscillatory-return longitudinal motion under experimental conditions.
 Keywords: electron beam, magnetron gun, three-dimensional oscillations, electron dynamics, gradient magnetic field, mathematical modeling.