Hi,

I am trying to understand some fixes’ contribution to virial in LAMMPS to write a fix of my own. I have the following questions.

- In fix_smd.cpp (tether mode), the force on an atom is calculated as fx=-k
*dr*dx*massfrac/r (Line 228-230 and 265-267). However the virial (fi*rj) is calculated as v=k*dr*dx*massfrac*xunwrap/r (Line 273-278). The negative sign in the force is not accounted in the virial calculation and I was wondering why.
- Similarly in fix_plumed.cpp, the virial calculated from PLUMED is multiplied by -1 before it is assigned to LAMMPS virial (Line 215-220). It would be great if someone can explain the necessity of the negative sign here.

Thanks,

Dinesh

Hi,

I am trying to understand some fixes’ contribution to virial in LAMMPS to write a fix of my own. I have the following questions.

- In fix_smd.cpp (tether mode), the force on an atom is calculated as fx=-k
*dr*dx*massfrac/r (Line 228-230 and 265-267). However the virial (fi*rj) is calculated as v=k*dr*dx*massfrac*xunwrap/r (Line 273-278). The negative sign in the force is not accounted in the virial calculation and I was wondering why.

this is a bug. i just made a few tests and can confirm, that the sign needs to be reversed to get a pressure consistent with other cases resulting in the same forces on the atoms. please compare to fix e.g. addforce instead. a corrected version of fix smd will be included into a future patch release.

- Similarly in fix_plumed.cpp, the virial calculated from PLUMED is multiplied by -1 before it is assigned to LAMMPS virial (Line 215-220). It would be great if someone can explain the necessity of the negative sign here.

PLUMED is not part of LAMMPS. you have to ask the PLUMED developers about this.

axel.

Thank you for helping me in understanding the virial calculation in LAMMPS, Dr. Kohlmeyer.

Best,

Dinesh