> For the complete documentation index, see [llms.txt](https://docs.labii.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.labii.com/widgets/column-widgets/chemistry.md).

# Chemistry

## Overview

Below is a list of chemical-related column widgets.

* [Chemical structure](#chemical-structure) - Display chemical structure from a chemical drawing section
* [SMILES structure](#smiles-structure) - Display chemical structure from SMILES
* Molecular formula
* Image

## Chemical Structure

Use this widget to display the chemical structure from a chemical drawing section. The widget cannot create or draw chemical structures; it can only display chemical structures from chemical drawing sections.

**Readonly view:**

<img src="/files/COE3lIIusEvKwk79kzJs" alt="" data-size="original">

**Edit view:**

<img src="/files/NOxem13v78ZGmQw6oLsE" alt="" data-size="original">

**Form view:**

Not supported

**Configuration**

![](/files/mwbUpnkfVRoDXlU4tv8M)

```json
{
    "should_auto_update": false, # (optional), default to false. 
    # If true, the widget will perform live calculation
    # If false, the user have to click reload to update the value
    "should_auto_update_when_empty": true, # (optional), default to true. 
    # If true, the widget will perform live calculation when the data is empty
    # If false, the results will not be calculated on default
}
```

**Import value:**

Not supported

## SMILES Structure

This widget uses [Smiles Drawer](https://github.com/reymond-group/smilesDrawer#readme) to draw the chemical structure from SMILES.

**Readonly view:**

<img src="/files/K2Se6NprG82bjVvpQfBI" alt="" data-size="original">

Click the 'Generate SMILES' button to create molecular weight based on the chemical name.

**Edit view:**

<img src="/files/Uws6Fi3c7eLRXvO5Z84m" alt="" data-size="original">

**Form view:**

Same as the edit view.

**Configuration:**

Not supported

**Import value:**

SMILES string.

## Molecular Formula

This widget can:

1. Generate molecular formula from the name
2. Generate molecular weight
3. Generate SMILES (Simplified molecular-input line-entry system)
4. Generate molecular structure

This widget requires the creation of these columns before it can be used. By default, these columns are created automatically in the chemical table.

* molecular\_weight
* SMILES
* molecular\_structure

> Some function of [chemcalc](https://www.npmjs.com/package/chemcalc) is used for this widget.
>
> ChemCalc: a building block for tomorrow’s chemical infrastructure. Patiny, Luc; Borel, Alain Journal of Chemical Information and Modeling 2013. DOI:10.1021/ci300563h

Click the **Generate formula** button to get the molecular formula directly from the name. You can also click **Edit** button to enter the molecular formula manually.

**Edit view:**

![](/files/QYGqz5PBPEcmHQxr9tiJ)

**Readonly view:**

Click the **Generate data** button to generate the molecular weight, SMILES, and molecular structure.

![](/files/Co6hgZjiA2gaB35YeUKV)

**Form view:**

Same as the edit view

**Configuration**:

![](/files/WDL856rBEs2YAllITPTQ)

```json
{
    "should_use_mw": false, # optional, if false, nominal mass will be used.
    "molecular_weight": {"sid":"xxx", "name":"xxx"},
    "SMILES": {"sid":"xxx", "name":"xxx"},
    "molecular_structure": {"sid":"xxx", "name":"xxx"}
}
```

**Import value:**

Formula string.
