I did a band structure calculation of a thin film structure with different number of atomic layers. I found that the original bulk gap was shifted upward and the Fermi level was shifted downward no matter how many layer I added. I thought this is due to the terminations layer containing some dangling bond, but I’m not sure whether it is the cases. The software I used is VASP. Is there anyway to avoid this?
You have a band gap in this system? If so, the fermi level should be ill defined in VASP. I believe you can use codes such as BoltzTraP to investigate the relevant properties but I believe VASP defines the fermi energy as the top of the valence band. The absolute position of the fermi level must be corrected by looking at the energy of the vacuum in a slab calculation. I believe you can use the LOCPOT file for this. You also mention the bulk gap shifts upwards, keep in mind that these energies can also be defined fairly arbitrarily. Determining the absolute position of the valence and conductance band is a fairly complicated task.
In simple terms, I would be hesitant to look too deeply into the fermi level in a semiconductor in VASP. The changes you are seeing might be due to problems with the absolute energy reference and definition of the fermi level.