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.4.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.4-py3-none-any.whl (56.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pbitlang-1.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 a7b5486b8c9ceed01221060a834f399027e680e10e1f8cfa8618ac3ef9f89829
MD5 5aaf06e9223f4a453fc0c6c8353f74d2
BLAKE2b-256 c0a6a3f339080a11729f566b6d236b37a5742ea69a55fdc567ff5e8bf0048c44

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pbitlang-1.0.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 92005b465400c9193deff023b1a7b63bce0b9f8206cb2e2f6c91f3bec2839360
MD5 c44315a53dcbd32ab929e18f3206e3a5
BLAKE2b-256 a623f0d17cbfde4f991ef47c04e42283bb4f5f3a5d20829ca326542259146f52

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