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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pbitlang-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 57c2cf344814a2280d761d4143ff296c501bc52846fbc0b55b0587ec94220a4d
MD5 05ed9ee2451f858497f051dcb41e8d49
BLAKE2b-256 45194440c15703a0d96ffb80cb6011faa3b45abd2c178cf8d91df3b5310346ab

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pbitlang-1.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9cbaa47fd4ccb71cca9326fdf245f9de69196afe56eed9fc3269d6158bbf82e4
MD5 63b1b287944fb271251cae799c999f44
BLAKE2b-256 8ee501f06792246913de6cd9067e32983a98bd15c88ca1a15f1f3b2bd5724653

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