System to describe the chemical formulas for WEB.

New features of version 1.0

Description of the features available in the new versions of CharChem

Version 1.0 - The first version of CharChem

CharChem is a new system that is designed to replace obsolete easyChem. Of course, the CharChem supports all the functions of the old system. But CharChem has a lot of new features.


The easyChem system allows the use of parentheses for very simple cases. For example, these are:


It was impossible to describe the chemical bonds inside the brackets. But with version 1.0 this feature has appeared. Here are a few examples:



Initially, it was possible to describe abstract molecules, for example {R}-OH: {R}-OH.
The same mechanism was used to describe radicals. For example, {Me}2C=CH-{Ph} :

{Me}2C=CH-{Ph} <-> H3C\C<`/H3C>=CH-/=\`//`-`\\

But for these formulas, such properties as the molecular mass or the gross formula were incorrectly calculated. Now this problem is solved. There is a list of radicals that are automatically distinguished from descriptions of abstract nodes.

Short bonds description

Let's consider several descriptions, where a horizontal chemical bond is used, which is determined by the minus sign:


The third formula differs from the others in that the horizontal bond is soft, as in this case CH3-CH2-OH. But in this case, you need a regular bond. Previously, instead of short descriptions, we would have to use more complex constructions, as in the fourth column. But now the double minus allows you to specify that the bond should not be soft.

Another problem with short bonds was the use of suffixes. Let us consider a number of constructions. Above is the description that was required in the versions below 1.0. In the bottom row - a new option.

/w_(A30,w-) \d_(A-30,d-) $L(1.5)|vN_(A0,C+)H_(A-90,C-) -_p_(P,w+)_(P,w-)_p
/w\ww \d/dd $L(1.5)|vN--vvvH`|vv -_p_pw_pww_p
/w\ww \d/dd $L(1.5)|vN--vvvH`|vv -_p_pw_pww_p

In other words, if \w corresponds to the construction of _(A30,w+), the double use of w allows us to change the direction: \ww corresponds to _(A30,w-). The triple use of the v suffix is possible for the coordination bond, which gives the arrows at both ends of the connection. That is, -vvv corresponds to _(A0,C+).

In addition, suffixes became available for the polynomial bonds _p and _q.

Delocalized bonds

In easyChem the only way to display the delocalized bond was the _o instruction. It's always a circle. For example:


Now a new instruction _s() is available. It allows you to depict a delocalized bond not only as a circle. In addition, it is possible to use a dashed line using the parameter S:

_(x2)\<->`/_(x-2)`\/_s() /\</>|`/`\`|_s(S:) -\<->`/`-_s(S:) $slope(45)-\|`/`-`\`|/_s(#1;2;5;6;1)
_(x2)\<->`/_(x-2)`\/_s() /\</>|`/`\`|_s(S:) -\<->`/`-_s(S:) $slope(45)-\|`/`-`\`|/_s(#1;2;5;6;1)

Complex bonds styles

To display the aromatic bond, you can use a universal description with a parameter S|: (Style) that specifies the style of the two lines. One solid and other - dashed. _(A90,S|:)_(A30,S|:)_(A-30,S|:)_(A-90,S|:)


The S|: parameter visually resembles two parallel lines drawn from top to bottom.

Here are a few more examples:
_(y1.5,S:|:) _(y1.5,S||:) _(y1.5,SI|) _(y1.5,SI|:)
_(y1.5,S:|:) _(y1.5,S||:) _(y1.5,SI|) _(y1.5,SI|:)

Here the capital Latin letter I denotes a thick line.

Curved bonds

In version 1.0, you can use the bonds represented by curved lines. For this, intermediate points are used. The curved connection is drawn using the cubic Bezier curve. Therefore, it requires two intermediate points. To describe them, the _m() instruction is used. In parentheses, you can use some parameters for positioning the point: x, y, A, a, P. For example, description: H2C`|H2C`|H2C_m(x2)_m(y2)_(x-2)

H2C`|H2C`|H2C_m(x2)_m(y2)_(x-2) H2C`|H2C`|H2C_m(x2)_m(y2)_(x-2)_(x2,H){b}_(y-2,H){a}_(x-2,H) H2C`|H2C`|H2C_(x2,H,C){o}_(y2,H,C){o}_(x-2,H,C)
The first picture shows the result obtained from the description.
The second picture shows the intermediate points a and b, respectively.
On the third - the schematic lines showing the order of the intermediate points.

Aligning of double bonds

Let's look at a typical formula of benzene, obtained from the description /\\|`//`\`|| :


We see that the inner line of double bonds is shorter than the outer one. This is done to improve the appearance of the formula. Moreover, the system automatically determined that in this case it is necessary to apply the right alignment (relative to the direction of bond).

This process can be controlled by means of $dblAlign function or by using parameters of universal bonds descriptions.

$dblAlign(R)/\\|`//`\`|| $dblAlign(M)/\\|`//`\`|| $dblAlign(L)/\\|`//`\`|| /_(A30,N2r)|_(A150,N2m)`\_(A-90,N2L)
$dblAlign(R)/\\|`//`\`|| $dblAlign(M)/\\|`//`\`|| $dblAlign(L)/\\|`//`\`|| /_(A30,N2r)|_(A150,N2m)`\_(A-90,N2L)
The first formula coincides with the automatic version, because it indicates right alignment using $dblAlign(R).
The second formula contains middle aligned double bonds. So the formulas in easyChem looked like.
The third formula shows the left alignment.
And in the fourth formula, we see all three types of alignment. This is achieved not by $dblAlign functions, but by universal descriptions with parameters N2r, N2m and N2L, respectively.

And then you can see the use of the suffixes r, m and L in the parameter S (style).

_(A30,S:|r)_(A90,S:|r)_(A30,S:|r) _(A30,S:|m)_(A90,S:|m)_(A30,S:|m) _(A30,S:|L)_(A90,S:|L)_(A30,S:|L)
_(A30,S:|r)_(A90,S:|r)_(A30,S:|r) _(A30,S:|m)_(A90,S:|m)_(A30,S:|m) _(A30,S:|L)_(A90,S:|L)_(A30,S:|L)


EasyChem introduced the $M function to specify the atomic mass for isotopes. For instance, $M(14)C$M(14)C or $M(235)U$M(235)U

Now the $nM function has been added, which also displays the atomic number.
$nM(14)C$nM(14)C or $nM(235)U$nM(235)U
Moreover, you do not need to indicate the atomic number, since the system already knows it for each element.


Now you can draw a circle around the charge by simply adding a small letter o:



Hydrates, solvates and adducts

In early versions, * had to be separated by a space from the description of the molecule. This limitation made it impossible to describe hydrates as a single reagent, which sometimes created some problems.
Now * can be used without spaces:

CuSO4*5H2O LiCl*4CH3OH K2O*Al2O3*'x'SiO2*'у'H2O
CuSO4*5H2O LiCl*4CH3OH K2O*Al2O3*'x'SiO2*'у'H2O

Alignment of reagents in height

Sometimes you need to use structural formulas in your equations. In this case, it is desirable that the reagents are correctly aligned in height. Quite often, a built-in algorithm can do this automatically. For example, everything looks good here.

2H\N<`/H>_(A0)H + $slope(45)H-O\S/O`/\O`\`/O`-H -> (NH4)2SO4

But this is not always the case. For example, if you rotate the first reagent a little, the appearance will become worse.

2H/N<`|H>\H + $slope(45)H-O\S/O`/\O`\`/O`-H -> (NH4)2SO4

This is due to the fact that the automatic search for the central axis takes into account the number of nodes at the same height. Here, the two lower hydrogen atoms are on the same line. Therefore, the alignment happened to the bottom of the formula. It looks ugly. Therefore, using the construction $C() you can explicitly specify the node on which the centering will be performed.

2H/$C()$atomColor1(blue)N<`|H>\H + $slope(45)H-O\S/O`/\O`\`/O`-H -> (NH4)2SO4
2H/$C()N<`|H>\H + $slope(45)H-O\S/O`/\O`\`/O`-H -> (NH4)2SO4

Here, constructing a $C() in front of the nitrogen atom has helped significantly improve the appearance. But you can use several such constructs in one formula. In this case, the average value is calculated for them. For example, you can center the bottom and top of the formula node.

2$C()$atomColor1(blue)H/N<`|$C()$atomColor1(blue)H>\H + $slope(45)H-O\S/O`/\O`\`/O`-H -> (NH4)2SO4
2$C()H/N<`|$C()H>\H + $slope(45)H-O\S/O`/\O`\`/O`-H -> (NH4)2SO4