The simulation of ultracold neutron experiments using GEANT4