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)


$M(14)C$M(14)C или $M(235)U$M(235)U

Теперь добавилась функция $nM, которая выводит ещё и атомный номер.
$nM(14)C$nM(14)C или $nM(235)U$nM(235)U
Причём, указывать атомный номер не нужно, т.к. системе он и так известен для каждого элемента.


Появилась возможность вывести окружность вокруг заряда простым добавлением маленькой буквы o:



Гидраты, сольваты и аддукты

В ранних версиях знак * должен был отделяться пробелом от описания молекулы. Такое ограничение не позволяло описать гидраты в виде одного реагента, что иногда создавало некоторые проблемы.
Теперь знак * можно использовать без пробелов:

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