Illegal fix print command (src/fix_print.cpp:88)

HI Lammps experts,

I encounter the following error when i was using the fix print command. Could you please share me some insights?

Regards,
Michael

 variable tt equal dt*step
 variable ksi equal f_SMD[6]
 fix extra pull1 print 10 “${tt} ${ksi}” file umbrella.${ksi0}.pmf screen no
 fix extra pull1 print 10 “505891 ${ksi}” file umbrella.${ksi0}.pmf screen no
 fix extra pull1 print 10 “505891 7.09137433175522” file umbrella.${ksi0}.pmf screen no
 fix extra pull1 print 10 “505891 7.09137433175522” file umbrella.7.0.pmf screen no
ERROR: Illegal fix print command (src/fix_print.cpp:88)
Last command:  fix extra pull1 print 10 “${tt} ${ksi}” file umbrella.${ksi0}.pmf screen no
group pull1 id 5
group pull2 id 6

label loop
variable ksi0 index 7.0 6.5 6.0 5.5 5.0 4.5 4.0 3.5 3.0 2.5 2.0 #
fix SMD pull2 smd cvel 20.0 0.0 couple pull1 auto auto auto ${ksi0} #

run 5000 #

variable tt equal dt*step
variable ksi equal f_SMD[6]
fix extra pull1 print 10 “${tt} ${ksi}” file umbrella.${ksi0}.pmf screen no

dump ${ksi0} all custom 100 smd.${ksi0}.lammpstrj id type x y z
run 25000 #
next ksi0
jump SELF loop
write_data equilibrium.data

You should use triple backticks (`) before and after the code block to format it as code. As it is, it’s hard for me to read what the filename is.

What version of LAMMPS is this with and on what platform?
The only potential issue that I see is that your double quotes (“) are non-ASCII characters and with the current LAMMPS version, that will be corrected on the fly since recent LAMMPS versions contain code that will replace similar looking UTF-8 characters with their ASCII equivalents.

1 Like

Axel is spot-on. I didn’t even notice that. Here’s an example input script (the Melt example) with a similar fix print statement.

units           lj
atom_style      atomic

lattice         fcc 0.8442
region          box block 0 10 0 10 0 10
create_box      1 box
create_atoms    1 box
mass            1 1.0

velocity        all create 3.0 87287 loop geom

pair_style      lj/cut 2.5
pair_coeff      1 1 1.0 1.0 2.5

neighbor        0.3 bin
neigh_modify    every 20 delay 0 check no

fix             1 all nve
variable    a equal 1.0
fix     2 all print 10 "${a}" file ${a}.out screen no

thermo          50
run             250

Notice in the log file here:

...
neighbor        0.3 bin
neigh_modify    every 20 delay 0 check no

fix             1 all nve
variable    a equal 1.0
fix     2 all print 10 "${a}" file ${a}.out screen no
fix     2 all print 10 "${a}" file 1.out screen no

thermo          50
run             250
Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule
Neighbor list info ...
...

That the variable in the double quotes doesn’t get expanded like yours does. This is because the fix isn’t treating everything in your quotes as a string, but as two tokens separated by a space. It doesn’t recognize the second one as a keyword, so it errors.

Sorry for the deep dive, this fascinated me for some reason :sweat_smile:

1 Like