Molecular dynamics simulations in a NpT ensemble using non-periodic boundary conditions