Numerical simulation of the electron capture process in a magnetar interior