Second virial coefficient with Mie/Lennar Jones potential

Hi,

I’m trying to do a very basic simulation of 1 type of atom gas interacting with Mie (or Lennar Jones) potential in the NPT ensemble.

The purpose is to evaluate the second virial coefficient at different temperatures.
** 1. is there any automatic command to evalutate the compressibility factor or the virial coefficient directly from LAMMPS? **

I took the average of thermodynamic parameters P, T, and ρ from the simulation and then I evaluated the compressibility factor as
Z = P/(ρ*T) where P is the pressure, T is the temperature and ρ is the density
Then, by knowing that Z~1+Bρ, I evaluated B as (Z-1)/ρ
I repeated these steps for some simulation, by varying the temperature.

When I plot B as function of T I find an unexpected trend. In particular if I invert the the sign of B the trend is correct but negative.

** 2. does the procedure is right? **

Thanks

No. What is available in LAMMPS is mentioned in the manual. If it is not mentioned in the manual, it is not (directly) available.

That is not really a LAMMPS question, but a question for your adviser/supervisor/tutor or a different forum focusing on the science of MD simulations (or statistical mechanics) and not one specific software.