Skip to main content

Domain-specific language for thermodynamic computing Hamiltonians

Project description

PbitLang

Domain-Specific Language for Thermodynamic Computing

Python License

PbitLang is a domain-specific language for expressing Hamiltonians (energy functions) with compile-time physics validation. It's designed for thermodynamic computing systems including P-bits, Ising machines, and quantum annealers.

Features

  • Type System: Dedicated types for spins (Ising, Potts, clock, continuous)
  • Lattice Geometries: Built-in support for chains, square, triangular, honeycomb, etc.
  • Physics Validation: Compile-time warnings about frustration, critical temperatures, symmetry violations
  • Standard Library: Common models (Ising, Heisenberg, Potts) pre-implemented
  • Zero Dependencies: Core has no required dependencies

Installation

pip install pbitlang

Quick Start

import pbitlang

# Define a Hamiltonian
source = '''
hamiltonian IsingChain(n: int, J: real) -> ising on chain(n) {
    coupling: sum((i,j) in neighbors) { -J * s[i] * s[j] }
}
'''

# Compile and instantiate
model = pbitlang.compile(source)
hamiltonian = model.instantiate(n=10, J=1.0)

Example: 2D Ising Model

hamiltonian IsingSquare2D {
    lattice: square(10, 10, periodic)
    spins: ising
    
    // Ferromagnetic coupling
    energy: -sum over neighbors(i, j) {
        J * s[i] * s[j]
    }
    
    // External field
    energy: -h * sum over i { s[i] }
    
    param J: real = 1.0
    param h: real = 0.1
}

CLI Usage

# Compile a Hamiltonian file
pbitlang compile my_model.pbit

# Interactive REPL
pbitlang repl

Documentation

Part of the Thermodynamic Computing Platform

PbitLang is part of the Thermodynamic Computing Platform, a comprehensive software stack for P-bit and thermodynamic hardware.

License

Proprietary Software - Copyright © 2024 David Johnson. All Rights Reserved.

You may install and use this software, but modification and redistribution are prohibited without written consent. See LICENSE for full terms.

Contact

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pbitlang-1.0.3.tar.gz (64.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pbitlang-1.0.3-py3-none-any.whl (56.2 kB view details)

Uploaded Python 3

File details

Details for the file pbitlang-1.0.3.tar.gz.

File metadata

  • Download URL: pbitlang-1.0.3.tar.gz
  • Upload date:
  • Size: 64.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for pbitlang-1.0.3.tar.gz
Algorithm Hash digest
SHA256 c6f84383722eb18aa363e13f1a2e1878086dda360831176cba95ccbfdfc89c29
MD5 8f8271111fed5bb17950f30c02dfe1d6
BLAKE2b-256 bf9c21e823cc807099005822d9e8357a4d8dc468aa8c18de28c400ec6bfd72fc

See more details on using hashes here.

File details

Details for the file pbitlang-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: pbitlang-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 56.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for pbitlang-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2c06acd7cb9a3aeeaf670da47047719f81715dec25e819753c6891a1a3d3e194
MD5 75e211926d6f11e4ddc3ec7c47ff530b
BLAKE2b-256 b8e0fb1136a60f2c8637557236acf4de2c26a3a2743f3bb63d71d7fd5df1ba39

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page