atom style/equal style

Dear Axel,

I want to add a force according to something like this formula to EACH ATOM : Fx=vx0.01+x0.04
and I want to use “fix add force” command to do that.
but I get this error " atom vector in equal style variable formula."
Regards

https://lammps.sandia.gov/doc/Errors_messages.html

Hi,

First of all I would recommend reading the variable section of the manual. you can use fix store/state, store the coordinate and use it as an variable. For example:

fix fixID groupID store/state 1 x y z

variable X atom "f_fi1[1]"
variable Y atom "f_fi2[2]"

variable F_x atom "*Formula*"
run 0
unfix fixID

I believe you can use the formula with fix addforce.

Thanks,
Vinit

there is no need to use fix store/state to access per-atom properties
like coordinates or velocities. please see the variable command docs.

axel.

Dear Vinit,
Thanks for your expanded reply, It helps me alot and I got my answer.

P.s. thanks to Dear Axel, as he said there is no need to use fix store/state.
Regards,
Sam