Addforce using the coordination of atom

Dear all:

I have been trying to add a force depending on the x/y/z-coordination of the atoms.Although in many ways,there is

still a problem for me.

The problem is discribed below.

Supposing,there are 24 particles.The force added to the ID 1 is parallel to (x[3]-x[2],y[3]-y[2],z[3]-z[2]).The ID

4 is parallel to (x[6]-x[5],y[6]-y[5],z[6]-z[5])…No force for the ID 3j and 3j-1(j=1…8).

Because,the addforce command can use the per-atom variable.I want to create a per-atom variable stored the force

information.But I don’t find the command to evaluate a vaule to the per-atom array/vector.e.g:like a[2][3] = 2 in

C.So I don’t get the vector v_fx like:

ID fx value
1 2.3
2 0
3 0
4 4.5
5 0
6 0
… …
22 2.1
23 0
24 0

I hope you can give me some hints to realize this function.

Best wishes.

Chen Wang
2014-10-22

I don’t fully understand your Q, but I doubt

there is way to do this with a per-atom variable.

That calculates a quantity for every atom, so I don’t
see how each atom could know and reference its
local coordination neighbors in that way.

I am guessing to do this you need to write a fix.
For example, fix orient/fcc, identifies the neighborhood
of each atom and calculates a force on the atom

that depends on its local neighborhood.

Steve