I'm working on this project where I have to simulate a gold nanoparticle impact in a gold plate, my script is:

units           metal
boundary        p p p

atom_style      atomic
atom_modify map array sort 0 0.0
read_data       system.lammps
mass             1  196.97

pair_style      eam/alloy 
pair_coeff      * * Au.lammps.eam Au

region          1 block   35.00 65.00 35.00 65.00 26.509 100.00  
group           A region 1
region          2 block   0.0 101.9575 0.0 101.9575 4.078 26.509    
group           B region 2 
region          3 block   0.0 101.9575 0.0 101.9575 0.0 4.078
group           C region 3

fix             4 C setforce 0.0 0.0 0.0

timestep        0.001
neighbor    0.3 bin
neigh_modify    delay 0 every 1 check yes
thermo_style    custom step temp pe ke 

thermo          100
fix         5 all box/relax dilate all 
minimize        1.0e-6 1.06e-6 10000 10000
run             1
unfix           5

velocity        A set 0.0 0.0 -5.00 rot yes mom yes dist gaussian 
run             0
compute         7 A com 
variable        com equal c_7[1]
variable        com equal c_7[2]
variable        com equal c_7[3]
fix             11 A print v_com "coords of center of mass" file cdm.dat
run             100
uncompute       7
fix             8 all nvt temp 300.00 300.00 0.1
compute         10 all ke/atom
variable        E atom c_10
dump            12 all custom 10 energy.dat c_10

dump            9 all custom 10 dump_system.lammpstrj id element x y z c_10
dump_modify     9 element Au 
run             20500

The error I get is:

Fix print timestep variable returned a bad timestep.

I have read the LAMMPS documentation but I could not come up with a solution, perhaps I can get some help?


1 Answer 1


Your problem comes from the line:

fix 11 A print v_com "coords of center of mass" file cdm.dat

As per the documentation, the correct syntax is:

fix ID group-ID print N string keyword value ...

Where it will print every N timesteps. So you are asking LAMMPS to print the same message every v_com timesteps. And LAMMPS is respectfully telling you that it finds that confusing since v_com is not an integer. You might wanna check this doc page in more details.

Also, as an aside, although I can't be certain what you really intended to get from the way you defined the same com variable 3 times in a row, I'm pretty confident it's not what you're going to get


You must log in to answer this question.