Question about fix setforce 0. 0. 0.

Dear LAMMPS user,

I am trying to freeze atoms that move into a given region. What I am trying to do is to freeze sputtered atoms from a surface in an empty region outside the crystal such that they do not cross boundaries and do not interact with the crystal. To do so, I defined a dynamic group as follows:

region simdom block 0. {ncellx} 0. {ncelly} -5. ${ncellz}

create_box 2 simdom

Create atoms

region crystal block 0. {ncellx} 0. {ncelly} 0. ${ncellz}

create_atoms 1 region crystal

Space between -5 and 0 (in z) is thus empty.

Dynamic group

region sputtering block 0. {ncellx} 0. {ncelly} -4.5 -3.5

group sputtered dynamic all region sputtering every 1

That is, any atom that has been sputtered and that moves to any z between -4.5 and -3.5, will be included in the dynamic group. I checked that it works fine.
In order to freeze them, I tried the following:

fix freeze sputtered setforce 0. 0. 0.

But it does not seem to work, the atoms continue their trajectory and cross the boundary.
I guess that this is because their initial velocity is not zero. Is it correct ?
If so, how can I zero the velocity of each atom of the dynamic group ? How can I freeze the atoms in this particular region ?

Alternatively, I tried to delete the atoms of the dynamic group ‘sputtered’ with fix evaporate:

fix 7 sputtered evaporate 1000 1 emptyspace 49892

But I got the following error msg:
ERROR: Unknown fix style (…/modify.cpp:815)

However, according to the documentation the syntaxis of the fix evaporate is correct.

Many thanks in advance !
Christophe

Dear LAMMPS user,

I am trying to freeze atoms that move into a given region. What I am trying to do is to freeze sputtered atoms from a surface in an empty region outside the crystal such that they do not cross boundaries and do not interact with the crystal. To do so, I defined a dynamic group as follows:

region simdom block 0. {ncellx} 0. {ncelly} -5. ${ncellz}

create_box 2 simdom

Create atoms

region crystal block 0. {ncellx} 0. {ncelly} 0. ${ncellz}

create_atoms 1 region crystal

Space between -5 and 0 (in z) is thus empty.

Dynamic group

region sputtering block 0. {ncellx} 0. {ncelly} -4.5 -3.5

group sputtered dynamic all region sputtering every 1

That is, any atom that has been sputtered and that moves to any z between -4.5 and -3.5, will be included in the dynamic group. I checked that it works fine.
In order to freeze them, I tried the following:

fix freeze sputtered setforce 0. 0. 0.

Force is neutralized but this group of atoms still have some initial velocities, right?

But it does not seem to work, the atoms continue their trajectory and cross the boundary.
I guess that this is because their initial velocity is not zero. Is it correct ?
If so, how can I zero the velocity of each atom of the dynamic group ? How can I freeze the atoms in this particular region ?

Alternatively, I tried to delete the atoms of the dynamic group ‘sputtered’ with fix evaporate:

fix 7 sputtered evaporate 1000 1 emptyspace 49892

But I got the following error msg:
ERROR: Unknown fix style (…/modify.cpp:815)

From the doc page: This fix is part of the MISC package. It is only enabled if LAMMPS was built with that package. See the Making LAMMPS section for more info.

Hope this helps,
Ray

Hi Ray,

Thanks for the reply. See between lines.

Dear LAMMPS user,

I am trying to freeze atoms that move into a given region. What I am trying to do is to freeze sputtered atoms from a surface in an empty region outside the crystal such that they do not cross boundaries and do not interact with the crystal. To do so, I defined a dynamic group as follows:

region simdom block 0. {ncellx} 0. {ncelly} -5. ${ncellz}

create_box 2 simdom

Create atoms

region crystal block 0. {ncellx} 0. {ncelly} 0. ${ncellz}

create_atoms 1 region crystal

Space between -5 and 0 (in z) is thus empty.

Dynamic group

region sputtering block 0. {ncellx} 0. {ncelly} -4.5 -3.5

group sputtered dynamic all region sputtering every 1

That is, any atom that has been sputtered and that moves to any z between -4.5 and -3.5, will be included in the dynamic group. I checked that it works fine.
In order to freeze them, I tried the following:

fix freeze sputtered setforce 0. 0. 0.

Force is neutralized but this group of atoms still have some initial velocities, right?

Yes, that’s what I think. Therefore my question, is there a way to zero their velocities ?

But it does not seem to work, the atoms continue their trajectory and cross the boundary.
I guess that this is because their initial velocity is not zero. Is it correct ?
If so, how can I zero the velocity of each atom of the dynamic group ? How can I freeze the atoms in this particular region ?

Alternatively, I tried to delete the atoms of the dynamic group ‘sputtered’ with fix evaporate:

fix 7 sputtered evaporate 1000 1 emptyspace 49892

But I got the following error msg:
ERROR: Unknown fix style (…/modify.cpp:815)

From the doc page: This fix is part of the MISC package. It is only enabled if LAMMPS was built with that package. See the Making LAMMPS section for more info.

Ahhhh ! I did see it. Thanks. I am recompiling LAMMPS with MISC package.

Christophe

That would be the “velocity” command.

Best regards,
Ray

Dear LAMMPS user,

I am trying to freeze atoms that move into a given region. What I am trying
to do is to freeze sputtered atoms from a surface in an empty region outside
the crystal such that they do not cross boundaries and do not interact with
the crystal. To do so, I defined a dynamic group as follows:

region simdom block 0. \{ncellx\} 0\. {ncelly} -5. ${ncellz}
create_box 2 simdom

# Create atoms
region crystal block 0. \{ncellx\} 0\. {ncelly} 0. ${ncellz}
create_atoms 1 region crystal

# Space between -5 and 0 (in z) is thus empty.

# Dynamic group
region sputtering block 0. \{ncellx\} 0\. {ncelly} -4.5 -3.5
group sputtered dynamic all region sputtering every 1

That is, any atom that has been sputtered and that moves to any z between
-4.5 and -3.5, will be included in the dynamic group. I checked that it
works fine.
In order to freeze them, I tried the following:

fix freeze sputtered setforce 0. 0. 0.

But it does not seem to work, the atoms continue their trajectory and cross
the boundary.
I guess that this is because their initial velocity is not zero. Is it
correct ?
If so, how can I zero the velocity of each atom of the dynamic group ? How
can I freeze the atoms in this particular region ?

i would do things the other way around, and simply define a dynamic
group of atoms that are included in time integration. atoms, that you
don't want to move are not time integrated.
i suspect, simply defining a geometrical region by itself isn't a good
parameter to check, you probably would also include the
velocity/kinetic energy of the atom(s) in quest a secondary condition.

axel.

That would be the “velocity” command.

I already tried that on the dynamic group. But it did not work.
I did the following:

Identification of sputtered atoms

region emptyspace block 0. {ncellx} 0. {ncelly} -4.5 -3.5
group sputtered dynamic all region emptyspace every 1

velocity sputtered set 0. 0. 0. units box

I monitored with a compute the kinetic energy of the atoms in the dynamic group and I could see it is not 0.

Christophe

Dear LAMMPS user,

I am trying to freeze atoms that move into a given region. What I am trying
to do is to freeze sputtered atoms from a surface in an empty region outside
the crystal such that they do not cross boundaries and do not interact with
the crystal. To do so, I defined a dynamic group as follows:

region simdom block 0. {ncellx} 0. {ncelly} -5. ${ncellz}
create_box 2 simdom

Create atoms

region crystal block 0. {ncellx} 0. {ncelly} 0. ${ncellz}
create_atoms 1 region crystal

Space between -5 and 0 (in z) is thus empty.

Dynamic group

region sputtering block 0. {ncellx} 0. {ncelly} -4.5 -3.5
group sputtered dynamic all region sputtering every 1

That is, any atom that has been sputtered and that moves to any z between
-4.5 and -3.5, will be included in the dynamic group. I checked that it
works fine.
In order to freeze them, I tried the following:

fix freeze sputtered setforce 0. 0. 0.

But it does not seem to work, the atoms continue their trajectory and cross
the boundary.
I guess that this is because their initial velocity is not zero. Is it
correct ?
If so, how can I zero the velocity of each atom of the dynamic group ? How
can I freeze the atoms in this particular region ?

i would do things the other way around, and simply define a dynamic
group of atoms that are included in time integration. atoms, that you
don’t want to move are not time integrated.

I see what you mean. I will try. Thanks.

i suspect, simply defining a geometrical region by itself isn’t a good
parameter to check, you probably would also include the
velocity/kinetic energy of the atom(s) in quest a secondary condition.

Ok.

That would be the “velocity” command.

I already tried that on the dynamic group. But it did not work.
I did the following:

# Identification of sputtered atoms
region emptyspace block 0. \{ncellx\} 0\. {ncelly} -4.5 -3.5
group sputtered dynamic all region emptyspace every 1

velocity sputtered set 0. 0. 0. units box

I monitored with a compute the kinetic energy of the atoms in the dynamic
group and I could see it is not 0.

please read the documentation. all LAMMPS commands are executed
*immediately*. so this velocity command is applied exactly when it is
encountered, not later. it is not a fix.

axel.

Hi Axel,

i would do things the other way around, and simply define a dynamic
group of atoms that are included in time integration. atoms, that you
don’t want to move are not time integrated.
i suspect, simply defining a geometrical region by itself isn’t a good
parameter to check, you probably would also include the
velocity/kinetic energy of the atom(s) in quest a secondary condition.

It works.
As you suggested, I defined a dynamic group based on a region that includes the initial location of the projectile and the crystal.
Atoms in this region are time integrated with fix nve. The region that is behind the projectile has no fix nve so atoms are not time integrated.
It works as you can see in the picture. Red balls are the atoms that are frozen in the region behind the projectile. White ball is the initial position of the projectile. The rest is the crystal.
However, in this configuration, I observed that timestep becomes quite small. In 5000 steps it does only 1,68 ps. Without this trick, ie if all atoms are time integrated with fix nve, timestep is much larger and in 5000 steps it achieves about 6 ps.
Any idea why ?

Christophe

surface_sputtering_frozen_atoms.png

Hi Axel,

i would do things the other way around, and simply define a dynamic
group of atoms that are included in time integration. atoms, that you
don't want to move are not time integrated.
i suspect, simply defining a geometrical region by itself isn't a good
parameter to check, you probably would also include the
velocity/kinetic energy of the atom(s) in quest a secondary condition.

It works.
As you suggested, I defined a dynamic group based on a region that includes
the initial location of the projectile and the crystal.
Atoms in this region are time integrated with fix nve. The region that is
behind the projectile has no fix nve so atoms are not time integrated.
It works as you can see in the picture. Red balls are the atoms that are
frozen in the region behind the projectile. White ball is the initial
position of the projectile. The rest is the crystal.
However, in this configuration, I observed that timestep becomes quite
small. In 5000 steps it does only 1,68 ps. Without this trick, ie if all
atoms are time integrated with fix nve, timestep is much larger and in 5000
steps it achieves about 6 ps.
Any idea why ?

you need to dig into the details of what is going, e.g. which atoms
trigger the length of the time step and why.
i assume you are using fix dt/reset. on which group of atoms do you apply it to?

axel.

Hi Axel,

i would do things the other way around, and simply define a dynamic
group of atoms that are included in time integration. atoms, that you
don’t want to move are not time integrated.
i suspect, simply defining a geometrical region by itself isn’t a good
parameter to check, you probably would also include the
velocity/kinetic energy of the atom(s) in quest a secondary condition.

It works.
As you suggested, I defined a dynamic group based on a region that includes
the initial location of the projectile and the crystal.
Atoms in this region are time integrated with fix nve. The region that is
behind the projectile has no fix nve so atoms are not time integrated.
It works as you can see in the picture. Red balls are the atoms that are
frozen in the region behind the projectile. White ball is the initial
position of the projectile. The rest is the crystal.
However, in this configuration, I observed that timestep becomes quite
small. In 5000 steps it does only 1,68 ps. Without this trick, ie if all
atoms are time integrated with fix nve, timestep is much larger and in 5000
steps it achieves about 6 ps.
Any idea why ?

you need to dig into the details of what is going, e.g. which atoms
trigger the length of the time step and why.
i assume you are using fix dt/reset. on which group of atoms do you apply it to?

Good point. I apply it to ‘all’. Means all atoms in the crystal, and those that are sputtered and frozen (not time integrated) in the region behind the projectile. I forgot that this fix can also be applied to a specific group.
Thus, instead of ‘all’ I tried with the group of interest, which is a dynamic group. It is a dynamic group defined at the beginning based on the region that includes the crystal and the projectile. Atoms get removed from this region as they are sputtered. But LAMMPS complains that this fix dt/reset cannot be applied to a dynamic group.

Christophe

[...]

i assume you are using fix dt/reset. on which group of atoms do you apply
it to?

Good point. I apply it to 'all'. Means all atoms in the crystal, and those
that are sputtered and frozen (not time integrated) in the region behind the
projectile. I forgot that this fix can also be applied to a specific group.
Thus, instead of 'all' I tried with the group of interest, which is a
dynamic group. It is a dynamic group defined at the beginning based on the
region that includes the crystal and the projectile. Atoms get removed from
this region as they are sputtered. But LAMMPS complains that this fix
dt/reset cannot be applied to a dynamic group.

this is a catch-all error message. it often simply means, that a fix
has not been reviewed to be safe for use with dynamic groups.
in this case, there is no problem and it can be easily enabled, by
making the following change.

diff --git a/src/fix_dt_reset.cpp b/src/fix_dt_reset.cpp
index 0a8ecd7..48d0915 100644
--- a/src/fix_dt_reset.cpp
+++ b/src/fix_dt_reset.cpp
@@ -48,6 +48,7 @@ FixDtReset::FixDtReset(LAMMPS *lmp, int narg, char **arg) :
   global_freq = 1;
   extscalar = 0;
   extvector = 0;
+ dynamic_group_allow = 1;

   nevery = force->inumeric(FLERR,arg[3]);
   if (nevery <= 0) error->all(FLERR,"Illegal fix dt/reset command");

axel.

this is a catch-all error message. it often simply means, that a fix
has not been reviewed to be safe for use with dynamic groups.
in this case, there is no problem and it can be easily enabled, by
making the following change.

diff --git a/src/fix_dt_reset.cpp b/src/fix_dt_reset.cpp
index 0a8ecd7…48d0915 100644
— a/src/fix_dt_reset.cpp
+++ b/src/fix_dt_reset.cpp
@@ -48,6 +48,7 @@ FixDtReset::FixDtReset(LAMMPS *lmp, int narg, char **arg) :
global_freq = 1;
extscalar = 0;
extvector = 0;

  • dynamic_group_allow = 1;

nevery = force->inumeric(FLERR,arg[3]);
if (nevery <= 0) error->all(FLERR,“Illegal fix dt/reset command”);

I added the line and recompiled…works very well ! Thanks !
Now it reaches ~ 20 ps (vs 1-2 ps before) in the same number of timesteps.

Christophe