Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cgsmiles-1.0.2.tar.gz (792.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cgsmiles-1.0.2-py2.py3-none-any.whl (67.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file cgsmiles-1.0.2.tar.gz.

File metadata

  • Download URL: cgsmiles-1.0.2.tar.gz
  • Upload date:
  • Size: 792.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cgsmiles-1.0.2.tar.gz
Algorithm Hash digest
SHA256 d74a21b5c54139d980ff457946b99a56364294cad46bf6147c0d166a67dfafca
MD5 2788472484cb3b71536b5a873d7cf389
BLAKE2b-256 e6e9148a8b26d4f90ef7c6874e8194baf80256dc4cb18b6034bb827166c21a40

See more details on using hashes here.

File details

Details for the file cgsmiles-1.0.2-py2.py3-none-any.whl.

File metadata

  • Download URL: cgsmiles-1.0.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 67.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cgsmiles-1.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bee5066a7017d06729846fda0f7d70964115f7f9c402649091ebc3ca59edd789
MD5 bf803275c5cf6c1726b1fc59aa09da5b
BLAKE2b-256 d46f8f08aea87d0868f53bfb718009350c5ad2ef698f3af4db6c9d86f46b0a6c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page