Compute self-diffusion coefficients of confined fluid

Dear lammps-users,

Recently, I am studying the self-diffusion D of methane confined in slit pore. And from the paper Hydrodynamics in Clay Nanopores, I found the method. In short, the method calculating D of bulk methane is no longer appliable to the confined fluid. So Liu et al. proposed a modified Einstein relation to determine the local diffusivities. In the new mathmetic model, a function S was introduced whose value is 1 if the molecule remains continuously in the given layer region during the interval [0:t] and 0 otherwise. I am trying to introducing this function S into lammps and define a variable for it. Initially, I think the variable style atom or vector is the choice, but I find the atom and vector style is for all atoms in system. I want to collect the z values of atoms in a defined region and defined it as a variable. So, anyone can give me some suggestions? We can have a discussion.

Best regard

Dongbo Wang

i don’t think that you can do what you aim to be doing without modifying/writing C++ source code.