The iOS version of MMDS (for iPhone, iPod and iPad) provides a molecular structure editor that is based on a core set of sketching primitives, and supplements these tools with a variety of gesture-based controls that make drawing chemical structures convenient on a touch-based interface. Some of these gestures are more obvious than others, so be sure to read the whole article.
Most of the gestures are covered in: Introduction to Drawing (iPhone). In this article, they are listed explicitly, and explained one at a time. For an annotated visual summary of the main menu and various screens, see: Annotated Screens (iPhone, iPad).
The primary interface of the molecule editor is based on button banks, which are filled with action buttons. There are two types of button banks: command banks and context banks. These two types of button banks mostly provide access to the same features, but either style can be more convenient, depending on the circumstances.
Command bank gestures
At any time there is always a current command bank. Whether it is shown on the screen depends on whether it is raised or lowered. This state can be modified by tapping the grip:
Or rather than tapping, the grip can be touched and then "flicked" in the direction shown by the arrow, which achieves the same effect.
Some of the command bank actions open a sub-bank rather than performing a specific function. For sub-banks, a second grip is shown to the left:
Tapping this grip, or flicking it, closes the sub-bank, and brings back the previous button bank.
To perform an action, tap the appropriate icon. All icons also come with help text, which can be obtained by holding your finger on the icon, or moving from one button to another. To avoid performing any action, move your finger off the command bank, until no icons are highlighted, then release.
Context bank gestures
Sometimes stepping through layers of button banks to find the desired action is not the most convenient way to perform an operation. It is often more appropriate to use the context bank. To bring up a context bank, touch any part of the screen (except for a command bank), and hold your finger down until the context bank appears:
If your finger is close to an atom or bond, then it will be set to the current object. Otherwise, the current object and selection state will not be affected.
The context bank that pops up contains a collection of action buttons which are appropriate to the current circumstances. The action buttons that are shown are restricted exclusively to those which could have some effect. For example, if there is a current bond, and it is double, then you will see action buttons for converting it to a single or triple bond, but not double; the re-do action will only be shown if there is something to be re-done; the paste action will only be shown if there is a structure on the clipboard, and so on.
Once the context bank has appeared, you may either hold your finger on the screen and slide it over to the action of interest, or take your finger away, then tap the desired action. Tapping a part of the screen now covered by the context bank will dismiss it.
Some of the context bank entries open sub-banks, which replace the current context bank when activated.
Most of the action buttons in the context bank will cause the context bank to be dismissed after they are activated. Some of them do not, for convenience purposes, for example the buttons used for moving or rotating fragments are persistent, because they are often used several times in sequence.
All of the sketching primitives used by MMDS are based on the concept of a subject set. At any time there can be a current atom, or a current bond, or neither. And, any atom can be either selected or unselected. The current atom or bond is highlighted in green, while the selected atoms are highlighted in turquoise:
The current and selection state is generally specified by way of gestures. The most obvious way to pick a current atom or bond is to tap the screen, as close as possible to the object of interest. The atom or bond will be highlighted in green.
Tapping the screen in an area which is not close to an atom or bond will cause a deselection event. If there are any selected atoms, they will be deselected; otherwise, if there is a current atom or bond, then it will be no longer so. To clear both the selection and the current atom or bond, it is necessary to do this twice. Otherwise, tapping in an empty area has no effect.
Selecting atoms via gestures is a bit more interesting: it involves invoking crayon mode.
To activate crayon mode, touch an empty area of the screen, then quickly start moving your finger. If you wait too long, the gesture will be interpretted as a request to bring up the context bank. Once your finger starts moving, a turquoise blob (the crayon) will follow your finger around as it moves. Any atom that is coloured in by the crayon becomes selected.
Below is an illustration of a crayon-gesture which selects all three atoms of the carboxylic acid functional group of aspirin:
The gesture originated on the left side of the trail, and progressed through a rightward crescent shape. As soon as the crayon trail covers an atom, it becomes selected.
Because fingers are large and imprecise relative to a touch screen, it can be quite hard to pick a particular atom or bond, when the structure gets a little congested, or is zoomed out. The current atom/bond can be modified by using traversal mode. To start this sequence, look for the current atom or bond, and touch the screen as close as possible to it, then move your finger. This will activate traversal mode.
When in traversal mode, you can move your finger in the direction of the object that you actually want to be the current atom or bond, and the current object will "hop" between bonds and atoms. All you need to do is drag your finger in the right direction, then release it when the right object is selected:
Traversal mode can also be used to scroll the structure diagram. When the current atom or bond gets close to the edge of the screen, it will be moved over a little toward the centre.
Traversal mode can be used for more than just selecting atoms and bonds: when there is a current atom, MMDS calculates a set of likely angles for new substituents to be added. These are shown as phantom bonds, since they do not actually exist. If you remove your finger from the screen while a phantom bond is selected, it will be created. This is a very convenient way to draw structures, particularly chains, as long as they have regular geometries.
Consider the following annotated illustration, in which traversal mode is active, and the current atom has three substituents:
Six direction arrows are shown, which indicate the degrees of freedom for traversal. The turquoise arrows (northwest, northeast and south) indicate directions of traversal which follow existing bonds. Moving your finger in any of these directions will walk around the connected component. The green arrows (north, southeast and southwest), and their phantom bond outlines, indicate the directions computed for possible new bonds. In this case, because the valence of the current atom is already full, the proposed new bond positions are the midpoint angles between the existing bonds.
Double-tapping on any part of the screen triggers an editing effect.
Double tapping on an atom, or an empty part of the screen, brings up the atom editing dialog, which is dominated by a periodic table:
The periodic table can be dragged around the screen using a single-finger swipe gesture.
The atom editing dialog has several settings that can be modified. The quickest way to change the element type is to locate it on the periodic table, and double-tap the element, which will change the atom and close the dialog.
Double tapping on a bond cycles the bond order between 1, 2 and 3, as appropriate by valence count.
Zoom and Pan
To zoom the screen in or out, you can use the standard pinch gesture: place both fingers on the screen and move them closer or further away, as necessary. This will affect the view of the molecule. Note that the actual atomic coordinates are not affected.
Many iOS apps use the single-finger drag gesture for panning the screen around. MMDS is non-standard in this respect because all of the single-finger gestures are reserved for other operations. To move the contents of the screen around, place two fingers on the screen, and move them both. Try to keep both fingers the same distance apart from each other, initially, because otherwise the gesture may be mistaken for a pinch. As you move your fingers across the screen, the view of the structure will move with them.
The MMDS structure editor can accomplish almost all editing tasks by using just action buttons, but there are a number of touch-based gestures that provide convenient shortcuts. An experienced user of MMDS will pick and choose between gestures, command banks and context banks to draw structures with the minimum amount of fuss.