how to use fix spring to fix a layer of atoms moving like a piston surface

Hello everyone,

I have a question on how to simulate a layer of atoms move in a surface. I have an imaginary wall which consists of a layer of argon atoms. And I want to put this layer inside a simulation box to separate two kinds of molecules. Basically, the layer of argon atoms is like a piston surface move in only x direction. I used fix spring/self and fix couple spring to deal with this.
First I use,

fix 1 mem spring/self ${K} yz

to let all the membrane atoms move only in x direction.

Then I use,

fix 2 m spring couple center ${k} 0.0 null null 0.0

I separate the membrane atoms into one center reference atom and all others and then line them up with a center reference atom.
But still the layer seems to move apart. Is there something wrong with my commands?

Thanks all!


Try reversing the order of the fixes in your script.
“Order” does not mean the “1” and “2”, but which

one appears first. You can’t constrain all the atoms

to move together, then add additional forces to

one (or more) of the atoms after that.

You can also look at the fix addforce command which

can enforce a set of atoms to move together.