본문 바로가기
현장과 프로젝트/pyroDB

pyroDB - Energetic Materials Database

by 도서관경비원 2026. 6. 5.
반응형

Overview

pyroDB is a desktop GUI application designed to explore thermodynamic and physicochemical property data for energetic materials such as explosives, propellants, and oxidizers. It uses Python's standard library tkinter as its UI framework. Its most distinctive feature is that all data is embedded directly in the source code, with no external database files required. The codebase is organized into four core layers: data processing logic, UI construction, search engine, and detail rendering.

 

1. Embedded Database Structure

The TDB database, originally in .mdb format (Microsoft Access Database), has been converted to JSON and incorporated directly into the source code. The MDBParser class is responsible for parsing this JSON data and loading it into memory. Each substance uses a unique ID as its key and stores its English and German names, molecular weight (MW), oxygen balance (OB), elemental composition, physical state, classification code, and a dictionary of numerous property data entries (props).

 

Data loading is handled asynchronously in a separate thread to maintain UI responsiveness, with progress displayed to the user in real time via a progress bar.

 

2. Molecular Formula Reverse-Inference Algorithm

The most sophisticated algorithmic component is the der function. The database often stores only the list of element types present in a substance, without the count of each element. This function uses a depth-first search (DFS) constrained by molecular weight and oxygen balance to back-calculate integer element counts.

 

For CHNO (carbon, hydrogen, nitrogen, oxygen) compounds, isomers sharing the same molecular weight may exist. To distinguish, for example, TNT (C₇H₅N₃O₆) from another compound with the same molecular weight, the optimal solution is selected using a composite scoring method based on the oxygen balance formula OB% = 1600/Mw × (nO − 2nC − nH/2). This algorithm enables the application to automatically display molecular formulas in subscript notation, such as C₇H₅N₃O₆.

 

3. Property Code Parsing and Classification System

Property data is stored as composite code strings such as "SCHM-50.(-90.)RP". Regular expressions are used to parse these into three components: a base code (SCHM), remarks, and a source reference (RP).

 

A dictionary maps dozens of base codes to human-readable descriptions and units — for example, melting point (SCHM), boiling point (SIED), enthalpy of formation (ENTH), density (DICH), and heat of combustion (VBW). Source abbreviations are resolved into full reference names such as "Kaye & Laby", "Experimental", and "ICT Report".

 

4. GUI Structure and Detail Rendering

The pyroDB class inherits from tk.Tk and forms the backbone of the entire application. The UI is organized as a left-right split (PanedWindow): the left panel contains the search bar and results list, while the right panel displays detailed information for the selected substance.

 

Search supports four modes — prefix match, substring match, elemental composition, and property code — with real-time filtering implemented via debouncing that triggers 280 ms after input.

 

The detail panel is organized as cards: ① a substance name card (including English and German names), ② an overview (molecular formula, molecular weight, oxygen balance, state, and classification), ③ a property table (melting point, density, etc.), ④ an enthalpy of formation table (with automatic unit conversion across kJ/mol, kcal/mol, and kcal/kg), and ⑤ a formation energy table (enthalpy minus a correction value). A theme color palette is managed as variables to maintain a consistent visual style throughout.

 

5. Summary

This codebase is a self-contained desktop tool for professional energetic materials research, designed to make complex chemical data explorable through an intuitive GUI. Its practical deployment strategy stands out: the entire application runs from a single Python script with no external file dependencies.

반응형