Atomistic simulation thin films


I am a new lammps user.
I have a thin film built with a top and bottom vacuum layer.
The system is Polystyrene (Polymer with C, H, O, and S atoms).
I want to create walls on the top and bottom of the thin film so that atoms do not go to the top and bottom vacuum layers.
Please advise on how to do that.



Lammps has many options to restrain the motion of atoms, such as fix_wall_region (which seems to be what you want), or fix_spring_self to add a spring to each atom and force it to stay near its initial position.

I don’t know anything about your system, but it may be a bad sign that such constraint is needed. Did you try to investigate why the film isn’t stable?