Print equal style variable to file

Hi!

I want to store the mean-squared-displacement to a separate file, at regular
intervals. This is the closest I've come:

    variable storeMSD equal logfreq(10,9,10)
    variable currStoreMSD equal v_storeMSD
    compute mSqDisp all msd
    variable currMSD equal c_mSqDisp[4]
    fix 2 all print v_storeMSD "\{currStoreMSD\} {currMSD}" append
msd.dat screen no

But the second call in the 'fix' seems to shift it up a bit. Is there any way
around it? I need the file to have (step, msd) values in each row.

Vishnu

Hi!

I want to store the mean-squared-displacement to a separate file, at regular
intervals. This is the closest I’ve come:

variable storeMSD equal logfreq(10,9,10)
variable currStoreMSD equal v_storeMSD
compute mSqDisp all msd
variable currMSD equal c_mSqDisp[4]
fix 2 all print v_storeMSD “{currStoreMSD} {currMSD}” append
msd.dat screen no

But the second call in the ‘fix’ seems to shift it up a bit.

can you please explain, what you mean by this or post a (brief) example?

axel.

I'm attaching a small sample script that reproduces this. I run it with:

    lmp -in in.3dlj -var seed `bash -c 'echo \(\( (od -An -tu4 -N4
/dev/urandom) >> 1 ))'` -log log.3dlj

The issue if you look at the generated MSD file, is that the first column,
begins with 20 instead of 10, because the "storeMSD" variable increments each
time it is called.

Is there someway I can store it in another variable and then use it?

Or can I somehow obtain the current "step"? (I could use a custom thermo style
and then parse the log-file, but I'd rather do it this way - I want a clean
file).

Thanks!
Vishnu

in.3dlj (1.85 KB)

I’m attaching a small sample script that reproduces this. I run it with:

lmp -in in.3dlj -var seed bash -c 'echo $(( $(od -An -tu4 -N4 /dev/urandom) >> 1 ))' -log log.3dlj

The issue if you look at the generated MSD file, is that the first column,
begins with 20 instead of 10, because the “storeMSD” variable increments each
time it is called.

yes, that is how it is supposed to be. the error is outputting this variable and not accessing the thermo property “step” instead.

Is there someway I can store it in another variable and then use it?

no need.

Or can I somehow obtain the current “step”? (I could use a custom thermo style
and then parse the log-file, but I’d rather do it this way - I want a clean
file).

all thermo properties are accessible to equal and atom style variables. please see the documentation for the variable command.

axel.

> Or can I somehow obtain the current "step"? (I could use a custom thermo
> style
> and then parse the log-file, but I'd rather do it this way - I want a
> clean
> file).

all thermo properties are accessible to equal and atom style variables.
please see the documentation for the variable command.

Thanks! That fixes the issue I've been having. I'm using it as follows:

    variable storeMSD equal logfreq(10,9,10)
    compute mSqDisp all msd
    variable currStep equal step
    variable currMSD equal c_mSqDisp[4]
    fix 2 all print v_storeMSD "\{currStep\} {currMSD}" append
msd.dat screen no title ""