How to write flat-bottomed position restraints to prevent water layer from moving in Z direction?

Hi @minqi

I have some experience in this. I tried to help a few other people in writing down restraint, take a look at some other posts, starting from the manual, then on this forum here, and on researchgate.