echo "changing group" chgrp ec85-member-group $SLURM_SUBMIT_DIR/slurm-$SLURM_JOB_ID.out echo "changed group"

The only important thing to note is that this should be done at the beginning of the script, before calling your program.