Multi-wavelength afterglow numerical code and data analysis of MAGIC very high energy emission from gamma-ray bursts