Using fix print

I’m trying to do something very basic, which is to output the energy to a dedicated text file for post processing. However, the following line (in a simulation that otherwise works fine):

fix 99 all print 100 “${pe}” file “energy.txt”

Generates the error:

ERROR on proc 0: Substitution for illegal variable (…/input.cpp:533)
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 0
[unset]: write_line error; fd=-1 buf=:cmd=abort exitcode=1
:
system msg for write_line failure : Bad file descriptor

-gideon

I’m trying to do something very basic, which is to output the energy to a
dedicated text file for post processing. However, the following line (in a
simulation that otherwise works fine):

fix 99 all print 100 "${pe}" file "energy.txt"

Generates the error:

ERROR on proc 0: Substitution for illegal variable (../input.cpp:533)
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 0
[unset]: write_line error; fd=-1 buf=:cmd=abort exitcode=1
:
system msg for write_line failure : Bad file descriptor

​...and it is a well deserved error message for an obvious. have you
defined a variable called "pe"? no! hence the error.​

axel.

Got it. I guess I had expected that since I could refer to pe within a thermo_style command, I could do in the formatted string of a fix print. I gather that everyone, be it a compute or a fix, which could be referenced as c_ID or f_ID has to be recast with a variable in order to be accessed in a fix print?

Got it. I guess I had expected that since I could refer to pe within a
thermo_style command, I could do in the formatted string of a fix print.

​a) that makes no sense. you are using a variable expansion (${}) so that
would require a variable. by the same token, you will have to prefix a
variable for thermo output with a v_. so these are very different things.
you may use thermo keywords ​in variable expressions, that is true.

b) what you are assuming is in contrast to the documentation. the fix print
documentation mentions only variables as additional output.

I gather that everyone, be it a compute or a fix, which could be
referenced as c_ID or f_ID has to be recast with a variable in order to be
accessed in a fix print?

​how about reading the documentation for fix print?

axel.​