Hello all,
I written an extension to lammps and everything i working as expected, however I would like the pair compute routine to be aware of which time step it is in. I would like to vary the pair force as a function of time, I am not sure of the best way to access the time step number from inside "void MyPairPMB::compute(int eflag, int vflag)".
Thank you kindly
Rizgar Mella
Hello all,
hi,
I written an extension to lammps and everything i working as expected, however I would like the pair compute routine to be aware of which time step it is in. I would like to vary the pair force as a function of time, I am not sure of the best way to access the time step number from inside "void MyPairPMB::compute(int eflag, int vflag)".
there are a number of things to mention here:
a) under some circumstances the length of the time step may
be varied, so you have to decide whether you want to make
this a change based on the number of steps or the elapsed
simulation time
b) there is already an infrastructure that allows very flexible changing
of pair postential parameters via "fix adapt". please have at the
"soft" pair style for an example of using this infrastructure. even
though this may be overkill for your usage case, it would be
overall consistent, gives you a lot of flexibility and would make
it easier to others.
c) the information you seek is in the update class:
class Update : protected Pointers {
public:
double dt; // timestep
int ntimestep; // current step (dynamics or min iterations)
int nsteps; // # of steps to run (dynamics or min iter)
int whichflag; // 0 for unset, 1 for dynamics, 2 for min
int firststep,laststep; // 1st & last step of this run
int beginstep,endstep; // 1st and last step of multiple runs
int first_update; // 0 before initial update, 1 after
...
cheers,
axel.
Hello all,
b) there is already an infrastructure that allows very flexible changing
of pair postential parameters via "fix adapt". please have at the
"soft" pair style for an example of using this infrastructure. even
though this may be overkill for your usage case, it would be
overall consistent, gives you a lot of flexibility and would make
it easier to others.
I just want to echo Axel's point. If you want a pair potential
to be time varying, then please use fix adapt and add the appropriate
routine to your pair_style (which fix adapt calls). If your new
pair style is generally useful, we'd like to add it to the LAMMPS
distribution (please send it when ready), in which case you need to
use fix adapt for this.
Steve