Numerical modeling of the interaction of nanoparticles with electromagnetic waves