Matrix elements of the nucleon-nucleon potential for use in nuclear-structure calculations