Chemical Structure Generator

Overview

CSG: Chemical Structure Generator

CSG Demo

A simple Chemical Structure Generator.

Requirements

  • Python 3 (>= v3.8)
  • PyQt5 (optional; >= v5.15.0 required for graphical front-end)
  • Matplotlib (>= v3.3.1)

Install Dependencies

Change to the source directory and type the following command:

pip install -r requirements.txt

Workaround for macOS Big Sur on the Apple M1 chip

The required version of PyQt5 cannot be installed using pip on M1 MacBooks (tested on the MacBook Air) as of the time of writing. A workaround for this is as follows:

  • Make sure you have installed Homebrew.

  • Run the following commands for PyQt5 v5.15.4 running on Python 3.9 (replace versions in the command appropriately):

    brew install pyqt5
    mv /opt/homebrew/Cellar/[email protected]/5.15.4_2/lib/python3.9/site-packages/* /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/
    
  • Install matplotlib using pip:

    pip3 install matplotlib
    
  • Run CSG:

    ./csg.py
    

Usage

Usage: csg.py [OPTION]
    Generate simple chemical structures.

Options:
    --cli           Run in the terminal
    --help,   -h    Show this help message and exit
    --version -V    Show version information and exit

License

Copyright © 2020-2021 Jithin Renji, Kannan MD, Pranav Pujar

CSG is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

CSG is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with CSG. If not, see https://www.gnu.org/licenses/.

Comments
  • Polishing of CSG

    Polishing of CSG

    New Features:

    • matplotlib background color customization based on user preferred theme

    • 2 legends: to indicate bond order and to identify individual atoms

    • matplotlib figures are now custom-named

    • bond order now has a color scheme

    • bug fixes: Cl2O, NO, ClF3, FCl3, group 1 element bond order issues, etc... SF6 DARK SF6 LIGHT

    opened by PranavPujar 1
  • Completed geometry.db. Added functionality for atomic sizes and colors.

    Completed geometry.db. Added functionality for atomic sizes and colors.

    What's new...

    • _self._atomic_colors taken from mogli

    • Added some halogens to oxidn_states and _self._atomic_numbers.

    • get_markersize() and get_markercolor() are for passing into the color parameter c of ax.plot() while rendering.

    • Opacity values can be appended into the rgb list under get_markercolor() but seems pointless for now as it cannot make the colors deeper.

    Some other misc stuff we can do:

    • [ ] provide example compounds to the user

    • [ ] deepen the atom colors a bit (they're pretty light now for some reason)

    • [ ] annotate all atoms of the rendered compound (I have currently commented out that portion, as it gets overlapped when rendering bigger atoms

    Bugs remaining (at least those that have come to light):

    Al2O3 gets classified as AB2 type oxygen halides polyhalogen compounds (eg: ClF3) nitrogen monoxide

    opened by PranavPujar 1
  • Corrected the lone pair function.

    Corrected the lone pair function.

    just minor changes were only required. it was my dumb thing i had to change only 1 thing. N i removed bp function. bp was not showing correct value so without that itself it works..

    bugfix 
    opened by K-A-N-N-A-N 1
  • Added functions classify_geometry() and gdict_to_str()

    Added functions classify_geometry() and gdict_to_str()

    classify_geometry(): Classifies the geometry of a compound, given element_dict (like in get_elements(); see get_elements()) and number of lone pairs lp (see get_lp()).

    Example return value:
    	{'A': 1, 'B': 2, 'L': 0}
    

    gdict_to_str(): Converts a 'geometry dictionary' (like above) to string.

    Example return value:
    	(same example as above)
    	"AB2"
    

    See source for more information.

    feature 
    opened by jithin-renji 1
  • Added new function get_lp(). Also added periodic table.

    Added new function get_lp(). Also added periodic table.

    I have added the lp function but when group 8 elements like Xe is added its showing invalid so we have to figure that out.. i dont think that its the lp def cause the def starts if the input is valid only. And i have also added period table grp1,2 ,13,14...18. it included valency,valence e and all the elements. i have to add transition elements also but that needs some extra things as nothing is common. N i have not added any cmments in the program i forgot about it so ill add the comments today or i can explain it to u guys if u dont understand the nxt time we meet. n the def is kinda really long and i hav tried my max to reduce it but there were no other way. if u can reduce the size n make it easier then pls do tell.

    feature 
    opened by K-A-N-N-A-N 1
  • Added PeriodicTable class to simplify `get_lp()`

    Added PeriodicTable class to simplify `get_lp()`

    The PeriodicTable class has methods to calculate valencies, valence electrons, etc. given an initialized instance of a PeriodicTable. This has considerably reduced the length of get_lp() and has drastically improved readability.

    refactor 
    opened by jithin-renji 0
  • Add `get_elements()`

    Add `get_elements()`

    The get_elements() function takes a string as argument. This string must be a chemical formula for a compound. After processing the string, the function returns a dictionary of elements with their corresponding "numbers". For example: get_elements("H2O") will return {'H': 2, 'O': 1}

    feature 
    opened by jithin-renji 0
Releases(v0.1-alpha.3)
  • v0.1-alpha.3(Aug 29, 2020)

    CSG v0.1-alpha.3

    What's new:

    • Different colored bonds with varying thicknesses for different bond orders.
    • A legend to convey information about the different colors used.
    • The chemical structure window now shows the chemical formula and its geometry in its title. Legend
    • The chemical structure window respects the dark/light theme setting. Dark Theme Light Theme
    • UI tweaks.
    • Bug fixes.
    Source code(tar.gz)
    Source code(zip)
  • v0.1-alpha.2(Aug 23, 2020)

  • v0.1-alpha.1(Aug 23, 2020)

    CSG v0.1-alpha.1

    • CSG can now generate structures from the command-line, making PyQt5 an optional dependency (Matplotlib is still required).
    Source code(tar.gz)
    Source code(zip)
  • v0.1-alpha(Aug 22, 2020)

    CSG v0.1-alpha

    • Can generate simple chemical structures with geometries ranging from AB to AB6, and AB2L to AB5L in 3D space.
    • For now, the input compound must contain only 2 distinct elements, and must contain only 1 central atom.
    Source code(tar.gz)
    Source code(zip)
Owner
JP&K
JP&K
Map single-cell transcriptomes to copy number evolutionary trees.

Map single-cell transcriptomes to copy number evolutionary trees. Check out the tutorial for more information. Installation $ pip install scatrex SCA

Computational Biology Group (CBG) 12 Jan 01, 2023
This repository is for adding codes of data structures and algorithms, leetCode, hackerrank etc solutions in different languages

DSA-Code-Snippet This repository is for adding codes of data structures and algorithms, leetCode, hackerrank etc solutions in different languages Cont

DSCSRMNCR 3 Oct 22, 2021
Python collections that are backended by sqlite3 DB and are compatible with the built-in collections

sqlitecollections Python collections that are backended by sqlite3 DB and are compatible with the built-in collections Installation $ pip install git+

Takeshi OSOEKAWA 11 Feb 03, 2022
Google, Facebook, Amazon, Microsoft, Netflix tech interview questions

Algorithm and Data Structures Interview Questions HackerRank | Practice, Tutorials & Interview Preparation Solutions This repository consists of solut

Quan Le 8 Oct 04, 2022
A HDF5-based python pickle replacement

Hickle Hickle is an HDF5 based clone of pickle, with a twist: instead of serializing to a pickle file, Hickle dumps to an HDF5 file (Hierarchical Data

Danny Price 450 Dec 21, 2022
Array is a functional mutable sequence inheriting from Python's built-in list.

funct.Array Array is a functional mutable sequence inheriting from Python's built-in list. Array provides 100+ higher-order methods and more functiona

182 Nov 21, 2022
This repo is all about different data structures and algorithms..

Data Structure and Algorithm : Want to learn data strutrues and algorithms ??? Then Stop thinking more and start to learn today. This repo will help y

Priyanka Kothari 7 Jul 10, 2022
Python library for doing things with Grid-like structures

gridthings Python library for doing things with Grid-like structures Development This project uses poetry for dependency management, pre-commit for li

Matt Kafonek 2 Dec 21, 2021
Data Structures and algorithms package implementation

Documentation Simple and Easy Package --This is package for enabling basic linear and non-linear data structures and algos-- Data Structures Array Sta

1 Oct 30, 2021
Basic sort and search algorithms written in python.

Basic sort and search algorithms written in python. These were all developed as part of my Computer Science course to demonstrate understanding so they aren't 100% efficent

Ben Jones 0 Dec 14, 2022
A Python dictionary implementation designed to act as an in-memory cache for FaaS environments

faas-cache-dict A Python dictionary implementation designed to act as an in-memory cache for FaaS environments. Formally you would describe this a mem

Juan 3 Dec 13, 2022
A Python implementation of red-black trees

Python red-black trees A Python implementation of red-black trees. This code was originally copied from programiz.com, but I have made a few tweaks to

Emily Dolson 7 Oct 20, 2022
nocasedict - A case-insensitive ordered dictionary for Python

nocasedict - A case-insensitive ordered dictionary for Python Overview Class NocaseDict is a case-insensitive ordered dictionary that preserves the or

PyWBEM Projects 2 Dec 12, 2021
A Munch is a Python dictionary that provides attribute-style access (a la JavaScript objects).

munch munch is a fork of David Schoonover's Bunch package, providing similar functionality. 99% of the work was done by him, and the fork was made mai

Infinidat Ltd. 643 Jan 07, 2023
Solutions for leetcode problems.

Leetcode-solution This is an repository for storring new algorithms that I am learning form the LeetCode for future use. Implemetations Two Sum (pytho

Shrutika Borkute 1 Jan 09, 2022
schemasheets - structuring your data using spreadsheets

schemasheets - structuring your data using spreadsheets Create a data dictionary / schema for your data using simple spreadsheets - no coding required

Linked data Modeling Language 23 Dec 01, 2022
A DSA repository but everything is in python.

DSA Status Contents A: Mathematics B: Bit Magic C: Recursion D: Arrays E: Searching F: Sorting G: Matrix H: Hashing I: String J: Linked List K: Stack

Shubhashish Dixit 63 Dec 23, 2022
Al-Quran dengan Terjemahan Indonesia

Al-Quran Rofi Al-Quran dengan Terjemahan / Tafsir Jalalayn Instalasi Al-Quran Rofi untuk Archlinux untuk pengguna distro Archlinux dengan paket manage

Nestero 4 Dec 20, 2021
Simple spill-to-disk dictionary

Chest A dictionary that spills to disk. Chest acts likes a dictionary but it can write its contents to disk. This is useful in the following two occas

Blaze 59 Dec 19, 2022
Leetcode solutions - All algorithms implemented in Python 3 (for education)

Leetcode solutions - All algorithms implemented in Python 3 (for education)

Vineet Dhaimodker 3 Oct 21, 2022