Changing pair_coefficient during simualtion

Hi, Lammps Users

I have a project that need to change dealt value in pair_style expand along with simulation steps.
There is fix adapt command which could change pair values during running, but this doesn’t support pair_style expand.

I’m wondering if there is any other way to do this.
What I wish to do, for example is:
pair_coeff * * epsil sigma delta(delta=0+0.1*timestep) cutoff

Thank you

I don't know the answer, but nobody else has replied yet. My
suggestion might be wrong. If so I hope someone will correct me.
I've been curious about this too.

I am wondering if you could use a for-loop?
In each iteration of the loop you could:
  - calculate "delta" for that iteration,
   (store it in a variable)
  - specify the "pair_coeff"
   (substitute your "delta" variable into the argument
    for the pair_coeff command. I hope this works.)
  - "run" the simulation for n timesteps (where n ~= 100)

Some examples of how to construct your own loop can be found here:

Potential problems:
I do not know if changing the pair_coeff for a one atom type will
update all the coeffs which describe interactions between that atom
type and other atom types (assuming the style supports mixing) before
the next "run" command. (I think so, but you will have to try it.)
When you use the "run" command inside the loop, you may need to be careful.
(You may need to use the "start" and "stop" keywords.)

If you get a chance to try this, please let us know if this works.


The alternative: modifying the LAMMPS code for "pair_lj_expand.cpp"
and "pair_lj_expand.h" to include an "extract()" member function might
be easier than building a loop. If you know C/C++ and you decide to
augment these files, please post the new files here.

If you want to change it continuously, you want fix adapt.

From the fix adapt doc page:

IMPORTANT NOTE: It is easy to add new potentials and their parameters
to this list. All it typically takes is adding an extract() method to
the pair_*.cpp file associated with the potential.

So if you're willing to write/add a bit of code, it is do-able.


Added the ability to vary epsilon,sigma,delta for pair lj/expand
via fix adapt. Will be in the next patch.