The adsorption structure of the molecular switch azobenzene on Ag(111) is investigated by a combination of normal incidence x-ray standing waves and dispersion-corrected density functional theory. The inclusion of nonlocal collective substrate response (screening) in the dispersion correction improves the description of dense monolayers of azobenzene, which exhibit a substantial torsion of the molecule. Nevertheless, for a quantitative agreement with experiment explicit consideration of the effect of vibrational mode anharmonicity on the adsorption geometry is crucial.