Electron capture by protons in a neutron beam facility