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
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
A collection of data structures and algorithms I'm writing while learning

Data Structures and Algorithms: This is a collection of data structures and algorithms that I write while learning the subject Stack: stack.py A stack

Dhravya Shah 1 Jan 09, 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
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
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
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
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
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
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
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
A Python library for electronic structure pre/post-processing

PyProcar PyProcar is a robust, open-source Python library used for pre- and post-processing of the electronic structure data coming from DFT calculati

Romero Group 124 Dec 07, 2022
Decided to include my solutions for leetcode problems.

LeetCode_Solutions Decided to include my solutions for leetcode problems. LeetCode # 1 TwoSum First leetcode problem and it was kind of a struggle. Th

DandaIT04 0 Jan 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
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
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
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
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
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
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
Common sorting algorithims in Python

This a Github Repository with code for my attempts for commonly used sorting algorithims, tested on a list with 3000 randomly generated numbers.

Pratham Prasoon 14 Sep 02, 2021