[lammps-users] compute bin/cylinder with a moving COM

Hello lammps users
im trying to calculate a water contact angle of a water droplet on graphene.
for this im using cylinder bins “compute densidad_bins all chunk/atom bin/cylinder z lower 0.25 100.0 100.0 5.499 42.6 60 bound z 3.0 60.0 compress no units box” , where 100.0 100.0 is the initial center of mass of my droplet. But in the running section, I use NVT, later an NVE ensemble and with this, the center of mass of the droplet moves, so I tried to change the “… 100.0 100.0 …” for a c_COM[1] c_COM[2] , wich correspond to the X,Y position of the center of mass of the water group. But lammps send me an error “invalid compute command” because c_COM[1] is not a floating number, but it is. So, how can i do to compute my bins always centered with the center of mass of the water droplet.
Of course then I use a fix command “fix densidad all ave/chunk 100 5 2000 densidad_bins density/mass ave running overwrite file dens_profile.lammpstrj”

Please help

You are confusing how LAMMPS input works. Fact is that c_COM[1] is a string not a number. To have a command recognize such a string as a reference to a compute instance global vector element and retrieve the value from it has to be programmed into the source code. If this is the case it will be mentioned in the documentation, if it is not mentioned, it is not supported.

Since you can compute the center of mass, you have to have a group of the droplet, which also means that you can restrict its motion by applying a fix spring command to that group with the tether option.

Another option would be to use fix recenter to enforce that the center of mass of the droplet will remain at the same position and all other coordinates translated. This could also be done as a post-processing step using a pre-recorded trajectory using the rerun command.