Ab initio pair potentials from quantum-mechanical atoms-in-crystals calculations