  We present periodic Density Functional Theory calculations of the electronic
properties of molecular junctions formed by amine-, and thiol-terminated alkane
chains attached to two metal (Au, Ag) electrodes. Based on extensive analysis
that includes molecular monolayers of varying densities, we establish a
relationship between the alignment of the molecular energy levels and the
interface dipoles, which shows that the band alignment (BA) in the limit of
long, isolated chains is independent of the link group and can be computed from
a reference system of non interacting molecule + metal electrodes. The main
difference between the amine and thiol linkers is the effective dipole moment
at the contact. This is very large, about 4.5 D, for amine linkers, leading to
a strong dependence of the BA on the monolayer density and a slow convergence
to the isolated molecule limit. Instead, this convergence is fast for S anchors
due to the very small, ~ 0.2 D, effective dipoles at the contacts.
