My guess is that you're trying to write past the end of the coords_fluid array. You're not given us enough information to know for sure, as we don't know what the value of n_atoms_methane is.
Your best bet is to use a debugger, or add some debugging output. That will give you an idea of the state of the loop when it crashes. In particular, you'll want to look at which element of coords_fluid is being written to when it crashes.