Hello everybody.

I wanted to compute the trace of the dynamical matrix for a Lennard-Jones liquid argon system. Since I need to do this computation every n steps I wanted to implement the formula for only the trace instead of computing all the dynamical matrix and then extract in post processing the trace.

The derivatives of the lennard jonnes potential include some power law of the pair distances.

All the pair distances can be accessed with:

“compute rij all pair/local dist”

But if then I try to write something like:

"variable rijpowerlaw atom c_rij^(-14) -c_rij^(-8) "

"variable trace equal sum(rijpowerlaw) "

I receive “Mismatched compute in variable formula” due to the first line. The same error appears if I use “vector” or “equal” instead of atom.

Indeed I have read in the documentation variable command — LAMMPS documentation that local values can not be used as variable, but I don’t know how else could I write this operation. Is there any way to apply mathematical operation on local values? (Apart from compute reduce, which does not have power law)

Thank you in advance for any suggestion/advice.

Best regards,

Alfredo