(add-key-binding "Refine Active Residue" "r" (lambda () (manual-refine-residues 0)))
(add-key-binding "Refine Active Residue AA" "x" (lambda () (refine-active-residue)))
(add-key-binding "Triple Refine" "t" (lambda () (manual-refine-residues 1)))
(add-key-binding "Triple Refine AA" "h" (lambda () (refine-active-residue-triple)))
(add-key-binding "Autofit Rotamer" "j" (lambda () (auto-fit-rotamer-active-residue)))
(add-key-binding "Pepflip" "q" (lambda () (pepflip-active-residue)))
(add-key-binding "Go To Blob" "g" (lambda () (blob-under-pointer-to-screen-centre)))
(add-key-binding "Add Water" "w" (lambda () (place-typed-atom-at-pointer "Water")))
(add-key-binding "Eigen-flip Ligand" "e" (lambda() (flip-active-ligand)))
(add-key-binding "Add terminal residue" "y" (lambda ()
(let ((active-atom (active-residue)))
(if (not active-atom)
(format #t "No active atom~%")
(let ((imol (list-ref active-atom 0))
(chain-id (list-ref active-atom 1))
(res-no (list-ref active-atom 2))
(ins-code (list-ref active-atom 3))
(atom-name (list-ref active-atom 4))
(alt-conf (list-ref active-atom 5)))
(add-terminal-residue imol chain-id res-no "auto" 1))))))
(add-key-binding "Fill Partial" "k" (lambda ()
(let ((active-atom (active-residue)))
(if (not active-atom)
(format #t "No active atom~%")
(let ((imol (list-ref active-atom 0))
(chain-id (list-ref active-atom 1))
(res-no (list-ref active-atom 2))
(ins-code (list-ref active-atom 3))
(atom-name (list-ref active-atom 4))
(alt-conf (list-ref active-atom 5)))
(fill-partial-residue imol chain-id res-no ins-code))))))
(add-key-binding "Load RNAs files" "F9"
(lambda ()
(let* ((home (getenv "HOME"))
(dir-1 (append-dir-dir home "data"))
(dir-2 (append-dir-dir dir-1 "rnase")))
(read-pdb (append-dir-file dir-2 "tutorial-modern.pdb"))
(make-and-draw-map (append-dir-file dir-2
"rnasa-1.8-all_refmac1.mtz")
"/RNASE3GMP/COMPLEX/FWT"
"/RNASE3GMP/COMPLEX/PHWT" "" 0 0))))
(add-key-binding "Toggle Ghosts" ":"
(lambda ()
(let ((keyboard-ghosts-mol
(let ((ls (model-molecule-list)))
(let loop ((ls ls))
(cond
((null? ls) -1)
((ncs-ghosts (car ls))
(car ls))
(else
(loop (cdr ls))))))))
(if (= (draw-ncs-ghosts-state keyboard-ghosts-mol) 0)
(set-draw-ncs-ghosts keyboard-ghosts-mol 1)
(set-draw-ncs-ghosts keyboard-ghosts-mol 0)))))
(add-key-binding "Hydrogens off" "("
(lambda ()
(set-draw-hydrogens 0 0)))
(add-key-binding "Hydrogens on" ")"
(lambda ()
(set-draw-hydrogens 0 1)))