This line will break for residues with vsites, where `atom.element == None`. Replace with `if atom.element == element.hydrogen` (and `from mdtraj.pdb import element`)