No project description provided
Project description
================================ Coarse-Grained SMILES (CGsmiles)
Overview
The CGSmiles line notation encodes arbitrary resolutions of molecules and
defines the conversion between these resolutions unambiguously. For example,
in coarse-grained (CG) simulations multiple atoms are represented as one large
pseudo-atom often called bead. The conversion from the atomic resolution to
the CG resolution can be described using the CGSmiles notation. In the
Martini 3 force field <https://cgmartini.nl>__, Benzene is represented
as three particles. The CGSmiles string would be:
.. code::
"{[#TC5]1[#TC5][#TC5]1}.{#TC5=[$]cc[$]}"
Additionally, multiple resolutions may be layered together so that a hierarchical
description between one or more CG resolutions becomes possible. Especially,
expressing large polymeric molecules becomes simpler when using multiple
resolutions. For instance consider the copolymer
Styrene-Maleic Acid <https://en.wikipedia.org/wiki/Styrene_maleic_anhydride>__.
It is an almost perfectly alternating polymer of maleic anhydride and styrene.
In CGSmiles, we can thus write 100 repeat units of this polymer by using three
resolutions each contained in curly braces:
.. code::
"{[#SMA]|100}.{#SMA=[#PS][#MAH]}.{#PS=[>]CC[<]c1ccccc1,#MHA=[<]C1C(=O)CC(=O)C1[>]}"
The CGSmiles Python package is created around this notation to read, write, and
further process the resulting graphs. Reading and resolving provides the all the
molecule information in form of NetworkX graphs <https://networkx.org>__,
providing an easy way to interface with other python libraries.
There are a number of other packages and libraries, which use CGSmiles. They are mostly used for coarse-grained modelling with the Martini force field or atomic resolution molecular dynamics simulations. More informtion about the syntax and the different use cases can be found in this documentation. If you are here from one of the packages using CGSmiles check out the GettingStarted section to learn the syntax.
Installation
The easiest ways to install cgsmiles is using pip:
.. code:: bash
pip install git+https://github.com/gruenewald-lab/CGsmiles.git
In the future we will also distribute it through the Pypi
package index but that is currently not supported. Note that the drawing module
depends on the scipy <https://scipy.org>__ and matplotlib <https://matplotlib.org>__
packages. These need to be installed before the module can be used.
.. code:: bash
pip install scipy pip install matplotlib
Examples
The CGSmiles python package is designed to read and resolve these smiles into networkx graphs that can be used for further tasks, for example drawing the relation between two resolutions (i.e. the mapping).
Martini 3 Benzene
.. code:: python
import cgsmiles
from cgsmiles.drawing import draw_molecule
# Martini 3 Benzene
cgsmiles_str = "{[#TC5]1[#TC5][#TC5]1}.{#TC5=[$]cc[$]}"
# Resolve molecule into networkx graphs
res_graph, mol_graph = cgsmiles.MoleculeResolver.from_string(cgsmiles_str).resolve()
# Draw molecule at different resolutions
ax, pos = draw_molecule(mol_graph)
Related Tools
-
pysmiles <https://github.com/pckroon/pysmiles>__: Lightweight python library for reading and writing SMILES. CGSmiles runs pysmiles in the background for interpreting atomic resolution fragments. -
polyply <https://github.com/marrink-lab/polyply_1.0>__: Generate topology files and coordinates for molecular dynamics (MD) from CGSmiles notation. It takes CGSmiles as input to generate all-atom or coarse-grained topologies and input parameters. -
fast_forward <https://github.com/fgrunewald/fast_forward>__: Forward map molecular dynamics trajectories from a high to lower resolution using CGSmiles.
Citation
When using cgsmiles for your publication, please cite:
.. code::
@article{Grunewald2025CGsmiles,
title={CGsmiles: A Versatile Line Notation for Molecular Representations across Multiple Resolutions},
author={Gr{\"u}newald, Fabian and Seute, Leif and Alessandri, Riccardo and K{\"o}nig, Melanie and Kroon, Peter C},
journal={Journal of Chemical Information and Modeling},
year={2025},
doi={https://doi.org/10.1021/acs.jcim.5c00064},
publisher={ACS Publications}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cgsmiles-1.0.1.tar.gz.
File metadata
- Download URL: cgsmiles-1.0.1.tar.gz
- Upload date:
- Size: 791.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e265f2cbc87e7a406817606c993c14e8c8d530426b39b20eec0a2aff9b593d22
|
|
| MD5 |
0e89d0fb8e1077a7d34957e73544a3e2
|
|
| BLAKE2b-256 |
7fe2d00441b556eb9bff15b807922c31810711e65dd11516b1ef973290a03e4f
|
File details
Details for the file cgsmiles-1.0.1-py2.py3-none-any.whl.
File metadata
- Download URL: cgsmiles-1.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 66.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
211d3d91f04d5349191061a780514038d096177ade43ab6a0c3a96c3179686f0
|
|
| MD5 |
1e573e2054d2f1bdc987bab911a7f5cf
|
|
| BLAKE2b-256 |
e7cbeab5d448d73186670b482fb8a7f96a98934c9a7db1a82ff8db3e4786148f
|