When defining the main interaction, the protein atom id is provided by the user (and correctly found in the topology), but the ligand atom has to be found as the closest atom to the protein, being able to perform an hydrogen bond.
As openMM numerates indices starting from 0, we added 1 to the indices found in the find_interaction function to the AMBER nmr restraint. However, this is still not sufficient. In some protein chunks the numeration is changed by assigning an atom number to TER, as such, the change from openMM to Amber ligand id needs to be +2. In some other cases, the assigned atom is completely unrelated to the closest (Why?)