moleculeFromSmiles¶
- moleculeFromSmiles(smiles, set_bonds=False)¶
Convert a SMILES string to a molecule configuration.
- Parameters:
smiles (str) – The SMILES string to convert to a molecule.
set_bonds (bool) – Whether static bonds are set on the configuration. Default: False
- Returns:
The MoleculeConfiguration represented by the SMILES string.
- Return type:
Usage Examples¶
In this example a SMILES string for 4-methylbenzoic acid is converted into a molecule. This conversion is implemented in a custom workflow block. The SMILES string can be given as input to the block, allowing it to be easily re-used for other molecules. The molecule is then optimized with the OPLS-AA potential, and the total energy is calculated.
The workflow for the calculation can be downloaded here
with a corresponding python script moleculeFromSmiles_Example.py
.
Notes¶
This function converts a Simplified Molecular Input Line Entry System (SMILES) string to a molecule.
SMILES strings can be used to represent the essential atom and bonding information of molecules.
The SMILES string consists of the atomic symbols of non-hydrogen elements of the molecule arranged
in the order in which they are bonded together. Hydrogen atoms are assumed to complete the bond
number of each atom. In organic molecules, aromatic and aliphatic atoms can be distinguished by
using lower-case symbols for aromatic atoms and upper-case for aliphatic atoms. Double and triple
bonds can also be specified by placing a =
symbol for double bonds and a #
symbol for triple
bonds. Branches can be added by encasing each branch in parenthesis. Rings can also be created by
tagging the start and end atoms of the ring with an identifying number.
The moleculeFromSmiles()
function takes the SMILES string to be converted and an optional
boolean argument set_bonds
. Setting this to True
adds to the returned configuration the
bonds specified by the SMILES string. By default no bonds are added to the configuration.