fix lineforce | constrain centre of mass of group of atoms

Dear LAMMPS users and developers,

I would like to confine the centre of mass (com) motion of a group of
atoms to a specified direction. The fix "lineforce" seems to do
something similar, but removes all force contributions perpendicular to
the linear direction. What I have in mind is a modification which just
constrains the centre of mass motion of the entire group, so that
individual atoms can move in perpendicular directions.

Is this functionality currently implemented in LAMMPS?

Best wishes,

Peter

It is not exactly clear to me what you mean. Do you want the centre-of-mass to only have a velocity component along a specific direction (say u) and not the others? I.e., at each time step you want subtracted from all particles the centre-of-mass velocity perpendicular to u?

I think this can be done with fix setforce and some suitable variables, but there might be a better way.

Dear Stefan,

Thank you for your quick reply.

Yes, that's basically what I want to achieve. It's really
straightforward and boils down to applying a constant constraining force
to each individual atom in the group. Probably you are right and fix
setforce is the way to go. Thanks for your suggestion, I thought I had
to do some coding for that.

Best wishes,

Peter

Yes, if the direction is constant, then it is fairly straightforward to use Gram-Schmid to get the force component along this direction, and then a fix setforce should take care of the rest. I am not sure how big the overhead would be. If it is too much, I think it will be almost trivial to add such a feature directly to fix lineforce.

Dear Stefan,

Yes, that's basically it. I think it would be a simple and useful
extension to fix lineforce. I'll look into it.

Best wishes,

Peter