Apologies in advance if the phrasing sounds unusual—this issue is entirely translated by an LLM due to my limited English proficiency.
When using the GAFFTemplateGenerator.generate_residue_template function with the residue_atoms argument, I encountered an issue in line 745 of the code. The logic should iterate over residue_atoms when the argument is provided, and fall back to molecule.atoms when it is not. After implementing this change locally, my code worked as expected, so I believe this adjustment is reasonable.