Hi,
I'm trying to create something like flexible boundaries which shall represent a large amount of particles at sides. Therefor I want to write a new "fix nve/bound " that is used for the particles at the boundaries. This integration scheme adds a spring force and maybe later also a damping force to the boundary particles.
My problem is to define delta_x which i need for the spring force. If I'm using just the x from the nve file the spring would connect the particles always to the origin (0,0,0). so I need to define (x - x_initial) . But how can I write the initial positions in a variable? I tried already:
initx = atom->x;
I tried it in the init() function and also in the constructor, but the initx is still updated and does not maintain the original position (means x - inital_x is always 0). If some one has an idea how to get the initial position of the integrated particles once without updating them, pls help me.
Many thanks in advance!
Joshua
richti83 | Fri, 05/22/2015 - 21:02
atom->x is a pointer
because atom->x is an array your code snippet only creates a pointer to the array.
What you need is a second array with the size of the current number of particles to store the three coordinates of atom-i.
something like
for (i=0;i less nlocal;i++)
for (j=0;j less 3;j++)
buff[i][j]=atom->x[i][j]
I would use the existing fix store/state (in a first prototype on scriptlevel, later you can define this fix internaly in your own fix)
cheers,
Christian.