Edwin, going back to this:
>> The mpirun command is invoked when the users group is set group to group 650. When the rank 0 process creates files, they have group ownership 650. But the users login group is group 1040. The child processes that get started on other nodes run with group 1040, and the files they create have group ownership 1040.
What about setting the set-guid flag for the directory? Created files therein will inherit the group from the folder then (which has to be set to the group in question of course).