  We propose a general methodology for calculating the self-diffusion tensor
from molecular dynamics for a liquid with a liquid-gas or liquid-solid
interface. The standard method used in bulk fluids, based on computing the mean
square displacement as a function of time and extracting the asymptotic linear
time dependence from this, is not valid for systems with interfaces or for
confined fluids. The method proposed here is based on imposing virtual boundary
conditions on the molecular system and computing survival probabilities and
specified time correlation functions in different layers of the fluid up to and
including the interfacial layer. By running dual simulations, one based on MD
and the other based on Langevin dynamics, using the same boundary conditions,
one can fit the Langevin survival probability at long times to the MD computed
survival probability, thereby determining the diffusion coefficient as a
function of distance of the layers from the interface. We compute the elements
of the diffusion tensor of water as a function of distance from the liquid
vapor interface of water. Far from the interface the diffusion tensor is found
to be isotropic, as expected, and the diffusion coefficient has the value
$D\approx$ .22\AA$^2$/psec in agreement with what is found in the bulk liquid.
In the interfacial region the diffusion tensor is axially anisotropic, with
values of $D_{\parallel}\approx$. 8\AA$^2$/psec and $D_{\perp}\approx$.
5\AA$^2$/psec for the components parallel and normal the interface surface
respectively. We also show that diffusion in confined geometries can be
calculated by imposing appropriate boundary conditions on the molecular system
and computing time correlation functions of the eigenfunctions of the diffusion
operator corresponding to the same boundary conditions.
