To set a constant pressure for a fluid reservoir

Dear Lammps users,
I have a fluid reservoir in my simulation box. During the simulation, the fluid is going to enter/exit the reservoir, so the number of fluid molecules inside the reservoir is likely to undergo changes.

I want the pressure of the fluid inside the reservoir remains constant during the simulation (although the number of fluid molecules inside the reservoir would not be constant). Is there a way to have this in Lammps?
The reservoir dimensions and volume do not need to be constant. In other words, I am looking for something like Berendsen barostat which deforms the simulation box to maintain a constant pressure, but NOT for the whole simulation box and for a specific region inside the simulation box.
Thanks in advance,
Fahim

Dear Lammps users,
I have a fluid reservoir in my simulation box. During the simulation, the
fluid is going to enter/exit the reservoir, so the number of fluid molecules
inside the reservoir is likely to undergo changes.
I want the pressure of the fluid inside the reservoir remains constant
during the simulation (although the number of fluid molecules inside the
reservoir would not be constant). Is there a way to have this in Lammps?

what you are asking for doesn't make too much sense because having a
constant pressure and molecules leaving the system, presumably because
of external force/pressure are conflicting requests.

however, what you describe sounds very much like a piston and such as
entity can be built in multiple ways in LAMMPS.
you can build the piston from explicit particles and move them in
unison from an external force through fix aveforce and then determine
the "external" pressure generated from force by area.
an alternative approach would be to define a moving wall with fix wall
to act as piston and then adjust the wall speed until you see the
desired "external" pressure on your reservoir.

axel.

In fact, we have a nano-channel. The fluid is confined between two solid walls. In order to make sure that the confined fluid has a specific pressure, the channel is connected to two rather large reservoirs (contained with the same fluid) in the left and right sides of the channel. A specific pressure (say 1 bar) is going to be applied to each reservoir.
Now, I want to set a constant pressure to each reservoir. If the number of fluid molecules inside each reservoir was constant, I could just define a group of molecules and apply barostat on the group. But here the fluid transport between the channel and reservoirs does take place. Hence, I wonder if with Lammps we can barostat a region and not a group.
Thanks,

Fahim

In fact, we have a nano-channel. The fluid is confined between two solid
walls. In order to make sure that the confined fluid has a specific
pressure, the channel is connected to two rather large reservoirs (contained
with the same fluid) in the left and right sides of the channel. A specific
pressure (say 1 bar) is going to be applied to each reservoir.
Now, I want to set a constant pressure to each reservoir. If the number of
fluid molecules inside each reservoir was constant, I could just define a
group of molecules and apply barostat on the group. But here the fluid
transport between the channel and reservoirs does take place. Hence, I
wonder if with Lammps we can barostat a region and not a group.

a barostat algorithm adjusts the simulation cell size in a periodic
dimension, thus it doesn't make any sense for the kind of setup you
describe.
a set of pistons is the way to go.

axel.