Langevin dynamics/Monte Carlo simulations method for calculating nanoscale dielectric functions of materials