  The early optical afterglow of GRB 050820a recorded by the RAPTOR telescope
shows both a contribution from the prompt emission and the initial rise of the
afterglow. It is therefore well-suited for the study of the dynamical evolution
of the GRB ejecta when it first undergoes the decelerating effect of the
environment. This is a complex phase where the internal, reverse, and forward
shocks can all be present simultaneously. We have developed a simplified model
that can follow these different shocks in an approximate, but self-consistent
way. It is applied to the case of GRB 050820a to obtain the prompt and
afterglow light curves. We show that the rise of the afterglow during the
course of the prompt emission has some important consequences. The reverse
shock propagates back into the ejecta before internal shocks are completed,
which affects the shape of the gamma-ray profile. We get the best results when
the external medium has a uniform density, but obtaining a simultaneous fit of
the prompt and afterglow emission is not easy. We discuss a few possibilities
that could help to improve this situation.
