[lammps-users] how to directly print computed value? (Edward Kim)

hi Edward,
you can use ‘variable’ command to define a value to make it equal your compute variable,
then use ‘fix print’ command to output.
Here is a example:

compute 1 fix1 group/group fix2

variable vdw equal c_1
variable fx equal c_1[1]
variable fy equal c_1[2]
variable fz equal c_1[3]
variable time equal step*dt

fix 3 all print 100 “{time} {vdw} {fx} {fy} ${fz}” file “energy.txt” screen “no” title “#time vdw fx fy fz”

Cun Zhang