We report an extension of the smoothed profile method (SPM)[Y. Nakayama, K. Kim, and R. Yamamoto, Eur. Phys. J. E {bf 26}, 361(2008)], a direct numerical simulation method for calculating the complex modulus of the dispersion of particles, in which we introduce a temporally oscillatory external force into the system. The validity of the method was examined by evaluating the storage $G(omega)$ and loss $G(omega)$ moduli of a system composed of identical spherical particles dispersed in an incompressible Newtonian host fluid at volume fractions of $Phi=0$, 0.41, and 0.51. The moduli were evaluated at several frequencies of shear flow; the shear flow used here has a zigzag profile, as is consistent with the usual periodic boundary conditions.