Modification to allow mixed mode execution. In order to keep the code portable accross platform all MPI calls within parallel regions have been moved.