Hi,
I want to modify the lj potential in 'pair_lj_cut.cpp', everything is
fine, except the 'PairLJCut::single' part makes me really confused.
In the manual, it says 'PairLJCut::single' is for 'force and energy
of a single pairwise interaction between 2 atoms', what does this
mean? Since all the pair interactions have already been calculated in
the compute part, right?
In this part of code:
double PairLJCut::single(int i, int j, int itype, int jtype, double rsq,
double factor_coul, double factor_lj,
double &fforce)
{
double r2inv,r6inv,forcelj,philj;
r2inv = 1.0/rsq;
r6inv = r2inv*r2inv*r2inv;
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
fforce = factor_lj*forcelj*r2inv;
philj = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) -
offset[itype][jtype];
return factor_lj*philj;
}
'fforce' and 'philj' are exactly the same as 'fpair' and 'evdwl'
functions in 'PairLJCut::compute' part, so why calculate them again
outside the loop? What are those two functions used for in lammps
code?
If I want to change the lj potential, how do I modify this part?
fforce=-(1/r)*(dU(r)/dr)
philj=U-Ecutoff
I appreciate your help very much.