A bug in the improper class2 angle-angle virial update call

Hello. I've noticed a bug in the pressure computation when angle-angle interactions ('angleangle' function in improper_class2.cpp) are enabled. Currently (lammps-16Feb16) the energy/virial update call is

     if (evflag)
       ev_tally(i1,i2,i3,i4,nlocal,newton_bond,eimproper,
                fabcd[0],fabcd[2],fabcd[3],
delxAB,delyAB,delzAB,delxBC,delyBC,delzBC,delxBD,delyBD,delzBD);

It should be called in the same way as in it's main function 'compute':

     if (evflag)
       ev_tally(i1,i2,i3,i4,nlocal,newton_bond,eimproper,
                fabcd[0],fabcd[2],fabcd[3],
delxAB,delyAB,delzAB,delxBC,delyBC,delzBC,delxBD-delxBC,delyBD-delyBC,delzBD-delzBC);

Best regards, Ivan A. Strelnikov, ICP RAS.

Hi Paul - in the email below, Ivan is pointing out a possible

issue with the virial term in the class2 improper for the

angle/angle contribution. Looking at the code, I think

he is correct that the final 3 args, should be like those in

the main compute() method of improper_class2.cpp.

This somewhat odd ev_tally() arg list is for compatibility

with other impropers that calculate a different set of

distances among their 4 atoms.

Since you had verified the energy/forces for this against

another class2 implementation, I wonder if you agree witht

the bug?

Possibly this angle/angle contribution is so small, you

don’t see the difference in the pressure?

Steve

Hello, I’d like to report a few bugs in fix_rigid.cpp and fix_rigid_small.cpp which mostly affect output values.
The first one is present in both files, it’s a sort of a typo in the #define list:

#define EINERTIA 0.4 // moment of inertia prefactor for ellipsoid

It should be 0.2 instead. This bug will only affect ellipsoidal particles’ angular momentum (which is not used during time integration), since moments of inertia are initialized correctly using an external MathExtra function. Without infile this will also lead to an incorrect restart point.

The other bug is in the fix_rigid_small.cpp degrees of freedom computation method, at line 1034:

if (extended && eflags[i]) counts[j][1]++;

It can’t detect point particles since POINT is 1 and thus the expression in the parentheses is always true (if there are any extended particles). I suppose it can be corrected like this
if (extended && !(eflags[i]&POINT)) counts[j][1]++;
or just by setting POINT=0 at line 380.

Best regards, Ivan A. Strelnikov, ICP RAS.

ivan,

up front, i have to general comments.

  1. please always mention the version of LAMMPS you are looking at.
  2. the preferred way to report issues like these is now the LAMMPS github project, either as an issue at: https://github.com/lammps/lammps/issues or (even more welcome) as a git pull request with the proposed changes already in place at: https://github.com/lammps/lammps/pulls