Or one could just run the whole simulation with NPT. We always recommend beginners to do so - less possibility for things to go wrong. And the computational overhead of the barostat is not that dramatic...