  Narrow carbon nanotubes (CNTs) desalinate water, mimicking water channels of
biological membranes, yet the physics behind selectivity, especially, the
effect of the membrane embedding CNTs on water and ion transfer, is still
unclear. Here, we report $ab$ $initio$ analysis of the energies involved in
transfer of water and K$^+$ and Cl$^-$ ions from solution to empty and
water-filled 0.68 nm CNTs, for different dielectric constants $\epsilon$ of the
surrounding matrix. The transfer energies computed for $1 \leq \epsilon <
\infty$ permit a transparent breakdown of the transfer energy to three main
contributions: binding to CNT, intra-CNT hydration, and dielectric polarization
of the matrix. The latter scales inversely with $\epsilon$ and is of the order
$10^2$/$\epsilon$ kJ/mol for both ions, which may change ion transfer from
favorable to unfavorable, depending on ion, $\epsilon$, and CNT diameter. This
may have broad implications for designing and tuning selectivity of
nanochannel-based devices.
