Calculations with global vectors

Hi all,

I was wondering whether LAMMPS supports calculations with “global vectors” like what you get from the compute “atom/molecule” or “com/molecule”?
I would be particularly interested in “on the fly” computing forces per molecules as well as com/molecule, and evaluating the inner product of the resulting vectors and then autocorrelate the results (in order to implement a Green-Kubo formalism applied to molecular instead of per atom quantities). The critical part of my implementation would look like this:


compute 1 all property/atom fx
compute 2 all atom/molecule c_1

compute 3 all com/molecule

variable a equal sum(c_2 * c_3[2]) # multiply the x-force on each molecule i with the respective y-coordinates of molecule i and sum over all molecules

compute AC all ave/correlate 1 3000 8000 v_a type auto ave running file autocorr.log

I know that, according to the man pages, I can’t use formulas as an argument of sum(), but since I also can’t temporarily assign the global vectors to variables (at least according to the variable descriptions) I don’t know how to implement this simple calculation. It would be of great help to do these calculations during the LAMMPS runs since if I would dump all the values to a file, it would become very large and hard to handle in post processing (several hundred GB for longer runs and with all the necessary coordinates).
So, my question to you is: Did I overlook something in the manual or is it not possible to calculate the inner product of two global vectors in LAMMPS?

Best regards,
Thomas

I don’t think there is currently a way to do this in LAMMPS.
I agree it would be a nice feature to have.
There probably needs to be a couple of new kinds
of variables, like “global” and “local” for vectors.

I’ll add it to the to-do list, but it is non-trivial b/c
it will complicate the logic for evaluating the equal-
and atom-style (and now global- and local-style )variables,
if there a variety of variable types to account for.
I’m not even sure it’s possible to re-use the existing
equation tree structure for that, since it changes
the data-structures from single value (global or per-atom)
to a vector of values each proc has to store.

This syntax is particularly challenging:
variable a equal sum(c_2 * c_3[2])
since it mixes two types of variables in one equation,
which means the parser needs to become MatLab like.

Steve