Direct mechanical measurement of interatomic potentials