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
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
Programming of a spanning tree algorithm with Python : In depth first with a root node.

ST Algorithm Programming of a spanning tree algorithm with Python : In depth first with a root node. Description This programm reads informations abou

Mathieu Lamon 1 Dec 16, 2021
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
An command-line utility that schedules your exams preparation routines

studyplan A tiny utility that schedules your exams preparation routines. You only need to specify the tasks and the deadline. App will output a iCal f

Ilya Breitburg 3 May 18, 2022
One-Stop Destination for codes of all Data Structures & Algorithms

CodingSimplified_GK This repository is aimed at creating a One stop Destination of codes of all Data structures and Algorithms along with basic explai

Geetika Kaushik 21 Sep 26, 2022
A JSON-friendly data structure which allows both object attributes and dictionary keys and values to be used simultaneously and interchangeably.

A JSON-friendly data structure which allows both object attributes and dictionary keys and values to be used simultaneously and interchangeably.

Peter F 93 Dec 01, 2022
Webtesting for course Data Structures & Algorithms

Selenium job to automate queries to check last posts of Module Data Structures & Algorithms Web-testing for course Data Structures & Algorithms Struct

1 Dec 15, 2021
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
A mutable set that remembers the order of its entries. One of Python's missing data types.

An OrderedSet is a mutable data structure that is a hybrid of a list and a set. It remembers the order of its entries, and every entry has an index number that can be looked up.

Elia Robyn Lake (Robyn Speer) 173 Nov 28, 2022
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
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
Multidict is dict-like collection of key-value pairs where key might be occurred more than once in the container.

multidict Multidict is dict-like collection of key-value pairs where key might be occurred more than once in the container. Introduction HTTP Headers

aio-libs 325 Dec 27, 2022
RLStructures is a library to facilitate the implementation of new reinforcement learning algorithms.

RLStructures is a lightweight Python library that provides simple APIs as well as data structures that make as few assumptions as possibl

Facebook Research 262 Nov 18, 2022
Python Data Structures and Algorithms

No non-sense and no BS repo for how data structure code should be in Python - simple and elegant.

Prabhu Pant 1.9k Jan 08, 2023
Python tree data library

Links Documentation PyPI GitHub Changelog Issues Contributors If you enjoy anytree Getting started Usage is simple. Construction from anytree impo

776 Dec 28, 2022
Final Project for Practical Python Programming and Algorithms for Data Analysis

Final Project for Practical Python Programming and Algorithms for Data Analysis (PHW2781L, Summer 2020) Redlining, Race-Exclusive Deed Restriction Lan

Aislyn Schalck 1 Jan 27, 2022
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 a compilation of important Data Structures and Algorithms based on Python.

Python DSA 🐍 This repository is a compilation of important Data Structures and Algorithms based on Python. Please make seperate folders for different

Bhavya Verma 27 Oct 29, 2022
This repository contains code for CTF platform.

CTF-platform Repository for backend of CTF hosting website For starting the project first time : Clone the repo in which you have to work in your syst

Yash Jain 3 Feb 18, 2022
🔬 Fixed struct serialization system, using Python 3.9 annotated type hints

py-struct Fixed-size struct serialization, using Python 3.9 annotated type hints This was originally uploaded as a Gist because it's not intended as a

Alba Mendez 4 Jan 14, 2022