The sole data type for this class is DiagramStructure, which is designed for editing and presenting flat 2-dimensional representations of chemical species. Furthermore, if the diagram represents an actual chemical (i.e. composed of atomic elements), it is valid to invoke its properties, such as determining molecular formula/weight, and interconverting between 2D and 3D.
Besides the status bar, there are no special features for viewing 2D structures; the form depicted is the only representation (although the black-on-white style is reserved for screen display).
The method of drawing is relatively conventional; atom modifiers are drawn in-place (hydrogens, charge, etc), and carbons are often drawn as "invisible", i.e. mere dots connected by lines. The favoured aromatic bond style is "resonance", which is seen here; the alternating style can be used, but the bonds will generally not be recognised as being aromatic.
Moving the mouse around the screen displays several pieces of information at the bottom of the panel, e.g. (X,Y) coordinate in Angstroms. When the cursor is over an atom or bond it is highlighted, and further information appears at the bottom of the panel; this varies depending on the selected tool and action in progress.
Almost all of the DiagramStructure panel features are devoted to editing the structures. This is done by clicking on tool buttons to the right, or selecting the corresponding option from the Diagram menu. Some tools are instant-effect (e.g. Undo), and others are persistent (e.g. Cursor) and require further interaction before anything occurs.
The functions of the tools are described below in the order which they occur on the toolbar.
The Cursor tool has a number of functions, which are described below.
Edit point: a single left-click on an atom location brings up the dialog box, as shown. This allows all of the properties of the atom/point to be edited manually, which is often a more effective method for getting the desired result than would be a purely interactive approach. Editing the Element is self-explanatory. Implied hydrogens requires a little more explanation, as it is a serious problem with most cheminformatics software: it is aesthetically unpleasing as well as inconvenient to have all hydrogen atoms drawn in manually. Thus most popular programs will calculate the number of hydrogens by valence, often not displaying them, but considering them to be present nonetheless. Xykron does this also, but is quite conservative. Although the default for any particular atom is to determine implied hydrogens, only the elements C, N, P, B, O and S are eligible; others always default to 0. The valence is calculated if necessary; total bond order, charge and spin are accounted for, and the result is the number of hydrogens, which is always displayed onscreen, except for "invisible" carbons. The number of hydrogens is not just aesthetic, it is also important for derived uses (see later). It is possible to disable the inclusion of implied hydrogens entirely, or specify how many there are. The dialog box also provides editing for Charge and Spin (where spin is perhaps misnamed, referring rather to the number of unpaired electrons). Isotope is assumed to be a distribution of natural nuclear weights, but can be specified as one in particular. Valence is normally calculated, but can be specified; this can affect number of implied hydrogens. Lastly, the (X,Y,Z) position of the atom can be modified by entering numeric values. The Z coordinate is largely irrelevant, but will be used if the diagram is converted into a 3D structure.
Quick drag: Using the cursor tool, it is possible to left-click and drag a single atom to a new position.
Select: There are several ways to select a point. One is to drag a marquis (starting at a location with no underlying points) to select one or more points; this can be done with just the left mouse button. Whatever selection previously existed is lost, and clicking on empty space simply deselects. Holding the shift button down and left clicking on a point will toggle its selection. Dragging a marquis with shift+left button will result in an additive selection. Selections are relevant to other functions within the Cursor tool, as well as to other tools.
Bulk operations: These features only work when one or more atoms are selected. Alt+left button will move the whole selection. Draggint the alt+middle button combination will perform a "coarse" rotation, which rotates the selection through 15° increments. Alt+right button will perform a "fine" rotation, i.e. 1° increments.
The Erasor tool is a quick way to remove atoms or bonds one at a time. Clicking on the corresponding item will remove it.
Total of 10 tools, they are respectively: Single Bond, Double Bond, Triple Bond, One&Half Bond, Aromatic Bond, Half Bond, Inclined Single Bond, Declined Single Bond, Dative Bond and Wavy/Isomer Bond.
Note that the "one&half" bond is actually deprecated, and is equivalent to an aromatic bond, of total bond order 1.5. The wedge bonds (inclined/declined) are considered single bonds. The direction (from/to) is important. Dative bonds are also directional, and make bond-order totalling less straightforward. A "wavy bond" is a single bond which is stereochemically ambiguous.
The bond tools are first and foremost intended for creating new bonds. To do this, left-click on an existing atom/point, and drag the length of the bond. The bond will be restricted to unit bond lengths and angles (see status at the bottom of the panel for feedback), which is intended to make it easy to create regular structures. The recommended bondlength for most bonds is 1.5 Angstroms.
If it is desired to create a new bond without the length/angle "snap-to" feature, perform the same action except use the right button. The bond orientation will not be restricted.
The new bond can be drawn into an existing atom, in which case just a bond will be created between the two existing atoms. If there is no atom at the destination position, a new one will be created - a simple carbon atom, which may need to be changed later. Often this will be drawn as just a dot, if it is connected to other carbons.
Alternately, if the tool is used to left-click on an existing bond, that bond will be changed into the type indicated by choice of tool. If the type is already the same, the direction will be switched (which is useful for wedge & dative bonds).
There is no edit dialog box for bonds. The ways to delete them are to use the Erasor tool, or to delete one of the atoms to which it is connected.
The "labelled atom" tool is used to add or modify an element. Left-clicking on the tool will select whichever atom was last used. To select an atom, right-click on the tool, and hold down the button to select from a menu. Several common elements are presented, along with an "Other" option, which allows text entry.
To create a new atom, left-click on any "empty" space, and the selected atom (or non-element label) will be created. Moving the cursor above an existing atom will cause the highlighted atom to be temporarily redisplayed with the tool value. Left-clicking will replace the underlying atom with the new atom type.
This tool works in the same way as the atom symbol above, except that the value used to replace with is always carbon. After adding or replacing an atom, it is not necessarily drawn as a "dot" however, as it is subject to the same display rules as any other carbon.
The Template tool is intended to save effort when it comes to creating common structural motifs. As shown, the default template selection is quite limited, but it is straightforward to add new items in the templates/ Collection in the local Realm.
Selecting the tool with the left-button for the first time in a panel session brings up the dialog box as shown, prompting a selection to be made. Subsequent selection of the tool will default to the previously selected template, unless the right-button is used, which always brings up the selection box.
When the tool is selected, moving the cursor about on the main panel will draw an outline of the template. Left-clicking will place the new atoms and bonds. Judicious merging with existing atoms is undertaken - any template atom that is close to an existing atom will be merged, that is the existing atom will be retained.
Before placing a template, it is often desirable to rotate it to the correct orientation. Holding the alt-key and dragging with the middle or right button rotates the template by coarse or fine increments, respectively.
If the clipboard contains a fragment from a 2D or 3D structure, it will be pasted into the current panel. Note that only CRK datatypes are applicable to the clipboard.
If one or more atoms are selected, will place them onto the clipboard, and remove them from the current Property.
Copies the currently selected atoms (and any bonds that connect them) onto the clipboard. Has no effect if there are no selected atoms.
Rewinds changes made to the Panel's data content, up to 10-deep. Changes are usually recorded as one user-action/one undo level, but some such actions are condensed, such as dragging atom movements or rotation.
The reverse of the Undo tool.
There are several methods by which a DiagramStructure can be presented (apart from the raw representation of the XML data content), each of which goes through the standard mechanism. The output types (postscript, Qt-metafile and SVG) are all supported, and are rendered in a paper-compatible form (i.e. black-on-white rather than the onscreen white-on-black).
Import and Export
The menu option Diagram/Exchange supports importing and exporting of structures. The XML-fragment import/export uses subsets of the overall XML structure, which are equivalent to an isolated node for the Property.
At present the only non-CRK type support is the ubiquitous MOL-file format. Although the CRK datatype content is quite simple and roughly parallels the featureset of a simple MOL-file, the latter format has some blatantly glaring deficiencies, and therefore it is not necessarily reasonable to expect that no information will be lost in the translation. Improved chemical intelligence may be added at a later date, but for the moment, some manual checking and possible modification may be required.
If all or part of a 2D structure is copied to the clipboard, it can be pasted into a Structure3D-derived datatype such as a ModelStructure. The transition will be made as faithfully as possible. As described in the next section, this is an effective starting point for building a 3D representation, and it is not necessary to draw both 2D and 3D structures to fully represent a molecule.
Automatically calculated molecular formulae can reference a Structure2D Property, although the result will not be meaningful unless all atom symbols correspond to elements of the periodic table.
|Prev: KeyValues Class||Back to Contents||Next: Structure3D Class|