PENTrack---a simulation tool for ultracold neutrons, protons, and   electrons in complex electromagnetic fields and geometries
  Modern precision experiments trapping low-energy particles require detailed simulations of particle trajectories and spin precession to determine systematic measurement limitations and apparatus deficiencies. We developed PENTrack, a tool that allows to simulate trajectories of ultracold neutrons and their decay products---protons and electrons---and the precession of their spins in complex geometries and electromagnetic fields. The interaction of ultracold neutrons with matter is implemented with the Fermi-potential formalism and diffuse scattering using Lambert and microroughness models. The results of several benchmark simulations agree with STARucn v1.2, uncovered several flaws in Geant4 v10.2.2, and agree with experimental data. Experiment geometry and electromagnetic fields can be imported from commercial computer-aided-design and finite-element software. All simulation parameters are defined in simple text files allowing quick changes. The simulation code is written in C++ and is freely available at github.com/wschreyer/PENTrack.git. 
Wolfgang Schreyer, Tatsuya Kikawa, Martin J. Losekamm, Stephan Paul,   R\"udiger Picker
physics.ins-det nucl-ex