For the simulation of laser-created plasmas, hydrodynamic codes need an atomic physics package, for both the equation of state and the optical properties, which does not use the hypothesis of local thermodynamical equilibrium (LTE). However, in x-ray laser studies, as well as in indirect drive inertial confinement fusion studies, high-Z materials can be found where radiation trapping can induce a significant departure from the optically thin description. A method is presented in which an existing LTE code can be changed into a non-LTE code with radiation-dependent ionization. This method is numerically simple and its cost, in terms of computing time, is low enough to be used in two-dimensional simulations.