Building data files for class 2 models with moltemplate

This may be more of a moltemplate question than a LAMMPS question, but I thought someone here might have guidance. I am interested in using class 2 force fields in LAMMPS. I was intending to use moltemplate to build a system using the file included in the moltemplate distribution as a starting point.

I saw in the LAMMPS documentation for angle_style class2 that the order of atoms in the Angles section of the data file must match the order of atom types given in the angle_style command to ensure that the bond-length terms are evaluated on the matching atom pair in the angle. I’m assuming the same is true for the dihedrals.

When building a molecule with moltemplate, it appears that the atom order in the Angles section of the data file doesn’t match the ordering given in the angle_style commands in the file. Is there a way to enforce the proper ordering when moltemplate is writing the data file? fixing the ordering after the fact is quite a task for anything beyond the simplest molecule.