fix setforce

Hello all,

I want to add a force on each atom in a group. The force equation is like F®=-k0*(z-z0)*H(z-z0). Here, K0 represents force constant(so, it is a constant). z represents the current z coordinate of the atom. z0 is also a constant. H(z-z0) is heaviside step function. When z=z0, H(z-z0)=0.5. When z<z0, H(z-z0)=0. When z > z0, H(z-z0)=1. I would like to use setforce command for this purpose. But I don’t know hot to set a force based on the coordinate of the atom.

Does anybody know how to do it? I appreciate any help.

Thanks in advance!

Hang

Hello all,

I want to add a force on each atom in a group. The force equation is like
F(r)=-k0*(z-z0)*H(z-z0). Here, K0 represents force constant(so, it is a
constant). z represents the current z coordinate of the atom. z0 is also a
constant. H(z-z0) is heaviside step function. When z=z0, H(z-z0)=0.5. When
z<z0, H(z-z0)=0. When z > z0, H(z-z0)=1. I would like to use setforce
command for this purpose. But I don't know hot to set a force based on the
coordinate of the atom.

create an atom style variable "name", compute your force contribution
and then use v_name as the z-coordinate of fix addforce(!)

axel.

Carol posted a similar question/example to the mailing list recently
on this topic:
http://sourceforge.net/mailarchive/message.php?msg_id=29644875
(Click on the follow-up messages (replies) to see the corrected input script.)

(To implement the Heaviside function, I imagine you can implement this
using "if" statements to set the value of your variable.)
Cheers
Andrew