Smormo-Ed has a simple interpreter built into it. It accepts commands as s-expressions (like lisp or scheme). There is a "scratch area", which holds a molecule in the program's internal data structures. If the GUI is enabled, this is what can be seen in the window. Some commands accept or return molecules encoded as s-expression, and others operate on the molecule in the scratch area. mol->sexp and sexp->mol can be used to transfer a molecule into or out of the scratch area. Each atom in the scratch area has a flag indication if it is "selected" or not. Some procedures operation only on selected atoms.
Here is an example of a molecule encoded as an s-expression. (molecule (atom (element C) (x -137.64) (y -40.36) (tag A0)) (atom (element C) (x -95.64) (y -40.36) (tag A1)) (atom (element O) (x -53.64) (y -40.36) (tag A2)) (bond (tag A0) (tag A1)) (bond (tag A1) (tag A2)))
This molecule has 3 atoms and 2 bonds.
(quit) End the program.
(exit) Alias for quit.
(quit-on-error t-or-f)
(begin s-expressions)
(wait-for-click) Stop the script until the user clicks on the main window of the GUI.
(select-all) Select all atoms in the scratch area.
(unselect-all) Unselect all atoms in the scratch area.
(select-by-atomic-number atomic-number)
(delete-selected) Delete selected atoms from the scratch area.
(clear) Delete all atoms and bonds in the scratch area.
(sexp->mol molecule)
(mol->sexp) Turn the molecule in the scratch area into an s-expression.
(sexp->format molecule format)
(format->sexp data format)
(sexp->name molecule)
(strip-hydrogens molecule selected-only)
(add-hydrogens molecule selected-only)
(read) Read and return an s-expression from stdin.
(display s-expressions)
(newline) Send a newline character to stdout.
(load-molecule-file filename)
(save-molecule-file molecule filename)
(tag-all-atoms) Give each atom in the scratch area a unique identity string.
(tag-untagged-atoms) Give a unique identity string to atoms that lack one.
(clear-atom-tags) Remove the identity string from all atoms in the scratch area.
(set-display-style display-style)
(set-electron-display-style electron-display-style)
(spin degrees)
(layout molecule)
(flip) Flip diagram left-to-right
(eval-debug on-or-off)
(debug-eval on-or-off)
(layout-debug on-or-off)
(debug-layout on-or-off)
(debug-selected-atoms skip-leaves)
(debug-molecule) Print information about the molecule in the scratch area.
(version) Print out the program's version
This will cause Smormo-Ed to display its version and exit.
(begin (display (version)) (newline) (quit))
(begin (quit-on-error #t) (display (sexp->format (format->sexp (read) "smiles") "smiles")) (newline) (quit)) "[C@H](F)(Cl)Br"
Date: 2010/09/14 09:25:18 AM