# Displace atoms + change box vs fix deform + remap

Dear LAMMPS users, I have a question regarding the "fix_deform" command. I am not sure to understand the "remap x" option... which is the algorithm used to remap the atomic coordinates (along z, suppose)?

To be clear, in my situation I want to progressively reduce the size of the external region of a box filled with atoms, interacting via LJ potential. This region slowly loses atoms because they are attracted towards the inner part of the system by a mechanism I have activated, and I want to maintain the density of the outer part of the system constant. Therefore, I would like to compress this region as long as the run proceeds; I would like to decrease the edge of the box and to softly move the atoms towards the inner regions. I want to displace each atoms in a "linear" fashion (the displacement is maximum if the atom is near the edge of the box and it is zero if the atom is on the inner limit of this outer region). Hope it's clear...

Now, should not be exactly the same to use either of these next techniques, in order to reach my goal?

1) Use the "fix_deform" command, with the "delta" style and with the "remap x" option, on the selected group of atoms (with the appropriate quantity as "dlo" and "dhi" for "delta").
2) Use the "change_box" command with the "delta" style (and the same quantity as above for "dlo" and "dhi") + use the "displace atoms" command with a displacement that is linearly dependent from the position of each atom inside the region.

I have run 2 simulations, with identical starting conditions, and I am obtaining two slightly different outcomes...
Am I missing anything?

Thank you,

Francesco Mambretti

Doing (1) vs (2) has the difference that (1) operates

continuously as a simulation runs, while (2)

operates instantaneously (before you start a run).

Why shoulnd’t they give “slightly different” answers?

Steve

Sorry, I forgot to underline that I am breaking my run (of 500 000 steps) in 500 000 runs made by a single step via the “run every” instruction. I am therefore invoking (1) and (2) at each step.
Should the give me anyway a difference? Thanks again,

Francesco

From the fix deform doc page:

This fix can perform deformation over multiple runs, using the start and stop keywords of the run command. See the run command for details of how to do this.

Steve

Ok. I’ll ask the same question in a different way. I have two regions, “ELDAR_right” and “ELDAR_left”, at the z edges of my box. Their union is the “ELDAR region”.
I want to the displace the atoms in these regions proportionally to where they were the step before. So, the innermost atom will suffer a little displacement, while the maximum changes will happen for the outermost ones. I also want the box to change accordingly…
It is the same to act in these two ways?

1. variable DeltaZ equal 0.0
fix ELDAR_fix ELDAR deform 1 z delta (-v_DeltaZ) (v_DeltaZ) remap x units lattice

run 500000 every 1 &
“unfix ELDAR_fix”&
“variable DeltaZ equal …”&
“fix ELDAR_fix ELDAR deform 1 z delta (-v_DeltaZ) (v_DeltaZ) remap x units lattice”

1. variable DeltaZ equal 0.0

run 500000 every 1 &
“variable DeltaZ equal …”&
“change_box all z delta (-v_DeltaZ) (v_DeltaZ) units lattice”&
“variable displR atom …”&
“variable displL atom …”&
“displace_atoms ELDAR_right move 0.0 0.0 v_displR units lattice”
“displace_atoms ELDAR_left move 0.0 0.0 v_displL units lattice”

Where displR and displL are computed as alpha*z(i-th atom), with alpha between 0 and 1, given by the position of the atom inside the region ELDAR_right or ELDAR_left.
In both cases, DeltaZ is computed according to the same algorithm (which I don’t write here for sake of clarity).
Should I obtain the same result, with these two techinques? Am I missing anything.
I know about the start and stop keywords for the run command, but in my case it would be quite a mess (I also have other commands after run every…).
Thanks

Francesco

I don’t know. I suggest you run the 2 options with

no other time integration (so atoms don’t move other

than via the deformation), and dump out the coords

and see if they do what you expect. In other words,

you should be able to debug this yourself.

Steve