# Chemical potential and relative chemical potential in grand canonical monte carlo

In the SemiGrandCanonicalEnsemble module, the documentation discusses about how the relative chemical potential is used to calculate potential difference and acceptance condition. However the input parameters of SemiGrandCanonicalEnsemble use chemical potential and judging by the code, this chemical potential is used the same way as relative chemical potential. So it is actually the relative chemical potential that is used during GCMC not chemical potential?

The relative chemical potential is used. With two species A and B, you will get the exact same results if you use, for example
chemical_potentials = {'A': 0.5, 'B': 1.5}
as if you use
chemical_potentials = {'A': 10.5, 'B': 11.5}.

The acceptance criterion in the SGC ensemble is evaluated here.

@magnusrahm Thanks for the reply. However, I am still confused. I am running SGCMC to calculate the phase diagram of LiNiO2 as a function of temperature and Li concentration. I used a species X to represent Li vacancies and set chemical_potentials like this:
chemical_potentials = {'X': 0, 'Li': dmu}
Based on your answer, it seems the exact values of chemical_potentials don’t make. But later on, I will do free energy integration, which involves Li chemical potentials, and the free energy will change with different Li chemical potentials. So, how should I determine the input values for chemical_potentials?

I see, if the other species is vacancies and you put its chemical potential to zero, you could think of the provided chemical potential of Li as an absolute chemical potential. Note that the value of this chemical potentials is shifted by a constant if you have removed a slope from the energy as a function of Li concentration before fitting your cluster expansion (which one often does in order to have E=0 at c=0 and c=1, i.e., mixing energies).

I used the total energy calculated from DFT of each structure to fit my cluster expansion.
chemical_potentials = {'X': 0, 'Li': -2}
and
chemical_potentials = {'X': -3, 'Li': -5}
X represents the Li vacancies. Indeed, I got the same results. Now, I want to calculate the grand canonical energy = E - mu_Li x. E is the potential (total energy) and x is the Li concentration. Both of them are calculated by SGCMC. So, what value should I use for mu_Li to calculate the grand canonical energy? Different mu_Li are clearly giving me different results. Should I calculate mu_Li by mu_Li=dE/dx?