I am trying to compute the number of particles in one group (section_0) that have at least one particle from another group (trace_fluid) within a cutoff distance:
compute particle_neighbours_0 section_0 coord/atom cutoff ${neighbour_cutoff} group trace_fluid
variable particle_neighbours_0_max atom (c_particle_neighbours_0>=1)
compute particle_count_0 section_0 reduce sum v_particle_neighbours_0_max
This gives the following error:
ERROR: Variable particle_neighbours_0_max: Compute used in variable between runs is not current (src/variable.cpp:1556)
I have read some of the other posts regarding this error, and tried to use thermo_style to update the compute before the variable is defined, but the error persists. Perhaps I am misunderstanding. Any help would be appreciated.
Note: I don’t get this error in 2Aug2023 version. However, when running on my university supercomputer (29Sep2021 version) with MPI the error occurs.
Hi @jayden_gould,
This is because the compute is an atom style compute that produces a per-atom vector. You can’t just add it to your thermo output which expects scalar values.
The compute values need to be invoked in order to be computed and accessed by variables or fixes. I suggest you read the compute and how-to output doc pages in order to better understand when and how to use compute commands.
Your code is a bit hard to read by the way. Please use triple backtick ``` before and after it. See the guidelines post. Without more elements on the rest of your script, it is a bit hard to know if things go wrong elsewhere. A common way of going around compute that are not current is to put some run 0
commands to force the invocation of the compute using intermediate fixes or variables.
Some major changes have been taking place between those two version. 18 month is quite long in LAMMPS development time, so bugs and changes might change the behavior here. You can probably compile newer versions of lammps as a user on your HPC cluster. There should be a helpdesk to help you do that and tell you how to load the proper compilation environment.