Hi, everyone
I always have a confused problem. I can’t use the fix reference. For example,
fix den1 all ave/spatial 1 1 1 z 0 10 density/number units box
variable vden1 equal f_den1
fix denprint all print 1 “The atom density is ${vden1}” file atomdensity.txt
then I get the error: “Mismatched fix in variable formula”
if I change the variable style “equal” to “atom”, I also get an error: “Substitution for illegal variable”
Is there something wrong?
Another question: Can the “eflux” in the command “fix heat” use a fix reference? Because I want to add an eflux varies with time or some other variables. I tried sevaral ways, but I always failed.
Thanks for any suggestion.
Xiaopeng
variable vden1 equal f_den1
This command is the problem (as the error indicates). You have to
assign a value that the
fix generates to a variable. Fix ave/spatial generates many values.
Try something like f_den1[5]. Read the doc page on
variables and how to access fix values.
Another question: Can the "eflux" in the command "fix heat" use a fix
reference? Because I want to add an eflux varies with time or some other
variables. I tried sevaral ways, but I always failed.
You can use this line in your input script:
fix 1 all heat 100 ${myflux}
which will eval the myflux variable at the time the command is issued.
It won't re-evaluate the variable during a run. Fix_heat.cpp would have
to be modified to do that.
Steve