How to make atoms move a certain distance?

Dear, all. I want to simulate an atom being released from the interlayer of a nanopore into solution, but it is difficult for the interlayer atoms to move into the solution without external effects.

So I want to apply an external force (or external interaction) to the atom so that it can move to the edge of the nanopore, and I know that fix smd, fix move and some other commands can move atoms, but these commands all require the use of the unfix command to cancel the external effects applied.

I want to know if there is a command that can automatically reset an atom to its original state after being moved a certain distance despite any external influences (i.e. no need to use the unfix command again), as in this case, the fix nvt used simultaneously with moving the atom can continue to run. The LAMMPS used is 2023 version.

Where is the problem with that? You just unfix the fix and then continue the run.
In the case of fix move the motion is fully prescribed and the forces on the moved atom ignored, so you can now exactly where that moved atom will be and thus how many steps you need to run until you need to unfix it (and also change the group for the time integrator fix to include the moved atom).

If you add a force with fix addforce, you can use an atom style variable to define the force and include a condition. E.g.

variable condforce atom (x<10.0)*10.0
fix condadd addatom addforce v_condforce NULL NULL

This will add a force of 10.0 force units to that atom(s) in the addatom group for as long as the x-position is smaller than 10.0 length units.

An alternative would be to just use a constant force

fix add addatom addforce 10.0 NULL NULL

and then use fix halt with a suitable variable to stop the run, then unfix the addforce fix and then resume the run command with the “upto” flag added.

1 Like

Thanks for your prompt reply!

Does the force exerted by this atom on other atoms in the system still exist? If so, may it cause a sudden change in the position of other atoms when the atom moves along the designed trajectory?

Why don’t you look this up in the documentation?

1 Like

Yes. You are independently rediscovering the principles of steered molecular dynamics. :grinning: