def t(ket, pa, bonds):
    """Hopping between sites ket and ket+1, given the parameters.

    If the chain is not periodic, the hopping between the last and first sites
    is identically zero."""
    
    if ket == pa['chainlength'] and pa['boundary'] == 'open':
        return 0
    else:
        return pa['t0'] - pa['alpha']*bonds[ket-1]