Molecular Bonding Language

The Molecular Bonding Language (MBL) is used to specify the structure of molecules using the bonding rules defined by Miles Mathis in his papers relating to chemistry and atomic structure. While the language does not intend to cover all possible molecules, it does provide a lot of power to build quite complex structures. The language itself tries to remain simple, so that it is easy to learn and use, yet allow you to express your creativity when building molecules.

Elements

A molecule is a collection of atoms bonded together, so an MBL expression is basically a means of specifying atoms and their bonds. To keep expressions as concise as possible, elements are specified by their atomic symbol.

O, C, Hg, Au
Spatial Information

The orientation of an atom is very important if we are going to define the structure of a molecule. We need to know which parts of each atom are going to be connected together. To accomplish this, we will first need to define a coordinate system.

As a reference:

  • the X axis increases to the right;
  • the Y axis increases up;
  • the Z axis increases towards your eye.
Given this orientation, all atoms are initialized with their center at (0,0,0), oriented along the Y axis such that their north pole is in the +ve Y direction and their south pole is in the -ve.

This gives us the following directions:

North +Y South -Y
East +X West -X
Front +Z Back -Z

Further more, we need to ensure consistancy in the way the hook stacks are arranged. When there is a difference in the number of protons in the north and south of an atom, the larger stack must be in the south position of that atom. If an atom has carousel stacks, then the preference is for East/West before Front/Back. Therefore, if there are only 2 stacks in the carousel level, then they must be placed in the East and West positions, not the Front and Back. If all 4 carousel positions are being used, then the larger pair are to be placed into the East and West.

Flipping an Atom

Now that we know how the atoms are going to be oriented, we can change them. MBL provides a few ways to rotate an atom or a series of them. For now, we will focus on a single atom.

There will be times that you need to flip the north and south positions of an atom so that it bonds with the correct neighbours in a chain. To do that, you can use the flip operator which is specified by the '!' character and must be placed before the atom that it applies to.

!N

The following image shows a default Nitrogen atom on the left and a flipped version on the right.

Rotating an Atom

You can also rotate the atom about its north/south axis. This will cause the carousel level to rotate around the nucleus by the specified amount. The spin operator '*' can be used after the symbol of an atom. It must be followed by the number of degrees to rotate.

Fe*45
Cu*12.5

In this image you can see a Chlorine atom in the standard position and another with a rotation of 45°.

Note that an atom will be flipped before it is rotated.

Element Chains

While atoms are the basic construct of MBL, the real basis of an MBL expression is the element chain. This is a list of one or more atoms that are bonded along the north/south axis. The chain is declared from the bottom atom through to the top one. That is, from south to north. The first atom in the expression will be the root atom of the molecule.

A simple bond along the north/south axis can be specified with the '-' character between the atoms to be joined.

O-C

That expression would create an Oxygen atom with a Carbon atom bonded to the north pole of Oxygen. The south pole of the Carbon atom is bonded to the north pole of the Oxygen.

You can add as many atoms as you want to.

Ca-Hg-Ba-Cu

It is possible to bond atoms to the carousel level and this is accomplished by specifying a list of bonds after the atom. The list is encapsualted by the '[' and ']' characters and is comma separated. It can contain up to 4 items which are specified in the following order: East, West, Front, Back.

Fe[O,O]
Cu[O,O,C,C]

Sometimes you will need to use the front/back bonds rather than the east/west. You can use the null operator '_' in place of a bond to specify that no bond should be used.

Fe[_,O]
Cu[_,_,O,O]

The items in a carousel list can be element chains, not just an atom. This allows you to create branching structures.

Ba[O-!N,O-!N]
Cross Bonds

A cross bond is an experimental type of bond that allows you to connect atoms to the bond between two other atoms. It can be useful for creating hydrocarbons and other branching structures. You can specify a cross bond by using the '{' and '}' characters to encapsulate a list of 1 or 2 items. The items are specified in the order: Top, Bottom.

C{H}C
C{H,H}C
C{_,O-H}O{!N}C

The atom placement shown in these images does not accurately reflect the true position of the atoms relative to each other. The proton stacks involved in a bond will overlap each other to some degree. The cross bond expects complete overlap of the stacks such that they become a proton stack themselves. The atoms added in a cross bond will emit charge down through that stack, orthogonal to the main charge axis of the chain.

Multiplication Groups

Some molecules contain a large number of atoms. Especially when you start looking at hydrocarbons and their long chains. Repeating patterns in a molecule can be grouped by the '(' and ')' characters and they will be repeated a specified number of times.

H-(C)3-H -> H-C-C-C-H
O-(Fe{O,O}Cu)2-F -> O-Fe{O,O}Cu-Fe{O,O}Cu-F
H-(C-(O-C)2-N)3-H -> H-C-O-C-O-C-N-C-O-C-O-C-N-C-O-C-O-C-N-H

Whitespace

It can be beneficial to use whitespace in an MBL expression so that you can separate parts of large molecules. All whitespace in an expression will be ignored and the evaulation of that expression must be the same as if it wasn't there.

H - (C)3 - H
O-( Fe {O, O} Cu )2-F

Chemical Formula

MBL supports the use of standard chemical notation so you can easily copy and paste any formula you have. However, the formula will be interpreted as a single chain. The parser will not attempt to place atoms in logical positions based on the rules of molecular structure.

HCl
FeO3
Fe(OH)3

Chain Commands

Some concepts can not be handled directly by the language because of the limitations of the medium. You can't directly represent three dimensional structures in a one dimensional expression. The interpreter of the language must take on some responsibility to provide meaning to the symbols of that language.

Chain commands can be used to declare intent with respect to an element chain. They allow you to specify a processing instruction along with any parameters that it may require. The interpreter will use these commands to alter the way that it uses the information from the expression.

A chain command is used by placing a ':' character before any element chain. In front of the ':' character is the name of the command followed by any parameters that it can use. Parameters are separated by whitespace. For example:

command param1 ... paramN:chain

There are some restrictions on the names of commands and the values of parameters. You can not use any language delimiter within the entire command declaration. The most annoying result of this rule is that you can not specify negative numbers because the language already uses that to denote a bond. There is no escaping mechanism or other solution at this time. It has not been required so far but will be addressed if the need arises.

Rings

You can create ring structures with the ring command. It will take an element chain and bond the last atom to the first.

ring direction angle:chain
ring:(C)6

You can specify the direction that the ring will take using a parameter. The direction can be north, south, east or west. It is also possible to only use the first letter to designate the direction: n, s, e, w.

ring north:(C)6
ring w:(C)6

A second parameter can be used to rotate the ring about the direction that the chain is extending into. That is, if it was not a ring, then the chain would follow this direction.

ring north 45:(C)6
ring w 12.5:C-O-N-C-O
ring e 45:C-O-N-C-O

When declaring a ring structure, you can end an expression with a cross bond. This will be used on the bond between the first and last atoms. Any other type of structure will ignore the final cross bond.

ring:C-O{_,C-H}O-C-O{_,N}
ring w:(C-O{C-H})3
Chain Rotation

You can rotate an entire element chain with the rotate command followed by the number of degrees to rotate about the chains long axis.

rotate angle:chain
rotate 18.5:O-Ti-Hg-O
Lines

You can repeat an entire element chain along the chain direction a specified number of times. The chain is oriented orthogonal to the chain direction and will be placed against each other as if they were bonded. You do need to make sure that the connection points look correct since the chains are not really bonded together.

line count:chain
line:(C{C,C}C)6
line 5:(C{C,C}C)6
Tubes

You can repeat a ring along the chain direction a specified number of times to create a tube structure. This works just like a line, but the chain is interpreted as a ring.

tube count direction:chain
tube:(C{C,C}C)6
tube 5:(C{C,C}C)6
Sheets

While you can create a sheet using the line command and a multiplication group, you can also use the sheet command so that you don't need to specify the multiplication group. This is a quick and easy way of finding the correct chain for your sheet. However, the line and tube command are interchangeable, with only the command itself that needs to be changed. This can sometimes be more useful than a sheet.

sheet count1 count2 direction:chain
sheet:C{C,C}C
sheet 5:C{C,C}C
sheet 5 7:C{C,C}C
sheet 5 7 east:C{C,C}C
sheet 5 7 w:C{C,C}C

The direction can be east or west, but the parser allows you to use north and south as synonyms for east and west respectively.