A generator coordinate theory of nuclear reactions