[lammps-users] mean-squared displacement (MSD)

Hello,

I have error message:
ERROR: Mismatched compute in variable formula

Related part of my script is:

compute 1 all gyration
compute 2 all msd
variable rg equal c_1
variable msd equal c_2

fix result all print 100 “{rg} {msd}” file result.lmp

Could anyone let me know what is wrong?
Thanks.

Hello,
I have error message:
ERROR: Mismatched compute in variable formula
Related part of my script is:
compute 1 all gyration
compute 2 all msd
variable rg equal c_1
variable msd equal c_2
fix result all print 100 "\{rg\} {msd}" file result.lmp

Could anyone let me know what is wrong?

compute msd returns a vector not a scalar.

axel.

Thank you!!

But, I still have the same error:

ERROR: Mismatched compute in variable formula

In the documentation, msd provides 4 quantities, so I tried with:

compute 2 all msd
variable x equal c_2[1]

variable y equal c_2[2]
variable z equal c_2[3]
variable t equal c_2[4]

fix result all print 100 “${rg} $x $y $z $t” file result.lmp

Which part is incorrect?

Thank you!!
But, I still have the same error:
ERROR: Mismatched compute in variable formula
In the documentation, msd provides 4 quantities, so I tried with:
compute 2 all msd
variable x equal c_2[1]
variable y equal c_2[2]
variable z equal c_2[3]
variable t equal c_2[4]
fix result all print 100 "${rg} $x $y $z $t" file result.lmp
Which part is incorrect?

where is ${rg} defined?
the rest works fine for me.

axel.

That was a mistake happened removing unnecessary part from my previous email.

It looks okay to me too, but it still gives same error message:
ERROR: Mismatched compute in variable formula

It’s weird that I have same error message when I tried with:
compute 1 all gyration
variable rg equal c_1
fix result all print 100 “${rg}” file result.lmp

According to errors from those two different cases, I guess that I was wrong about the use of “variable” command.
But I don’t find what is wrong.

Thank you, though.
Have a great weekend.

FYI, I can still get Rg anyhow with:
variable rg equal gyration(all)
fix result all print 100 “${rg}” file result.lmp

But, I don’t find such an alternative to obtain MSD.
e.g. gyration(all)

FYI, I can still get Rg anyhow with:
variable rg equal gyration(all)
fix result all print 100 "${rg}" file result.lmp
But, I don't find such an alternative to obtain MSD.
e.g. gyration(all)

this works for me:

compute 1 all gyration
compute 2 all msd

variable rg equal c_1
variable x equal c_2[1]
variable y equal c_2[2]
variable z equal c_2[3]
variable t equal c_2[4]

fix result all print 100 "${rg} $x $y $z $t" file result.lmp

axel.