Creating a new global array: Declaration?

Hi Axel,

There are two sets of species in my simulation, A and B, each having some atoms. When the forces are being calculated, I wanted to know the forces between specie A-A interaction and specie A-B interaction on every individual atom. This is why I wanted to create two arrays which could store the values of A-A and A-B interactions for each atom. Using that information, I wanted to write another cpp file which would do velocity scaling on the particular atoms which satisfy a condition (based on the force interaction between the two different species) using those arrays

To answer your first question, I need to find the force between each pair of atom, writing down force interactions between one specie type in an array and different specie type in another array. Is that possible? If not, would really appreciate if you can suggest any other suitable way around it.

To answer your last comment, I do not wish to modify the force. I just need the value of the each independent interaction between the two species, A and B for every single atom everytime the force loop is run.

At the end of each force loop run/iteration, I would like to impose the velocity scaling criteria.

Thank you for your time. Look forward to your guidance,

Hi Axel,

There are two sets of species in my simulation, A and B, each having some
atoms. When the forces are being calculated, I wanted to know the *forces
between specie A-A interaction* and *specie A-B interaction* on *every
individual atom*. This is why I wanted to create two arrays which could
store the values of A-A and A-B interactions for each atom. Using that
information, I *wanted to write another cpp file which would do velocity
scaling* on the particular *atoms which satisfy a condition *(based on
the force interaction between the two different species)* using those
arrays*

To answer your first question, I need to *find the force between each
pair of atom*, writing down force interactions *between one specie type
in an array* and *different specie type in another array*. Is that
possible? If not, would really appreciate if you can suggest any other
suitable way around it.

​i can see three ways to do this in a reasonably clean fashion similar to
other styles in LAMMPS.:

1) you can use fix property/atom to add additional per atom data to each
atom. then use a modified pair style that grabs a handle of the two arrays
and tallies the data. same for a fix that would then read the data and
compute the rescaling

2) you add pointers to the customized pair style for the pair atom storage
and make them available to the fix via Pair::extract()

3) you write a compute similar to the computes in the USER-TALLY package
and make it export a per-atom array which can be passed to your fix.

​option 2) is probably closest to what you initially planned to do, but i
personally believe that option 3) is cleaner (but then again, i am biased
in this regard).

axel.​

I suppose you could also use pair hybrid, and use one sub-style

to define the A/A and B/B interactions, and the other sub-style

to define the A/B interactions.

They you could muck with the code in pair_hybrid.cpp to

store the force on each atom after each sub-style is

invoked, before LAMMPS combines them into one total

force vector.

But I think Axel’s suggestion of writing your own new

USER-TALLY method is better. You don’t have to change

any existing code in LAMMPS to do that.

Steve