Context. The impact of cosmic rays on ice grains delivers considerable energy, inducing chemical reactions and molecule ejection. Aims. We study the effects of cosmic ray impact on ice grains, including shock wave expansion, grain heating, molecule fragmentation, formation of chemical reaction products, sputtering and evaporation. Methods. Molecular-dynamics simulations using the REAX potential allow us to follow the processes occurring in the irradiated ice grain; the mechanical, thermal and chemical consequences are simulated. The ice grain consists of a mixture of water, carbon dioxide, methanol and ammonia. The case of 1 keV/nm energy deposition is studied as an example. Results. The ion track emits a shock wave into the ambient grain. Due to the strong heating, abundant molecule fragmentation is observed; several of the fragments either recombine or form new product molecules. Prompt sputtering from the ion track is followed by evaporation from the surface of the heated grain. We present mass spectra of the chemically transformed species in the grain and in the ejecta.