Non-Markovian model for transport and reactions of particles in spiny dendrites