Error in variable.cpp

Dear LAMMPS users,

We've had some problems in our group recently with the variable trap()
function giving odd results. There appears to be a bug in variable.cpp
at line 3026:

else if (method == TRAP) {
            if (i > 1 && i < nvec) value += one; // line 3026
            else value += 0.5*one;
          }
}

This multiplies only the first two columns of the fix data by 0.5, not
the first and last columns. It should read:

else if (method == TRAP) {
            if (i > 0 && i < (nvec - 1)) value += one; // line 3026
            else value += 0.5*one;
          }
}

After fixing this in our local version, trap() gives the same results as
a trapezium rule script. It's only a minor change, but I've attached a
patch in case it's useful to anyone who doesn't want to dive into
variable.cpp themselves.

Thanks,

variable.cpp.patch (433 Bytes)

Dear all,
I’ve noticed, to my joy, that in the last version of lammps the GCMC for molecules is available.
I’ve been working with GCMC for monoatomic particles for some time, and looking through the code and the reference “(Frenkel) Frenkel and Smit, Understanding Molecular Simulation, Academic Press, London, 2002.” a question have rise to me.
I don’t have the GCMC theory for molecules very clear, so maybe someone can help me with this question.

This is what I found in Frenkel’s book

In chapter 5 page 126 the acceptance criteria for GCMC is deduce, as long as I understand for monoatomic particles despite the fact that more than one time it refers to them as molecules.
Then in Apendix G page 559 when the relation to make GCMC for a fix pressure instead of the chemical potential is deduced, a more general approach is used and the acceptance criteria for poliatomic particle is deduced (page 561). The thing is that the expression for the acceptance criteria is much more complex than the one for monoatomic particles. And the one that is in the code, for atoms or molecules is the one for monoatomic particles.

zz = exp(beta*chemical_potential)/(pow(lambda,3.0));

this zz factor is used for the acceptance criteria, just contains de the De Broglie wavelength (lamda), but no of the other internal degrees of freedom that appears in page 561, for polyatomic particles.

After this my question is simply that, Am I misunderstanding something or is this something that has to be changed ?? , I cannot explain myself better the equation are a bit annoying for writing them here, please look at the book

Also I see that now the fix has a region option for making interchanges in a region of the simulation box.
For what I’ve red when the GCMC is perform in a region of the simulation box the volume in the acceptance criteria should be that of the region and not all of the simulation box, in the code just one volume is defined

volume = domain->xprd * domain->yprd * domain->zprd;

I didn’t see a case for the region option.

this can be read in this referece J. Chern. Phys., Vol. 98, No.6, 15 March 1993

Thanks for any answers and opinions on this matter
Matias

yes - good catch - I'll post a patch

Steve

Paul can answer.

Steve

I've just seen the updated version, Steve, I think it might still be wrong.

if (i > 1 && i < nvec-1) value += one; // line 3027

Shouldn't that read i > 0?

Cheers,
Niall

oops - didn't see the 0/1 - it's in 2 places
and one of them is right. Will change it on Monday.

Thanks,
Steve

oops - didn't see the 0/1 - it's in 2 places
and one of them is right. Will change it on Monday.

Dear Steve,

Just noticed that this hasn't been changed. I see what you mean about it occurring twice (lines 3010 and 3027), but shouldn't they both be i > 0?

Thanks,
Niall

yes - my mistake. Just posted a patch that
includes a fix. Sorry for the comedy of errors
on this one ...

Steve