Number of atoms with E > xx eV vs time ?

Dear LAMMPS user,

During a collision cascade in Fe crystal, I would like to record in a file the number of atoms with a kinetic energy higher than a certain value as a function of time.

For this, I use a the following, which I found in http://lammps.sandia.gov/doc/group.html

compute 1 all ke/atom
compute 2 all reduce sum c_1
thermo_style custom step temp ke c_2
run 0

Here follows atoms with ke > 100 eV)

variable eatom atom “c_1 > 100.0”
group hienergy variable eatom

variable nbatoms equal count(hienergy)

thermo_style custom step temp ke c_2 v_nbatoms
run 2000

However, when I check the value of nbatoms with v_nbatoms in thermo_style command, it is always 0 during the run, when it should be much higher with an initial atom with a kinetic energy of 20 keV.

I also tried creating a dynamic group
group hienergygroup dynamic hienergy var eatom every 1

and count the number of atoms in the group hienergygroup, but same result.

Could anyone give me a hand please ?

Many thanks in advance and best regards,
Christophe

Dear LAMMPS user,

During a collision cascade in Fe crystal, I would like to record in a file
the number of atoms with a kinetic energy higher than a certain value as a
function of time.

For this, I use a the following, which I found in
http://lammps.sandia.gov/doc/group.html

compute 1 all ke/atom
compute 2 all reduce sum c_1
thermo_style custom step temp ke c_2
run 0

# Here follows atoms with ke > 100 eV)
variable eatom atom "c_1 > 100.0"
group hienergy variable eatom

variable nbatoms equal count(hienergy)

thermo_style custom step temp ke c_2 v_nbatoms
run 2000

However, when I check the value of nbatoms with v_nbatoms in thermo_style
command, it is always 0 during the run, when it should be much higher with
an initial atom with a kinetic energy of 20 keV.

I also tried creating a dynamic group
group hienergygroup dynamic hienergy var eatom every 1

and count the number of atoms in the group hienergygroup, but same result.

Could anyone give me a hand please ?

have you tried this? this is what i would have tried first:

variable eatom atom "c_1 > 100.0"
compute heatoms all reduce sum v_eatom

also, have you dumped the energy per atom in a dump file and checked,
if there actually are atoms with a kinetic energy > 100?

axel.

Dear LAMMPS user,

During a collision cascade in Fe crystal, I would like to record in a file
the number of atoms with a kinetic energy higher than a certain value as a
function of time.

For this, I use a the following, which I found in
http://lammps.sandia.gov/doc/group.html

compute 1 all ke/atom
compute 2 all reduce sum c_1
thermo_style custom step temp ke c_2
run 0

Here follows atoms with ke > 100 eV)

variable eatom atom “c_1 > 100.0”
group hienergy variable eatom

variable nbatoms equal count(hienergy)

thermo_style custom step temp ke c_2 v_nbatoms
run 2000

However, when I check the value of nbatoms with v_nbatoms in thermo_style
command, it is always 0 during the run, when it should be much higher with
an initial atom with a kinetic energy of 20 keV.

I also tried creating a dynamic group
group hienergygroup dynamic hienergy var eatom every 1

and count the number of atoms in the group hienergygroup, but same result.

Could anyone give me a hand please ?

have you tried this? this is what i would have tried first:

variable eatom atom “c_1 > 100.0”
compute heatoms all reduce sum v_eatom

Yes, it works ! Thanks ! Indeed, this line was missing. I wrongly assumed that the command variable would return the sum.

Christophe

Hi all,

I also tried creating a dynamic group
group hienergygroup dynamic hienergy var eatom every 1

and count the number of atoms in the group hienergygroup, but same result.

Could anyone give me a hand please ?

have you tried this? this is what i would have tried first:

variable eatom atom “c_1 > 100.0”
compute heatoms all reduce sum v_eatom

Yes, it works ! Thanks ! Indeed, this line was missing. I wrongly assumed that the command variable would return the sum.

Now it works, I am trying to use this number to determine the number of atoms that have a Ek > 10 eV, close to boundaries. If this number is not null, then I would like the simulation stops.

To do so I wrote the following:

compute 1 atoms_boundary ke/atom
compute 2 atoms_boundary reduce sum c_1
thermo_style custom step temp ke c_2
run 0

variable eatom atom “c_1 > 10.0”
compute heatoms atoms_boundary reduce sum v_eatom
variable nbaim equal c_heatoms

if “${nbaim} > 0” then quit

run 2500

At this stage, LAMMPS complains:

ERROR: Compute used in variable between runs is not current (…/variable.cpp:1287)

Is my approach correct ? Or should I use a loop and check every N steps for the value of nbaim ?

Christophe

Hi all,

> I also tried creating a dynamic group
> group hienergygroup dynamic hienergy var eatom every 1
>
> and count the number of atoms in the group hienergygroup, but same
> result.
>
> Could anyone give me a hand please ?

have you tried this? this is what i would have tried first:

variable eatom atom "c_1 > 100.0"
compute heatoms all reduce sum v_eatom

Yes, it works ! Thanks ! Indeed, this line was missing. I wrongly assumed
that the command variable would return the sum.

Now it works, I am trying to use this number to determine the number of
atoms that have a Ek > 10 eV, close to boundaries. If this number is not
null, then I would like the simulation stops.

To do so I wrote the following:
compute 1 atoms_boundary ke/atom
compute 2 atoms_boundary reduce sum c_1
thermo_style custom step temp ke c_2
run 0

variable eatom atom "c_1 > 10.0"
compute heatoms atoms_boundary reduce sum v_eatom
variable nbaim equal c_heatoms

if "${nbaim} > 0" then quit

run 2500

At this stage, LAMMPS complains:
ERROR: Compute used in variable between runs is not current
(../variable.cpp:1287)

Is my approach correct ? Or should I use a loop and check every N steps for
the value of nbaim ?

this cannot work. all commands in LAMMPS are acted upon immediately.
so the if statement is useless.
yes, you could break the run down into small chunks with "every" or do
a loop, but there is actually a command just made for your specific
need:

http://lammps.sandia.gov/doc/fix_halt.html

axel.

I did not know that command. Thanks a lot Axel !

Christophe

Is my approach correct ? Or should I use a loop and check every N steps for
the value of nbaim ?

this cannot work. all commands in LAMMPS are acted upon immediately.
so the if statement is useless.
yes, you could break the run down into small chunks with “every” or do
a loop, but there is actually a command just made for your specific
need:

http://lammps.sandia.gov/doc/fix_halt.html

axel.

I tried it but it does not work. This is what I did:

compute 1 thermal_atoms_in ke/atom
compute 2 thermal_atoms_in reduce sum c_1
thermo_style custom step temp ke c_2
run 0

variable eatom atom “c_1 > 10.0”
compute heatoms thermal_atoms_in reduce sum v_eatom
variable nbaim equal c_heatoms

fix 10 atoms_boundary halt 1 nbaim > 0

run 2500

LAMMPS complains with the following msg:

ERROR: Unknown fix style (…/modify.cpp:815)

I think I used the right syntax. I am using version 30 July 2016.

Christophe

In my previous mail read “atoms_boundary” in the first compute commands instead of “thermal_atoms_in”. It was correct in the input.

Too old.

Too old.

You are right. With version from 17Nov16 it works. Thanks again.

Christophe