Chemistry on the Desktop
For this article, I thought I'd introduce another chemistry application—specifically, BKChem, a free chemical drawing program. As opposed to many other chemistry applications, BKChem provides both a nice GUI for constructing molecules and a set of chemical analysis tools to look at the properties of the newly constructed molecule.
Most distributions should have a package available to make installation easier—for example, Debian-based distributions can install BKChem with the following command:
sudo apt-get install bkchem
Once BKChem is installed, you can start it either from the menu
entry or by executing the command
bkchem from a terminal window.
When it first opens, you'll see a blank screen where you can start your chemical construction.
Figure 1. When you first start BKChem, you get a blank canvas to start building your molecule.
If you have a previously created molecule, you can load it by clicking the File→Load menu item, which will load the data into a new tab, or you can click the File→Load to the same tab menu option to load it into the currently active tab.
BKChem also can import data from other file formats. If you click File→Import, you'll see that you can import files with CML, CML2 or Molfile formats.
If you want to start by building your own molecule, several menus of building blocks are available. They are laid out as a pair of rows, just below the menu listings at the top of the window. The top row of icons selects which list of icons will be available in the second row. The first icon in the first row is simply an arrow, allowing you to select objects within your molecule so you can edit their properties. The next icon pulls up the row of drawing elements where you can start to draw your new molecule.
There are several choices in terms of line thicknesses, styles and bond angles, and you can create a chain of elements simply by clicking on the end of an existing line segment.
Once you have the basics of your structure laid out, you'll want to edit the details next. To do this, click on the first icon again (captioned with "edit"), and then click on the structure element you want to edit. This is where having a proper mouse is a must, as you need to click with the middle button on your mouse to pull up the edit panel.
Figure 2. You can edit an element by clicking the middle mouse button. The menu you get depends on the type of element you are editing.
If you are using a laptop touch panel, you need to click the left and right buttons together and then scroll with the touch pad itself. As an example, if you click on an atom, you can change the atom in this location or even replace it with some type of atomic group, such as an alcohol group.
You also can edit all kinds of display options, such as colors used, fonts for text, text placement and line widths.
The third icon on the top icon row pulls up a list of available templates for larger commonly used atomic structures, such as benzene rings.
Figure 3. You can add larger commonly used structures with templates.
The fourth icon on the top row lets you pull up a list of templates that you have created previously, allowing you to add templates for those substructures that you use most often.
You may need to play with the display in order to be able to see everything clearly while you are working. The appropriate instructions are under the Object menu item. The first option on that menu is Scale. Selecting either a portion of your structure or the whole thing, you essentially can zoom in or out to see the structure better as you work on it.
Figure 4. You can scale parts of your molecular structure to make it easier to work on.
You also can make changes to the display, such as altering the stack layers or mirroring horizontally or vertically.
The last option available is the Object→Configure menu item. This will pop up another window where you easily can change atom, bond, font or common details for the display. This is also the same window that appears when you click on the Properties item on the Edit menu (which you get when clicking the middle mouse button).
Figure 5. A configuration window allows you to edit properties of your structure's elements easily.
So far, I've just been describing building up a molecule. In the rest of the screenshots here I'm using a simple benzene ring to discuss the chemistry you can do with BKChem.
You can get basic information about your structure by clicking on Chemistry→Info, which will pop up a new window with items like the chemical formula, molecular weight and composition.
Figure 6. You can get a list of basic chemical information about your structure.
If you want to check to see whether the structure you've built makes sense, you can select it and click on the Chemistry→Check chemistry menu item. If everything makes sense, you'll see a new window telling you that everything is okay. Otherwise, you'll get an error message highlighting what doesn't quite work from a chemical point of view. This is where you may need to dig into the grittier items available from the Edit menu when you click on an element with the middle mouse button. You may need to change the type of atom or change its valency. As an example of the type of error you might encounter, see what happened when I changed one of the carbon atoms to an oxygen atom in the benzene ring (Figure 7).
Figure 7. Sometimes, the chemistry doesn't work out.
At the far right side of the menu bar, there is an entry for available plugins. One of these plugins allows you to calculate bond angles. You can select two connected bonds by holding down the Shift key and clicking them one after the other. Then you can click on the Plugins→Angle between bonds menu item to calculate the angle.
Figure 8. You can calculate bond angles for your molecule.
When you've finished all of the work of creating your new molecular structure, you'll want to save it for further analysis or to share with other researchers. The default file format that structures are saved in is an SVG (Scalable Vector Graphics) file. If you want to save your work using a different file format, click on File→Export to get a list of all the supported file formats. Most of them are simply other graphics file formats, but a few are specifically used for storing chemical information.
You can select CML or CML2 (Chemical Markup Language) to save more of the chemical information for your structure. You also can save your structure in the molfile file format, which was created by MDL Information Systems to store more detailed information about a chemical structure. If you just want an easily shared image of your molecular structure, you can export it into either a PDF or PNG file.
As you have seen here, you can use BKChem to build molecular structures in a way similar to many other chemistry applications. What is slightly different with BKChem is that you can do some basic chemistry with your newly created structure directly from BKChem. This added functionality might be enough to make BKChem a tool you'll want to add to your arsenal.
Limited Time Offer
Take Linux Journal for a test drive. Download our September issue for FREE.
Topic of the Week
The cloud has become synonymous with all things data storage. It additionally equates to the many web-centric services accessing that same back-end data storage, but the term also has evolved to mean so much more.