joseppinilla / qca-tools

Methods and utilities to simulate QCA circuits using D-Wave

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

qca-tools

qca-tools is a collection of methods and utilities for the simulation of Quantum-dot Cellular Automata (QCA) networks. It provides a composites interface to be used together with the D-Wave Ocean software stack.

Installation

To install from source:

python setup.py install

Example Usage

from qca_tools import QCAComposite
from dimod.reference.samplers import SimulatedAnnealingSampler

# Set-up file path
dir = './benchmarks/'
qca_filename = 'XOR.qca'
filepath = os.path.join(dir, qca_filename)

# Create sampler
child_sampler = SimulatedAnnealingSampler()
qca_sampler = QCAComposite(child_sampler, qca_filename)

# Collect samples
response = qca_sampler.sample()

A drawing of the QCA network can be generated using the NetworkX interpretation method. Either directly from a previously parsed QCANetwork:

# Using the sampler above
qca_network = qca_sampler.get_qca_network()
# Get NetworkX from QCA
QCAnx = QCANetworkX(qca_network)
QCAnx.draw_qca(with_labels=True)

Or from a *.qca file:

# From file
QCAnx = QCANetworkX.from_qca_file(filepath, ancilla=True, r_max=R_MAX)
QCAnx.draw_qca(with_labels=True)

./examples/benchmarks/XOR/XOR.png

About

Methods and utilities to simulate QCA circuits using D-Wave

License:MIT License


Languages

Language:Python 100.0%