You are browsing as a guest. Sign up (or log in) to start making projects!

2h 21m 6s logged

Good day, reader. I’m Lucky.

This is a third devlog on my project: VSEPR Predictor. If you aren’t sure of the project aims to do, feel free to read my first devlog; however, I will give you a brief summary. The project takes input a molecule, and then predicts the molecular geometry / shape of the molecule, as well as the electron-group geometry overall. It is built in python.

Pytest

As stated in my earlier log, I was tired of manually testing my project all of the time, and I wanted to use pytest. Therefore, I created 4 functions that have specific roles in my code. These four functions are the following: get_atoms_subscripts, get_central_atom, get_total_valence, and validate_formula– all of which take a molecule as input.
*Before I state the advancements I have made, I’d like to disclaim that the electron-group calculations are not yet finalized, as I have yet to account for double and single bonds. To target this problem, I have calculated formal charges, and I plan to tackle it next. I will not explain what formal charges are– for the sake of words– but if you want, you can search it up.

Functional Changes

  • Calculated electron groups note ^^^
  • Calculated formal charge before adding double or triple bonds
    -Listed terminal atoms (every atom but the central one)
  • Calculated Lone pairs note ^^^

Overall Function

This project, at its state at the moment of writing:

  • Counts Valence Electrons of the inputted molecule (mendeleev assist).
  • Accounts for charges on molecules and taking that into consideration while calculating Valence Electrons.
  • Error checks / parses the user’s input to only allow valid molecules.
  • Calculates electronegativities of constituent elements (using mendeleev) and determining the central atom of the molecule.
  • Parses the molecule to find its elements and subscripts.
  • And does the aforementioned (functional changes).
Struggles

I admit that the hardest part of this session was transforming my code to create functions instead of just a blob of code. As you can imagine, it became very frustrating when– when I started to convert the code into constituent functions– my code started to have errors: some that have come of before and some new. At one point, I told myself, “My old code works, why can’t I just use that!” Of course, this was just out of a fit of discouragement, but I went on. I included I screenshot of what the project does at this moment, below– using NH3 (ammonia) as an example.
Goodbye, thank you for reading. I hope you gained something, whether it be entertainment or knowledge.

0
23

Comments 0

No comments yet. Be the first!