Invalid compute ID in variable formula

Dear LAMMPS users,

I am using CNA to determine where are defects after the cascade in bcc Fe.

To do so, I use the following after the cascade has taken place:

compute cnatom all cna/atom 3.45

thermo_style custom step temp
run 0

Determine which defects have a structure different than BCC (3)

variable cna atom “c_cnatom == 5”

group groupcna dynamic all var cna every 1
run 0

variable nbdefects equal count(groupcna)
print “Number of defects = ${nbdefects}”

Since the cna calculation is quite computationally expensive, I remove these compute before I continue other calculations.

uncompute cnatom

other commands…

thermo_style custom step temp
run 1000

And there I get the following error:

ERROR: Invalid compute ID in variable formula (…/variable.cpp:1257)

I understand why this occurs (because of the variable atom that is referenced) but I do not know how to solve it. Any idea?

Many thanks in advance and best regards,

Well, you can’t expect to evaluate a variable

if a compute it uses has been deleted.

There is a variable delete command. Or just

don’t evaluate either the variable or compute.

LAMMPS won’t give an error unless you

request they be evaluated.