Dear mikebell,
Really thanks for your help~
I have tried to print the arrays, but everything is right. And I think there is no other errors except the "mailbox", because I have another version of this program, which only use the local memory, is right.
I suspect that the mistake happens when I update the value of pos and vel, since the initial values are right, but the integration part is wrong. Does that means I can't change the value of variables in the mailbox once I e_write it into the shared_memory?