Parameter calculation along the run as an equal style variable

Hey there,
I am interfacing LAMMPS with another source code (PyRETIS). This requires the 2019 version of LAMMPS and cannot be used with Python commands in the script. To execute my calculations, I need to calculate a progression parameter and in my case the larger one of two interatomic distances as an equal style variable. I calculate it with the following lines:

group CaCl1 id 1 2
group CaCl2 id 1 3
compute 1 CaCl1 pair/local dist
compute 2 CaCl2 pair/local dist
compute 3 CaCl1 reduce min c_1
compute 4 CaCl2 reduce min c_2
variable dist1 equal c_3
variable dist2 equal c_4 
variable op_1 equal "(v_dist1>v_dist2)*v_dist1+(v_dist1<=v_dist2)*v_dist2"

This outputs the right value in most cases, but I create many and in some cases, this returns three values (both distances and one of those twice). I assume it is a problem with the variable op_1 expression, but I am not able to find a non python workaround. If there is a possibility to do that in another way, I would be happy to hear.
Thank you.

The computation of an equal style variable will always return just one value. If there is a problem, it is more likely with how you output it.

1 Like

Thank you very much! The code I am using seems to output all equal style variables in that order. I hope I can replace the first two then.