Control of a Bose–Einstein condensate on a chip by external optical and magnetic potentials