I output all atom’s unscaled atom coordinates, velocities and forces on atoms (‘x,y,z,vx,vy,vz,fx,fy,fz’ in dump command), then calculate the temperature and pressure through MATLAB. The simulation boundary is ‘pp pp pp’ and my system is polymer system. I use formula “xfx+yfy+z*fz” to calculate virial. When calculate pressure of the system, we should make sure all atom in the same box.
The pressure IS NOT equal the result calculate by LAMMPS. My result is 1.1364 and the LAMMPS gives me 1.252805. After checking the source codes, the problem may cause by the way of LAMMPS calculating virial. The LAMMPS calculates virial when calculate force. If one atom is out of boundary and one is in the box, the way LAMMPS use will not give the correct virial! Situation will be worse if system is small.
If the pressure isnot accuracy, other command using pressure will give the correct answer?