The virial pressure is commonly used to obtain the pressure from a general simulation. It is particularly well suited to molecular dynamics, since forces are evaluated and readily available. For central interactions, one has:
where one can recognize an ideal term, and a second term due to the virial. The overline is an average, which would be a time average in molecular dynamics, or an ensemble average in Monte Carlo; is the dimension of the system (3 in the "real" world). is the force on particle exerted by particle , and is the vector going from to : .