How to apply Flat Bottom Position Restrains to 8 peptides

GROMACS version: 2021.5
GROMACS modification: No


I need to simulate the interaction of 8 identical peptides with a lipidic membrane. But I have to make sure they only interact with one monolayer, i.e I have to keep them in the upper half of the simulation box only with respect to the z coordinate, also I don’t want to lock the peptides in a z coordinate I just don’t want the periodic images to cross to the other side. I was told to use flat bottom position restraints to restrain the peptides to some z coordinates. But I can’t find any usage example in the gromacs website, and the information in the forum is insufficient to understand how to use it.

I found the following here in the forums,

[ position_restraints ]
; i funct g r k
1 2 5 0.5 1000

But I don’t quite understand, I believe that g is the type of spatial restriction and ris the reference position, while k is the applied force if the molecule crosses the barrier. But how could r be the reference position if it’s only one number? How can I set a maximum z coordinate to restrict my peptides to? Do I have to do it only for the molecule in the topology just like the regular position restraints or do I have to define the restraints 8 times?

Any help will be really appreciated