Fix BC tag calculations
For periodic boundary conditions, the tags for MPI communication loop back to their starting value every 1000 messages. The current implementation does not correctly calculate the matching tags when this limit is reached: some ranks will be waiting for messages with tags above the valid range and some for messages with tags below the valid range. This causes the program to hang because these messages will never be sent.