[lammps-users] fix addforce issues


I am using the latest version of LAMMPS (11-May10) and am having troubles with the fix addforce command.

My syntax is as follows:

fix A_field A addforce 0.0 0.0 0.3

This is essentially the same as the example syntax provided for the “fix addforce” command so I think I may be encountering a bug.

The error message I am receiving is:

ERROR: Cannot use variable energy with constant force in fix addforce

(I could not find any information on this in the LAMMPS errors section.)

Please let me know where I am going wrong or if more information is required for help on this issue.

Thanks as always,



this is a bit of a wild guess, but try changing in line 75 of fix_addforce.cpp
the line




recompile and run again.

if i read the code right, this should cure your problem.


That did the trick. Thanks.


yes - this was a bug - posted a patch - thanks