Skip to content

Quantum Environments

The classes describing quantum environments.

A quantum environment is a container of sites. Either target quantum systems or quantum machines are described by its children classes.

A site is the basic unit describing a quantized physics entity. It includes qubit / bosonic / fermionic states, or other customized types of sites. Each site contains a set of site operators. These operators will be used in the construction of Hamiltonians.

Currently operators are stored as strings. In future these may be substituted by operator classes.

BaseParticle

Bases: BaseSite

The basic particle site.

By default, there are annihilation and creation operators. Additionally, to be consistent with qubit, I represents the identity.

Source code in SimuQ/simuq/environment.py
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
class BaseParticle(BaseSite) :
    """ The basic particle site.

    By default, there are annihilation and creation operators.
    Additionally, to be consistent with qubit, I represents the identity.
    """
    def __init__(self, qs) :
        super().__init__(qs)
        qs.sites_type.append('particle')
        self.a = self.gen_a()
        self.c = self.gen_c()
        self.I = self.gen_I()

    def gen_a(self) :
        return self.createOp("a")

    def gen_c(self) :
        return self.createOp("c")

    def gen_I(self) :
        return self.createOp("")

BaseQuantumEnvironment

The basic quantum environment.

It models a system to which quantum sites belong to.

The sites are stored in a sequence, where their types are stored in list sites_type.

Source code in SimuQ/simuq/environment.py
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
class BaseQuantumEnvironment :
    """ The basic quantum environment.

    It models a system to which quantum sites belong to.

    The sites are stored in a sequence, where their types are stored in
    list sites_type.
    """
    def __init__(self) :
        self.sites = []
        self.sites_type = []
        self.num_sites = 0

    def identity(self) :
        return TIHamiltonian.identity(self.sites_type)

    def singletonOp(self, index, op) :
        return TIHamiltonian.op(self.sites_type, index, op)

BaseSite

The basic quantum site.

Source code in SimuQ/simuq/environment.py
37
38
39
40
41
42
43
44
45
46
47
48
class BaseSite :
    """ The basic quantum site.
    """
    def __init__(self, qs) :
        self.index = qs.num_sites
        self.qs = qs
        qs.num_sites += 1
        qs.sites.append(self)

    def createOp(self, op) :
        h = self.qs.singletonOp(self.index, op)
        return h

boson

Bases: BaseParticle

The bosonic site

Source code in SimuQ/simuq/environment.py
109
110
111
112
113
114
class boson(BaseParticle) :
    """ The bosonic site
    """
    def __init__(self, qs) :
        super().__init__(qs)
        qs.sites_type[-1] = 'boson'

fermion

Bases: BaseParticle

The fermionic site

Source code in SimuQ/simuq/environment.py
101
102
103
104
105
106
class fermion(BaseParticle) :
    """ The fermionic site
    """
    def __init__(self, qs) :
        super().__init__(qs)
        qs.sites_type[-1] = 'fermion'

qubit

Bases: BaseSite

The qubit site.

By default, there are X, Y, Z, I defined as site operators of a qubit site.

Source code in SimuQ/simuq/environment.py
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
class qubit(BaseSite) :
    """ The qubit site.

    By default, there are X, Y, Z, I defined as site operators
    of a qubit site.
    """
    def __init__(self, qs) :
        super().__init__(qs)
        qs.sites_type.append('qubit')
        self.X = self.gen_X()
        self.Y = self.gen_Y()
        self.Z = self.gen_Z()
        self.I = self.gen_I()

    def gen_X(self) :
        return self.createOp("X")

    def gen_Y(self) :
        return self.createOp("Y")

    def gen_Z(self) :
        return self.createOp("Z")

    def gen_I(self) :
        return self.createOp("")