Machine-learned prediction of the electronic fields in a crystal