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.1.tar.gz (64.4 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.1-py3-none-any.whl (56.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pbitlang-1.0.1.tar.gz
  • Upload date:
  • Size: 64.4 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.1.tar.gz
Algorithm Hash digest
SHA256 15e797f78d19f4fcff0179eb7fb98dc8043d96c21096e25d8de1316382be186c
MD5 91303ec12bab9dd6bbbd1ba65b43b9c7
BLAKE2b-256 328d75f6884c7a01a6bf411e5b4a384cc2117dcce83c5e0acc27815800b9e74f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pbitlang-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 56.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bf13a8e66437117eb034d3630bede55cd3a34b0ecf2b69bccaefa7b5bb8af90d
MD5 2b39d2010141ce637002837d65efe591
BLAKE2b-256 fb58f2c64d0f67d9bee92675aae4abc37ef1d07fbaa4f359e9ab8ac11b70eaf4

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