Region size

I would like to deposit 3 types of atoms on a substrate.
I want to set the top ( Z axis) region to be the deposit region, with an NVE ensemble, the middle region to be the substrate with an NVT ensemble. During the deposition, the size middle region increase (85% to the growth rate)
Is there a command on lammps to do this?

Your use of the term “ensemble” is incorrect. Ensemble can only refer to the entire simulated system. And yours will be in neither. When describing your system you either want to talk about using the fix nve and fix nvt commands or about time integration without a thermostat (= fix nve) and time integration with a Nose-Hoover thermostat (= fix nvt).

Not really. Technically you could use a dynamic group based on a region with its size determined by a variable, but the latter would be difficult to determine.

But it does not make sense, anyway. You should use a fixed size region in which you apply a thermostat to mimic being in contact with a bulk system, but all deposited atoms should be added without being thermostatted. That is the more physical representation, since the heat transfer would with a real physical system also only happen by the “native” thermal coupling of the atoms between each other.

I used this command variable dz equal ''23.02+step*0.0000048* 0.85"
region r_middle block INF INF INF INF4.97 $(v_dz) units box but the size don’t change
Any help

It cannot change since you are using the $() immediate variable expansion. This will process the included expression already during pre-processing of the input file and thus will substitute the current value of the expression instead of a reference to a variable.

However, removing the $() is not an option since the region box command does not support variables. Please see the documentation of the region command. It states explicitly if variables can be used for parameters. Anywhere where it doesn’t say that explicitly, you cannot use it and will get an error when you run your input.

As I already commented, what you want to do is an unphysical model and thus you should follow the advice that I have already given and only keep a fixed size chunk thermostatted to model the exchange of kinetic energy with the bulk. Everything else should use the intrinsic thermal conductivity of your medium. Adding a thermostat to those deposited atoms adds and exchange that does not exist in the physical model and thus would be bogus.

This method is used in the article (in attachment). I have the variable but I cannot introduce it in the region
1_Gruber&al_2017_lammps_InGaN.pdf (4.9 MB)

If they have done this in the paper, then you should ask the authors of the paper how they did it.
Most certainly, they were not using a variable on a region that does not support variables.