Quantum Tensor Tree

Introduction

Quantum Tensor Tree is an approach to indexing Fock space in Python. In this chapter, we cover the Tree and Graph structures in Quantum Tensor Tree which are applicable to energy-level diagram, or small interacting clusters.

Solving many-body physical problems usually begins by setting up an indexing system for the fermionic occupancy {nimσ}\ket{\{n_{i m σ}\} } with nimσ{0,1},n_{i m σ}∈\{0,1\}, where i,m,σi, m, σ index quantum degrees of freedom on a graph.

Accessing variables with our index often ends up in a lot of loops, which are distracting from the essential physics. We setup a framework which makes use of object-oriented programming to hide the details of the indexing from our main code scripts, and expressively access fermionic states with a hierarchical indexing structure contained in a module 1 referred to as qttree.network . A graph from the leaves of the tree is constructed, which maps one-to-one with a matrix2 which can be sliced using our tree structure.

The Graph object maps to non-interacting situations (a truncated Fock-space), whereas the HyperGraph object maps to a full Fock-space. A GreensFunction object can then be obtained after a full diagonalisation of the Graph/HyperGraph, and after performing a bit-string operation to account for Fermionic signs in the latter object.

Tree Objects

We construct a tree structure whose attributes cascade down. The overarching idea is the leaves of this tree form a vector, and such a cascading and hierarchical structure allows us to more efficiently and intuitively access the vector’s components.

This becomes useful for large Quantum Mechanical wave vectors, particularly wherein many components are involved, and when constructing real-space device models.

ℹ️ Note

Efficient and dynamic computations:

  • parent attribute is set to child nodes as they are added.
  • All other attributes are computed recursively, with vectorisation.
  • Attributes are set in a cascade down the descendants.
  • Attributes are accessed via Python’s own hashing routine.

Examples

Construct a simple Tree as a branch with two leaves:

1>>> leaf1 = Tree(name="leaf")
2>>> leaf2 = Tree(name="leaf")
3>>> branch = Tree(leaf1, leaf2, name="branch")
4>>> print(branch)
5branch(['leaf', 'leaf'])
6>>> len(branch)
72
Attributes cascade down the descendants
1>>> branch.color = "green"
2>>> leaf1.color
3'green'
4>>> leaf1.color = "crimson"
5>>> leaf1.color
6'crimson'
We can climb the tree with the parent attribute
1>>> leaf1.parent.color
2'green'

Build up the Tree

Add a trunk, and make a tree out of it
1>>> branch2 = Tree(Tree(name="leaf"), Tree(name="leaf"), name="branch")
2>>> trunk = Tree(branch, branch2, Tree(name="leaf"), name="trunk")
3>>> tree = Tree(trunk, name="tree")

Clarifying the tree structure in the examples. The tree is the root of the structure, the trunk its child. Each branch has two leaves, whereas the tree and trunk have five.

Extracting variables from the leaves
1>>> tree.a = 1.0
2>>> print(tree.a)
31.0
4>>> print(tree.leaves.a)
5[1.0, 1.0, 1.0, 1.0, 1.0]
6>>> print(tree.sum.a)
75.0
8>>> print(tree.mean.a)
91.0

  1. A module in the Python programming language is just a file, usually in the context of a package of files, and is defined both in contrast to a script which is the top-level code run by the user, and in contrast to its predecessor, the Unix filesystem. By modularising code, complex ideas are organised and accessed without necessarily reference the location of the file in the filesystem. This might seem simple, but it played an important role in the history of computing languages, as it expanded the notion of a system PATH from the flat Unix library or bin directories, to a more flexible and modular namespace, combining the benefits of both C and BASH into a middle-ground language for advanced scripting projects. ↩︎

  2. We prefer to script over a tensor library, rather than writing our own low-level computations, as the code is then carried by on-going developments in parallel processing, and we can focus on the physical intuitiveness of the syntax, with an API calling Pytorch behind the scenes, thus separating concerns. ↩︎

Macro definitions

No macros found yet.

TutorLumin partners with QuantaLumin

You’re connecting to your QuantaLumin account on members.quantalumin.com.