How to calculate pressure of a gas in a molecular dynamics simlation code?
Answers
Pressure formula
In a microscopic system, pressure is calculated from the summation of forces on all atoms according to the virial equation. For pair-additive force fields this equation is usually written as V Where N is the number of molecules exist in the computational domain, kB is Boltzmann’s constant, V and T are volume and temperature of the computational domain, and fij is force between molecule i and j. This equation is formed from two different terms. First term is called kinetic term that contains temperature of computational domain. In microscopic view, Temperature equation is defined as NKT 1N N
P= + r.f (3) B ∑∑ 6Vi=1 j≠i ij ij T = m
3NbinkB n=1 i=1 n,i −V )2 (4) i Nbin 3
Ar ∑∑(V Where n denotes the molecule number in the bin, i=1, 2, 3 denotes the x, y, and z component of the atomic velocity Vn,i, Vi is the i-th component of the mean flow velocity, and m is the atom mass. Mean velocity can be obtained from any of the several averaging methods like SAM (Tysanner and Garcia 2004), CAM (Tysanner and Garcia 2005) or SMC (Karimian et al. 2011) that reduces statistical errors in its calculation. In this paper, SMC method is used to calculate mean velocity.