Atomic-scale tribometer for friction studies in a controlled atmosphere