cna calculation on dynamic group defined by variable atom using cna results?

Dear LAMMPS users,

As I commented in previous posts, I am analysing the defect formation during collision cascades in bcc Fe with the compute cna/atom.

If my simulation box is large, most cna calculations will be done for atoms that have not been displaced, eg those that are at their lattice site, far from the cascade zone. Since the cna calculation is costly, I would like to restrict it only to atoms that have a structure different than bcc (3), ie those that are being displaced.

To do this, I am trying to define a dynamic group that only includes atoms with cna != 3 such that cna calculations will only be performed on this dynamic group, which contains much less atoms. However, this implies some redundant problem that I am not able to solve. Here is what I have done and where I am stuck.

compute cnatom all cna/atom 3.45
compute avecna all reduce ave c_cnatom

thermo_style custom step temp c_avecna
run 0

variable cnatom atom “c_cnatom != 3”
group groupcna dynamic all var cnatom every 1

This way, I am able to define a dynamic group containing particles with cna !=3. However, to do this, I must use a compute all cna/atom. This means that each time the dynamic group is updated, the calculation of cna will be performed for all atoms, which is costly.

The solution to this would be to do compute dynamic_group cna/atom. However, I cannot use compute dynamic_group cna/atom at the beginning since the dynamic group is defined after with variable cnatom atom “c_cnatom != 3”.

Like a dog chasing its tail…

Do you think there is a solution to this?

With best regards,

First, how costly in your CNA computation relative
to whatever else you are doing. How often are you
invoking it?

The main cost of compute CNA is likely computing

a full neighbor list. There is no way in LAMMPS to

only do this for a subset of atoms. What compute CNA

does do, after the neighbor list is built, is only

compute the CNA on the subset of atoms in the group.

You could test how much the relative time of those

2 operations is by using compute cna with group = all,

versus a group with 0 (or 1) atom.

If all the cost is the neighbor list, there’s little you can do,

other than invoke compute cna less often. As it says

on the doc page:

The neighbor list needed to compute this quantity is constructed each time the calculation is performed (e.g. each time a snapshot of atoms is dumped). Thus it can be inefficient to compute/dump this quantity too frequently or to have multiple compute/dump commands, each with a cna/atom style.

Re: a dynamic group. It seems logically impossible

to define the group you want to pass to compute CNA

based on the current CNA value of the atoms. Even if

you could do that, how would it save you any time?

So you’d have to come up with some other criteria

for the dynamic group, e.g. KE or PE of atoms.