Mobile sketcher gets some lovin’

The next version of the Mobile Molecular DataSheet (MMDS) for iOS will come with a few new features for sketching out molecular structures, followed by each of the other apps that are based on the same core technology, as and when they are updated. While the sketcher codebase has been quite stable for awhile, on account of already being powerful enough to draw some very tricky structures perfectly & quickly, the to-do list has been collecting up ideas for improvements.

The internal feature referred to as the magic crayon has been coopted for some additional functionality. The easiest way to select atoms is usually to make use of the crayon: touch an area of the screen that is not occupied by an atom or bond, then drag your finger, as if you were colouring in the screen. The resolution is a circle of approximately the same size as a fingertip, and any atoms that are “coloured in” when you take your finger off the screen get selected (it’s the touchscreen adaptation of the traditional lasso selection). In the upcoming version, there are some additional meanings for this gesture besides atom selection.

First of all, if you draw a reasonably straight line, this is interpreted as a request to draw a “line” (technically ethane, CH3-CH3). The angle is determined by the way the line was drawn, but is snapped to a multiple of 30°. This is as good a way as any to start a new drawing from scratch:

Secondly, if you use the crayon to draw a circle (or vaguely ovaloid ring, joining the head to the tail), this is interpreted as a request to bring up the context quick-ring menu:

The effect of this gesture can also be accomplished by touch-and-hold to bring up the context menu, then selecting the sub-bank with the simple rings. These new rings can be used to start a new structure, freely placed on the screen as a new component, or attached by fusing to existing atoms/bonds.

Generally the most convenient way to to draw a new bond from an existing atom, with a conventional geometry (e.g. 120° from an existing bond) is to use traversal: this is triggered by touching an atom or bond then starting to move your finger right away, which allows you to walk through the graph. When an atom is current, some number of candidate new bonds are shown, and traversing onto one of these causes a new atom & bond to be created. In the upcoming version, when a bond is current, it may choose to show possibilities for grafting of a new ring:

By walking the traversal outward, perpendicular to the bond direction, a new ring size (3 through 7) may be selected. Taking your finger off the screen when a new bond is selected causes it to be fused into place.

The last new feature is a context menu option rather than a gesture. For the most part, using the MMDS sketcher correctly means that the geometry of the diagram is created perfectly at each step, with algorithms making the placement decisions (to floating point accuracy), and well defined operations to reposition pieces in the event of nonstandard geometries. This means that unlike most sketchers, it is not reliant on having a clean operation (which uses an algorithm to redraw the whole thing, possibly using user-provided input as a clue). In spite of this, there are still ways to end up with a structure that has a funky undesirable geometry (e.g. if you really try, or import a structure which wasn’t drawn very well).

There is now some relief: if you bring up the context menu for a chain bond, and it’s not completely regular in geometry, you may see an extra action icon that looks like two sticking plasters:

Activating this action will trigger a bunch of internal machinery which essentially breaks the bond, then makes use of the guided template fusion algorithm to graft one of the two pieces back on, using a more regular geometry. In effect, it is like having a structure cleaning feature, except that it operates on just one bond at a time.