How to keep number of molecules constant for representing a reservoir behavior

Dear All,

I have a 3D system of water molecules in solid nano-confinement. Solid domains consist of two rooms, separated with a porous graphene. Lower room is full of water molecules and the upper room is initially empty, but water molecules diffuse to empty upper room with time through the hole in graphene membrane.

My question is that ‘’ Is there any way to keep the number of water molecules constant in lower room, like it is connected to reservoir? ‘’ In other words, I would like to add new water molecules to the lower room, for each molecule traveled to the empty room.

Thank you for your answers in advance

Sincerely,

Alper

You can use fix gcmc to occasionally insert a molecule into one
“room” based on statistical mechanics rules (like density
and probability of open space for an insertion).

Or you could use a run every command, and pause your
simulation every N steps (N should be big) and write
some Python code (effectively external to LAMMPS)
to check whatever you want and decide to insert one
or molecules into a “room”.

Steve

Dear Steve and Shafat,

Thank you for your kind responses. I ll spend some time on your suggestions to tackle my problem.

Best regards

Alper