I have a problem understanding how to deal with the chemical potential when two thermodynamic systems are in contact. For simplicity, let us consider $T=0\ K$. We have a system that is composed of two parts - I and II - where I occupies a space of fixed volume and II occupies the remaining space (essentially going to infinity in all directions). Both parts are initially filled with a crystal that is made up of a finite number of atomic types $i$. This is an equilibrium configuration (1). Now, I apply a long-range displacement field that originates in part I. If the boundary between parts I and II is permeable for the matter, some atoms move across this boundary. Here, part II can be thought of as a reservoir for the matter. The system eventually settles into another equilibrium (2), where the number of atoms $n_i$ in the part I is different from the above, i.e. there is nonzero
$$\Delta n_i=n_i^{(2)}-n_i^{(1)}\ .$$
The free energy difference between the two equilibrium states of part I is then
$$\Delta F \equiv F^{(2)}-F^{(1)} = V\sum_{ij}\sigma_{ij}\Delta\epsilon_{ij}+\sum_i\mu_i\Delta n_i\ .$$
In each of the two configurations (1) and (2), the parts I and II are in contact equilibrium, which means that $\mu_i^{I(1)}=\mu_i^{II(1)}$ and $\mu_i^{I(2)}=\mu_i^{II(2)}$, where the number in the bracket refers to the configuration. So, we have two chemical potentials for each $i$, one corresponding to configuration (1) and the other (generally different) for the configuration (2). Moreover, the particles move into I from the immediate neighborhood of the boundary I-II, which implies that $\mu_i$ should correspond to the atoms in the part II that are close to this boundary. However, how am I to understand a single $\mu_i$ in the equation above?