fix addforce and variable atom

Dear Lammps users,

I have difficulties in defining an additional force due to a couette flow. Therefor I want to add a force depending on the atom position. I define a per atom variable "b" and I want to refer to it as "v_b" in the fix addforce.

I guess I didn't got the idea how to use per atom variables within fixes like addforce.
I attached a simple input file in which I summarized, what I have already tried.

Maybe someone can show me a working example of an addforce/setforce fix with per atom force values.

With kind regards,
Thomas Wagner.

in.addforce (1.14 KB)

thomas,

your input does fail in many other places with the current lammps code.
if you use an old or customized version, it may not have the feature of
being able to use variables as input.

please provide an input that works except for the part that you have
problems with.

thanks,
    axel.

Dear Axel,

sorry I provided a LIGGGHTS input file. I made the input file LAMMPS (7 Dec 2010) compatible and the test succeeded. A working input file is attached.

Could you please check, whether I use the addforce fix correctly:

1.) doesnt work (why?):
variable b atom type
fix flow all addforce NULL v_b[1] NULL
ERROR: Variable name for fix addforce does not exist

2.) seems to work with LAMMPS:
variable b atom type
fix flow all addforce NULL v_b NULL

With kind regards,
Thomas.

BTW: Is it appropriate to address LIGGGHTS related issues within the LAMMPS mailing list? Probably not, but I was not sure, if my problem seems not to occur with LAMMPS.

in.addforce.lammps (901 Bytes)

Dear Axel,

sorry I provided a LIGGGHTS input file. I made the input file LAMMPS (7 Dec
2010) compatible and the test succeeded. A working input file is attached.

please note, that developers usually only test against the current version.

Could you please check, whether I use the addforce fix correctly:

1.) doesnt work (why?):

because it is an per-atom variable and you are requesting
the result for a specific atom. that is not supported.

variable b atom type
fix flow all addforce NULL v_b[1] NULL
ERROR: Variable name for fix addforce does not exist

2.) seems to work with LAMMPS:
variable b atom type

this is how atom style variables are defined. however
defining a force that you want to add to the atom type
number is unusual. typically this would be used to have
a location dependent force added. e.g. by x-coordinate:

variable b atom 0.002*x

fix flow all addforce NULL v_b NULL

With kind regards,
Thomas.

BTW: Is it appropriate to address LIGGGHTS related issues within the LAMMPS
mailing list? Probably not, but I was not sure, if my problem seems not to
occur with LAMMPS.

first of all, you should _always_ report which version of a code you are using,
regardless with which software you are working. since LIGGGHTS is derived
from LAMMPS, there is a good chance that people here will be able to help you.
it certainly is true for the LAMMPS variant that i have maintaining.
i would expect that christoph is subscribed here, too.
however, there is one type of issue where you have to be careful:
derived packages may not always be up-to-date with the upstream
LAMMPS code, particularly when changes in LAMMPS require
some porting effort to integrate them into the additional features
of the respective branch. as a consequence, the online documentation
may be describing features that are not available in the branch.
you have to take that into account when trying out features
and when reporting problems.

cheers,
    axel.