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
IADS 2021-22 Algorithm and Data structure collection

A collection of algorithms and datastructures introduced during UoE's Introduction to Datastructures and Algorithms class.

Artemis Livingstone 20 Nov 07, 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
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
This Repository consists of my solutions in Python 3 to various problems in Data Structures and Algorithms

Problems and it's solutions. Problem solving, a great Speed comes with a good Accuracy. The more Accurate you can write code, the more Speed you will

SAMIR PAUL 1.3k Jan 01, 2023
Supporting information (calculation outputs, structures)

Supporting information (calculation outputs, structures)

Eric Berquist 2 Feb 02, 2022
This repo represents all we learned and are learning in Data Structure course.

DataStructure Journey This repo represents all we learned and are learning in Data Structure course which is based on CLRS book and is being taught by

Aprime Afr (Alireza Afroozi) 3 Jan 22, 2022
My solutions to the competitive programming problems on LeetCode, USACO, LintCode, etc.

This repository holds my solutions to the competitive programming problems on LeetCode, USACO, LintCode, CCC, UVa, SPOJ, and Codeforces. The LeetCode

Yu Shen 32 Sep 17, 2022
Data Structure With Python

Data-Structure-With-Python- Python programs also include in this repo Stack A stack is a linear data structure that stores items in a Last-In/First-Ou

Sumit Nautiyal 2 Jan 09, 2022
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
My notes on Data structure and Algos in golang implementation and python

My notes on DS and Algo Table of Contents Arrays LinkedList Trees Types of trees: Tree/Graph Traversal Algorithms Heap Priorty Queue Trie Graphs Graph

Chia Yong Kang 0 Feb 13, 2022
dict subclass with keylist/keypath support, normalized I/O operations (base64, csv, ini, json, pickle, plist, query-string, toml, xml, yaml) and many utilities.

python-benedict python-benedict is a dict subclass with keylist/keypath support, I/O shortcuts (base64, csv, ini, json, pickle, plist, query-string, t

Fabio Caccamo 799 Jan 09, 2023
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
Datastructures such as linked list, trees, graphs etc

datastructures datastructures such as linked list, trees, graphs etc Made a public repository for coding enthusiasts. Those who want to collaborate on

0 Dec 01, 2021
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
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
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
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
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
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
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