<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Dagger Shoe</title>
    <description>The latest articles on DEV Community by Dagger Shoe (@dagger_shoe).</description>
    <link>https://dev.to/dagger_shoe</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3995331%2Fa66fcc45-d9f4-4976-87a3-40b3924baae7.png</url>
      <title>DEV Community: Dagger Shoe</title>
      <link>https://dev.to/dagger_shoe</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dagger_shoe"/>
    <language>en</language>
    <item>
      <title>I Don't Know Chemistry, But I'm Building a Chemical Namer Anyway</title>
      <dc:creator>Dagger Shoe</dc:creator>
      <pubDate>Sun, 21 Jun 2026 14:45:27 +0000</pubDate>
      <link>https://dev.to/dagger_shoe/i-dont-know-chemistry-but-im-building-a-chemical-namer-anyway-1h0g</link>
      <guid>https://dev.to/dagger_shoe/i-dont-know-chemistry-but-im-building-a-chemical-namer-anyway-1h0g</guid>
      <description>&lt;h2&gt;
  
  
  Whats all this about?
&lt;/h2&gt;

&lt;p&gt;If you told me from the start that in order to make an actually viable IUPAC naming python library, I would have to read pages upon pages of the a dense, chemistry-jargon filled document called the &lt;strong&gt;Blue Book&lt;/strong&gt;, I would have screamed. However, nothing ventured nothing gained, and while I'm sure there is a library for this somewhere out there, wheres the fun in that? &lt;/p&gt;

&lt;p&gt;While I have made a decent chunk of progress on it already, It recently clicked that instead of screaming about my changes into the endless abyss that is a git commit, why not blog about it!&lt;/p&gt;

&lt;p&gt;The entire process has taken me through a journey of chemistry, which actually made me enjoy the subject a lot more than in my high school days. With that said, welcome to my summer project, i.e. &lt;a href="https://github.com/DaggBoot/IUPACker" rel="noopener noreferrer"&gt;IUPACker.&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  The journey so far.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Part 1: Hubris.
&lt;/h3&gt;

&lt;p&gt;Initially, I made the most foolish mistake. I decided that instead of sticking to well known and well used methods of expressing chemical formulae through text, &lt;em&gt;why not just make one up from scratch?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Needless to say, this had the expected disastrous consequence of me being unable to handle every edge case that comes with the world of chemical molecules. That's not even mentioning the fact that I worked off of the assumption that people would just simply adapt to my standard... an assumption that was a tad too optimistic.&lt;/p&gt;

&lt;p&gt;In trying to make it simple, I made the process too complex for a single person. Thus, I decided to stick with taking inputs for chemical formula &lt;strong&gt;ONLY&lt;/strong&gt; in the standard SMILES format. Which meant rewriting all of my code... but it was a required sacrifice.&lt;/p&gt;

&lt;h3&gt;
  
  
  Part 2: No smiles with SMILES.
&lt;/h3&gt;

&lt;p&gt;SMILES was actually a really satisfying system, which had a lot of interesting built in assumptions, and managed to express chemical formula using a regular grammar &lt;em&gt;(which is very cool)&lt;/em&gt;. I converted from a SMILES formula to a Molecule Graph object.&lt;/p&gt;

&lt;p&gt;The first step was to create the relevant classes. Those being:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;_Element:&lt;/strong&gt; Stores chemical data (symbol, valence, etc.) for each element.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Atom:&lt;/strong&gt; Represents an atom in the graph (element, bonds, charge, aromaticity, etc).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Molecule:&lt;/strong&gt; Container for atoms; manages graph operations and validation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SMILESParser:&lt;/strong&gt; Parses SMILES strings into Molecule objects.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For now, I manually made a simple periodic table, though I will have to later implement an _Element method to scrap data from a formal periodic table.&lt;/p&gt;

&lt;p&gt;The idea is simple, take the SMILES formula string, split it into a list of ordered tokens (the tokens being bracketed atoms, aliphatic and aromatic atoms, charge, bond order, branches and ring locators). Then parse these tokens individually, creating Atom vertices to store within the Molecule graph object, with edges between atoms representing bonds.&lt;/p&gt;

&lt;p&gt;After handling the cases, it works well! For example, take&lt;/p&gt;

&lt;p&gt;&lt;code&gt;"C1CCC1C=[CH2+]"&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;which gets converted into&lt;/p&gt;

&lt;p&gt;&lt;code&gt;["C","1","C","C","C","1","C","=","[CH2+]"]&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;which can then be parsed element by atom. The numbers help denote which atoms connect back to each other, the "=" indicates a need for a bond order of 2 not the default of 1, and finally "[CH2+]" is parsed separately, with its charge and unorthodox hydrogen count stored in the Atom object representing C.&lt;/p&gt;

&lt;p&gt;This portion does still have a bit of missing functionality, which will be added later as it handles more edge cases within chemical formulae, and I'd rather get a MVP running first!&lt;/p&gt;

&lt;h3&gt;
  
  
  Part 3: Validation, the bane of errors.
&lt;/h3&gt;

&lt;p&gt;Of course, all my code so far assumed the user knows what they're doing. A naive and &lt;strong&gt;absolutely false&lt;/strong&gt; assumption. &lt;/p&gt;

&lt;p&gt;Thus, validation! This portion is very simple for now, and likely won't gain too much complexity in the future. All I do now is before parsing a SMILES, ensure all brackets, parenthesis and ring numbers are balanced. Then, once the molecule is built, a quick run through every atom in the molecule to make sure that the degree of each atom is under the maximum number of possible bonds (valences), raising an error otherwise.&lt;/p&gt;

&lt;p&gt;All in all, my validation (usually) runs in linear time, under the number of atoms in the molecule. I will have to change it later to adapt for atoms with varying valences though!&lt;/p&gt;

&lt;h3&gt;
  
  
  Part 4: IUPACker, where we are now.
&lt;/h3&gt;

&lt;p&gt;And now your mostly caught up! While I did skip quite a few technical details, this post was meant to be more of an overview of the work so far. Thus I thought it best to give you a simple breakdown, though if you'd like to get the juicy juicy details, just read the doc-strings for each function in the git repository!&lt;/p&gt;

&lt;p&gt;Currently, I've built the skeleton for the IUPACker, the module in charge of naming a chemical formulae as per the IUPAC Blue Book rules. Stay tuned for my next post, which details the general plan for that system!&lt;/p&gt;




&lt;h2&gt;
  
  
  What's Next?
&lt;/h2&gt;

&lt;p&gt;The IUPACker is where things get interesting. I'll be implementing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Functional group detection&lt;/strong&gt; – finding alcohols, acids, aldehydes, etc.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Parent chain identification&lt;/strong&gt; – finding the longest chain containing the principal group&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Substituent handling&lt;/strong&gt; – identifying and naming branches&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Numbering&lt;/strong&gt; – assigning lowest possible locants&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Name assembly&lt;/strong&gt; – combining prefixes, suffixes, and locants&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's going to be a wild ride. See you in the next post!&lt;/p&gt;




&lt;p&gt;*P.S. If you want to follow along, the code is on &lt;a href="https://github.com/DaggBoot/IUPACker" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;. Star it if you're feeling generous!&lt;/p&gt;

</description>
      <category>python</category>
      <category>opensource</category>
      <category>showdev</category>
      <category>iupacker</category>
    </item>
  </channel>
</rss>
