# Type of symmetrical boundary condition

Hello Sir,

I want to create a boundary condition for upper plate of Couette flow example. If a particle collides with the upper plate, these conditions are required: 1. The new position of the particle is previous step position i.e., Pos(time+delta_time)=Pos(time).
2. New particle velocity is reversed and same as previous step velocity i.e., Vel(time+delta_time)= -Vel(time).

Thank you

This sounds like fix wall/reflect

Sir, it is different from wall reflect. In wall reflect the position of the particle is changed according to the reflection condition of wall. But i need a condition which did not change the position of the particle. Its like on collision restoring the previous position with reverse velocity.

Thank you

You are discounting the fact that you are doing a simulation with discretized finite time steps. Thus you cannot intercept the particle at exactly the reflection point. Instead, you need to reconstruct the point when the particle did hit the reflection point and then flip the velocity and construct the position that the particle would have reached if it was reflected as computed.

That said, if you just want to have a zone where particles velocities are reversed, you can also look at fix oneway. But fix wall/reflect is the cleaner more rigorous approach to implement what you have described.

Sir, Yes you are right that i am doing a simulation with discretized finite time steps. And i have a question about interception of the particle at exactly the reflection point. I suppose that LAMMPS know it’s one previous discretized time step position of particle. So why i cannot restore that position? It’s like i want to access one step back location of the particle. I do not want to create new position with previous location like you mentioned i can not intercept the particle at exactly the reflection point.

If someone write a simple MD code, it will be very easy to recall the previous point location. I am beginner to LAMMPS, but there may be some way of doing it.

You are right the wall/reflect is a more rigorous way for this but i need more that specific condition. As the wall/reflect is specifically for a wall reflection condition but i am trying to build aa kind of symmetrical condition which assume that we do not have a wall.

Thank you

That is what fix wall/reflect does. and then it applies the motion for the remainder of the timestep. If you want something similar, but not quite the same, you have to make a copy of fix wall/reflect, give it a different name and then modify the source according to your needs.

As mentioned before, if you just want the velocity flipped, regardless of the position, then you can look at fix oneway.

Besides those options, I cannot think of any way to manipulate velocities outside of creating your own custom fix. There is a bunch of information about modifying and extending LAMMPS in the documentation.

Alright Sir, I got it that i need to modify the source code to get what i want to do.

And thank you so much i also learned some other ways of doing some similar practice like fix oneway.

Much appreciated.