Transition matrix for a two state and two particles

Let's do some imports


In [1]:
import numpy as np
import itertools

Now we define the states available


In [2]:
states = [[0,0],[1,0],[0,1],[1,1]]
states = [np.array(state) for state in states]

We can get all the combinations of the states as follows


In [3]:
list(itertools.combinations(states,2))


Out[3]:
[(array([0, 0]), array([1, 0])),
 (array([0, 0]), array([0, 1])),
 (array([0, 0]), array([1, 1])),
 (array([1, 0]), array([0, 1])),
 (array([1, 0]), array([1, 1])),
 (array([0, 1]), array([1, 1]))]

Perform an XOR between the states which is equivalent to a hop process


In [4]:
for pair in itertools.combinations(states,2):
    xor = np.logical_xor(*pair).astype(int)
    print(f"Left state {pair[0]}, right state {pair[1]}, XOR result {xor}")


Left state [0 0], right state [1 0], XOR result [1 0]
Left state [0 0], right state [0 1], XOR result [0 1]
Left state [0 0], right state [1 1], XOR result [1 1]
Left state [1 0], right state [0 1], XOR result [1 1]
Left state [1 0], right state [1 1], XOR result [0 1]
Left state [0 1], right state [1 1], XOR result [1 0]

Let's define a helper function to determine if a transition is allowed. Basically, in this problem, the process has to conserve particle number in the sense that a hop only involves one electron.


In [5]:
def allowed(jump):
    if np.sum(jump) != 1:
        return 0
    return 1

In [6]:
for pair in itertools.combinations(states,2):
    xor = np.logical_xor(*pair).astype(int)
    print(f"Left state {pair[0]}, right state {pair[1]}: allowed {bool(allowed(xor))}")


Left state [0 0], right state [1 0]: allowed True
Left state [0 0], right state [0 1]: allowed True
Left state [0 0], right state [1 1]: allowed False
Left state [1 0], right state [0 1]: allowed False
Left state [1 0], right state [1 1]: allowed True
Left state [0 1], right state [1 1]: allowed True

Now, building the matrix by calculating the combinations and then adding the transpose to have a symmetric matrix.


In [7]:
matrix = np.zeros((4,4))
for i in range(len(states)):
    for j in range(i):
        matrix[i][j] = allowed(np.logical_xor(states[i], states[j]).astype(int))

In [8]:
matrix+matrix.T


Out[8]:
array([[ 0.,  1.,  1.,  0.],
       [ 1.,  0.,  0.,  1.],
       [ 1.,  0.,  0.,  1.],
       [ 0.,  1.,  1.,  0.]])