Simulation of electrons in solids