fix gcmc and tail correction

Dear LAMMPS developers,

I want to do GCMC simulations with account of tail correction to potential energy.

And I cannot quite get the implementation of the tail corrections.
Are they updated every time a particle is added/removed or calculated once the simulation is initialized and constant since?

Thanks in advance.

Vasily

Dear LAMMPS developers,

I want to do GCMC simulations with account of tail correction to potential
energy.
And I cannot quite get the implementation of the tail corrections.

please have a look at Pair::init() in pair.cpp
at the end of the function you see a nested loop over atom types,
where Pair::init_one() is called for each unique pair of i and j.
Pair::init_one() is a virtual function that is performing various
initialization operations including the contribution of atom pairs of
types i and j to the tail correction (etail_ij and ptail_ij). these
are summed into etail and ptail, if tail corrections are requested.

Are they updated every time a particle is added/removed or calculated once
the simulation is initialized and constant since?

they are computed during the init-phase of a run or minimization, and
- if i read the code correctly - not updated during fix gcmc. however,
the pair class also has a function Pair::reinit() that is currently
used by fix adapt to update various precomputed constants including
the tail correction, when it changes potential parameters and it may
be possible to insert this into the fix gcmc workflow.

not sure how simple this is going to be. i am copying aidan on this,
who has a much better grasp of the inner workings of fix gcmc than me.

axel.

Axel, many thanks.

That gave me food for thought.