This is based on the Chime script at molecular models for biochemistry at CMU, which is nicer than this one, and which you should cite as the source of the PDB and idea.