Communication between custom Compute class and custom Pair class

Hi,
my name is James and I’ve been working on some additions to LAMMPS for my research for a few months now. However, I seem to be stuck on this current problem. I have created a a custom pair class that calculates some forces, which work great. I also have a custom compute class which I’ve created to calculate all my uncertainty in the forces. My issue is that I have no idea how to send data from the custom pair class to the custom compute class, or vice versa. I stumbled upon a previous thread on here that mentioned the force->match_pair() method, however when I use this I get a error telling me that this method is looking in the parent Pair class and obviously my local variables from my custom class wont exist there (yes I have made my custom pair class variables public, at least the ones I want to communicate). Is there a way to communicate data between a custom pair class and custom compute class other than this method? Or is there just a better way to be doing this in general. Thank you for you time.

Hi,
my name is James and I've been working on some additions to LAMMPS for my
research for a few months now. However, I seem to be stuck on this current
problem. I have created a a custom pair class that calculates some forces,
which work great. I also have a custom compute class which I've created to
calculate all my uncertainty in the forces. My issue is that I have no idea
how to send data from the custom pair class to the custom compute class, or
vice versa. I stumbled upon a previous thread on here that mentioned the
force->match_pair() method, however when I use this I get a error telling me
that this method is looking in the parent Pair class and obviously my local
variables from my custom class wont exist there (yes I have made my custom
pair class variables public, at least the ones I want to communicate). Is
there a way to communicate data between a custom pair class and custom
compute class other than this method? Or is there just a better way to be
doing this in general. Thank you for you time.

you may want to have a look at the computes in the USER-TALLY package.
they allow to intercept any pair style operation that calls ev_tally()
and has direct access for pairwise force and energy, but can be used
for applications beyond. the USER-TALLY package has a very simple
examples that mostly replicate other computes.

otherwise, the canonical way to pass pointers to storage managed by a
pair style to some other entity in LAMMPS is the Pair::extract()
method.
i strongly recommend against treating LAMMPS classes like fortran
common blocks (which is a constant point of contention between me and
our fearless leader, steve p.). but for the sake of completeness: the
"fortran-style" way of doing things would be to do a string compare on
force->pair_style, whether it has the correct pair style and then do a
static cast of Pair *pair to MyCustomPair *mypair and then access the
data.

axel.