ssh/ssh_utils.py
def ssh_hamiltonian(k, t1, t2, real_basis=True):
    """ Returns the SSH Hamiltonian at k with hopping amplitudes t1 and t2.

    Args:
        k (float): point in momentum space.
        t1 (float): hopping parameter.
        t2 (float): hopping paramter.
        real_basis (bool): if True, returns Hamiltonian in real basis. Else, use complex basis.

    Returns:
        np.array: the SSH Hamiltonian.
    """
    if real_basis:
        hamiltonian = np.zeros((2, 2), dtype=np.double)
        hamiltonian[0, 0] = t2 * np.sin(k)
        hamiltonian[1, 1] = -t2 * np.sin(k)
        hamiltonian[0, 1] = t1 + t2 * np.cos(k)
        hamiltonian[1, 0] = t1 + t2 * np.cos(k)
        return hamiltonian
    else:
        j = complex(0, 1)
        hamiltonian = np.zeros((2, 2), dtype=np.cdouble)
        hamiltonian[0, 1] = t1 + t2 * np.cos(k) - j * t2 * np.sin(k)
        hamiltonian[1, 0] = t1 + t2 * np.cos(k) + j * t2 * np.sin(k)
        return hamiltonian
 Returns the SSH Hamiltonian at k with hopping amplitudes t1 and t2.

    Args:
        k (float): point in momentum space.
        t1 (float): hopping parameter.
        t2 (float): hopping paramter.
        real_basis (bool): if True, returns Hamiltonian in real basis. Else, use complex basis.

    Returns:
        np.array: the SSH Hamiltonian.
    
Returns the SSH Hamiltonian at k with hopping amplitudes t1 and t2.
Returns the SSH Hamiltonian at k with hopping amplitudes t1 and t2 .
def ssh_hamiltonian(k, t1, t2, real_basis=True):
    if real_basis:
        hamiltonian = np.zeros((2, 2), dtype=np.double)
        hamiltonian[0, 0] = t2 * np.sin(k)
        hamiltonian[1, 1] = -t2 * np.sin(k)
        hamiltonian[0, 1] = t1 + t2 * np.cos(k)
        hamiltonian[1, 0] = t1 + t2 * np.cos(k)
        return hamiltonian
    else:
        j = complex(0, 1)
        hamiltonian = np.zeros((2, 2), dtype=np.cdouble)
        hamiltonian[0, 1] = t1 + t2 * np.cos(k) - j * t2 * np.sin(k)
        hamiltonian[1, 0] = t1 + t2 * np.cos(k) + j * t2 * np.sin(k)
        return hamiltonian
def ssh_hamiltonian ( k , t1 , t2 , real_basis = True ) : if real_basis : hamiltonian = np . zeros ( ( 2 , 2 ) , dtype = np . double ) hamiltonian [ 0 , 0 ] = t2 * np . sin ( k ) hamiltonian [ 1 , 1 ] = - t2 * np . sin ( k ) hamiltonian [ 0 , 1 ] = t1 + t2 * np . cos ( k ) hamiltonian [ 1 , 0 ] = t1 + t2 * np . cos ( k ) return hamiltonian else : j = complex ( 0 , 1 ) hamiltonian = np . zeros ( ( 2 , 2 ) , dtype = np . cdouble ) hamiltonian [ 0 , 1 ] = t1 + t2 * np . cos ( k ) - j * t2 * np . sin ( k ) hamiltonian [ 1 , 0 ] = t1 + t2 * np . cos ( k ) + j * t2 * np . sin ( k ) return hamiltonian
Returns the SSH Hamiltonian at k with hopping amplitudes t1 and t2.
Returns the SSH Hamiltonian at k with hopping amplitudes t1 and t2 .
""" Returns the SSH Hamiltonian at k with hopping amplitudes t1 and t2.

    Args:
        k (float): point in momentum space.
        t1 (float): hopping parameter.
        t2 (float): hopping paramter.
        real_basis (bool): if True, returns Hamiltonian in real basis. Else, use complex basis.

    Returns:
        np.array: the SSH Hamiltonian.
    """
the SSH Hamiltonian.
the SSH Hamiltonian .
np.array
k
point in momentum space.
point in momentum space .
t1
None
t2
None
real_basis
if True, returns Hamiltonian in real basis. Else, use complex basis.
if True returns Hamiltonian in real basis . Else use complex basis .