Numerical simulation of charged particles