ABF sampling question

Hi all,

To better understand the ABF functioning, I organized a trivial system which is composed of just one particle positioned at y=8.549 with pbc in all directions. I Defined a collective variable which the “distanceZ” of the particle to a dummyAtom at y=0. I have attached the input and the config file.

By looking at the generated “out.count” file I get the number of samples equal to zero in all the bin which is fine except for the bin that it is always sitting in there:

Shouldn’t I expect that the number of samples in the bin that includes y=8.549 be equal to 1000 if it’s being sampled 1000 times? isn’t it counting the number of times that the collective variable happens to be in a bin?

I appreciate your help and time in advance.

Cheers,
Kasra.

in.abf (1.07 KB)

abf.colvars (483 Bytes)

Hello Kasra, was out.count written at the end of your run, or at the end of a previous test run? I noticed that you have a colvarsRestartFrequency option that has been commented: if you leave it uncommented, it will be left at its default value, which depends on the specific version of LAMMPS you’re using. Axel Kohlmeyer can elaborate more regarding how options are passed from LAMMPS to colvars outside of the colvars’ own configuration file.

In your example, do you have a colvars.state file at the end? If so, look for a series of integers following the word “samples”: you should find 1000 samples at the bin of your atoms, if everything worked.

Giacomo

Giacomo,

I appreciate your help. Regarding the question you asked:

was out.count written at the end of your run, or at the end of a previous test run?

Actually it’s written at the end of my and it’s not a continuation of previous calculation. In LAMMPS “fix colvars” get the name of of the .state file if you want to continue from a previous simulation and its default value is NULL which means starting a new colvars run and I believe that I’m doing a new run not a continuation of a previous one.

do you have a colvars.state file at the end? If so, look for a series of integers following the word “samples”: you should find 1000 samples at the bin of your atoms, if >everything worked.

Yes. I do have the colvars.state and it shows 1000 samples at the last bin. But how come it is 0 in the corresponding bin in the out.count file generated by ABF?

I have attached .state and .count files also.

Thank you again,

Kasra.

out.count (725 Bytes)

out.colvars.state (515 Bytes)

OK, then if out.count doesn’t come from a previous job, there is another explanation.

The default value of colvarsRestartFrequency in your case could be larger than 1000 (check the log to see what is taken as the default). Then out.count and out.grad will be written once at step 0 but never after, unless you run for more than colvarsRestartFrequency steps.

If you set colvarsRestartFrequency to 1000 or a divisor of 1000, I’m sure you’ll see that all counts are properly written, just like in the state file.

In general, to monitor how things are going during the run you should manually set colvarsRestartFrequency, because the colvars code doesn’t know beforehand how many steps you’re going to run, or when write_restart will be called the next time.

Keep in mind however that the up-to-date state file will always be written at the end of the run. Very soon this will also be embedded in the LAMMPS state file: Axel can tell you more about this.

Giacomo

Thanks for your crystal clear answer Giacomo. Yes, I’m getting the counts written properly now.

Cheers,
Kasra.

Keep in mind however that the up-to-date state file will always be written
at the end of the run. Very soon this will also be embedded in the LAMMPS
state file: Axel can tell you more about this.

the code for that has already been sent to steve. there will be some
more refactoring of the colvars interface in the near future and i am
very close to have part atom masses properly supported, too. this week
there have been a few diversions that consumed much of my time, so
things are not moving as well as i would have liked it.

i very much appreciate your careful checking of the functionality of
fix colvars. please keep us informed of all oddities and unexpected
behavior. it helps us working out some kinks that had been low
priority items and then were almost forgotten and also improve the
documentation. you may also report issues that are specific to the
colvars library here: Issues · Colvars/colvars · GitHub

ciao,
    axel.