Aluode's picture
Update README.md
7b1e394 verified

A newer version of the Streamlit SDK is available: 1.52.2

Upgrade
metadata
title: Neuromorphic Molecular Constraint Solver
emoji: 🧬
colorFrom: blue
colorTo: green
sdk: streamlit
sdk_version: 1.27.2
app_file: app.py
pinned: false

Neuromorphic Molecular Constraint Solver (Vibecoded by amateur, it is a mess)

This is a demonstration of a novel approach to de novo molecular generation. Instead of using a traditional generative model (like a VAE or GAN), this system translates chemical rules into a large Boolean Satisfiability (3-SAT) problem and solves it using a custom solver inspired by neuromorphic computing principles.

How it Works

The process involves two main stages:

  1. Encoding: User-defined chemical properties (molecular weight, number of aromatic rings, forbidden functional groups, minimum atom count) are compiled into a massive 3-SAT problem. This includes complex chemical intelligence like valence rules (e.g., Carbon must have 4 bonds) and graph connectivity, which are encoded using cardinality constraints.

  2. Solving: A memory-efficient, sparse solver inspired by P-KAS (Phase-Keyed Associative Storage) and Kuramoto oscillators finds a satisfying assignment for the tens of thousands of variables and clauses. This method finds a solution by relaxing into a stable state rather than through algorithmic search.

The key advantage is generation by construction. The output is guaranteed to satisfy the hard constraints, leading to a very high validity rate.

How to Use the Demo

  1. Use the sidebar on the left to set your desired molecular properties.
  2. Crucially, set a "Minimum atom count" greater than 0 to avoid trivial solutions like H₂O. A value of 10-15 is a good starting point.
  3. Click the "Generate Molecules" button.
  4. Be patient. The encoding and solving process for such a large constraint problem can take 10-30 seconds per molecule.

Limitations & Current Status

This is a proof of concept and has several important limitations:

  • Graph Generation, Not Full Chemistry: The solver's primary output is a structural graph of atoms and their connections. It does not yet solve for bond orders (single, double, triple).
  • Visualization: The RDKit visualizer assumes all bonds are SINGLE for drawing purposes. This means that even if the solver finds a valid graph where an atom has the correct number of bonds, the drawing may appear chemically incorrect (e.g., a Carbon with four single bonds to two atoms). The atom labels (ID:Element) are provided to help you inspect the raw graph structure.
  • Approximate Solver: The neuromorphic solver is a heuristic method that aims for very high satisfaction (99%+). It is not a formal, complete SAT solver and may not find a perfect 100% solution for extremely difficult or unsatisfiable problems.