how to output the atom/swap probability

Dear Lammps user,

I want to get the information of acceptance rate when using the fix atom/swap command. I tried to output it in thermo with fix ID, but there will be error : Thermo fix does not compute scalar (…/thermo.cpp:889)

Also if I try to use fix ave/time, it gives a similar error: Fix ave/time fix does not calculate a scalar(…/fix_ave_time.cpp:220).

How should I output that fix value?

Thank you!

Regards,
Shenli

Dear Lammps user,

I want to get the information of acceptance rate when using the fix
atom/swap command. I tried to output it in thermo with fix ID, but there
will be error : Thermo fix does not compute scalar (../thermo.cpp:889)

Also if I try to use fix ave/time, it gives a similar error: Fix ave/time
fix does not calculate a scalar(../fix_ave_time.cpp:220).

How should I output that fix value?

how about simply reading the documentation?
from the documentation of fix atom/swap:

This fix computes a global vector of length 2, which can be accessed
by various output commands. The vector values are the following global
cumulative quantities:

1 = swap attempts
2 = swap successes
The vector values calculated by this fix are “extensive”.

divide the second number by the first and you have your acceptance rate.

axel.

Dear Axel,

Thank you for your reply. I got the value of total swap attempts f_ID[1] and successes times f_ID[2], but the total attempts number is always zero. My original fix command:
fix 5 cation atom/swap 200 10000 5829017 1500 types 2 3

and I output the fix every 200 steps
Wouldn’t the swap attempts be equal to 10000 for each output?

Dear Axel,

Thank you for your reply. I got the value of total swap attempts f_ID[1] and
successes times f_ID[2], but the total attempts number is always zero. My
original fix command:
fix 5 cation atom/swap 200 10000 5829017 1500 types 2 3
and I output the fix every 200 steps
Wouldn't the swap attempts be equal to 10000 for each output?

no, just read the docs!!

the fix outputs the *total* number of attemps, so you'd get 0, 10000,
20000, 30000, and so on for your fix.

i just tried with the latest development version and it works just fine for me.
defining a variable for the success ration is a bit tricky, because of
the initial step having no attempts yet, but the following workaround
does the trick:

variable success equal f_ID[2]/((f_ID[1]<1)+f_ID[1])

axel.

Thank you Axel. It works fine now.

Thank you Axel. It works fine now.

it always worked. :wink: