The implementation of populate_diffusivity_matrix() in MicroSim/Grand_potential_Finite_difference_2D_MPI/functions/utility_functions.h does not reset the value of the variable l to 1 after the for loop, causing the second loop to search for values beyond the length of the matrix input.