.Pressure Control
The pressure is calculated by the viral theorem of Claussius. It is defined as the expectation value of the sum of products of the coordinates of the particles and the forces acting on them. This is written as

Here the term derivative term is the derivative of the momentum (p) along the x direction of the i th particle. According to the theorem this product is equal to -3NkBT.For an ideal gas where the interaction occurs only between the gas particles and the containter the virial is equal to -3PV.However there are forces which occurs between the particles in a real gas and thus the total virial of a real system is equal to the sum of an ideal part i.e -3PV and the interactions between particles[Leach,2001].

The derivation of the real gas can be found from Leach, 2001. Here the term
represents the force f ij between particle i and j. We thus have the following expression for the pressure:

Constant pressure simulation requires periodic boundary conditions. Pressure is controlled by dynamically [Feller et al.,1995] adjusting the size of the cell and rescaling all atomic coordinates during the simulation. In NAMD [Kale et al., 1999] the constant pressure method of [Martyna et al.,1994] is used which is based on including an additional degree of freedom s, corresponding to the volume of the cubic simulation cell, which adjusts itself to equalize the internal and applied pressures. This degree of freedom effectively serves as a piston and is given a ‘‘mass’’ W having units of mass.length-4.This degree of freedom mimicks the action of a piston on a real system. This is associated with a kinetic energy with velocity V: