hopping_energy_modifier

hopping_energy_modifier(is_double=False, is_complex=False, **kwargs)

Modify the hopping energy, e.g. to apply a magnetic field

Parameters:
is_double : bool

Requires the model to use double precision floating point values. Defaults to single precision otherwise.

is_complex : bool

Requires the model to use complex numbers. Even if this is set to False, the model will automatically switch to complex numbers if it finds that a modifier has returned complex numbers for real input. Manually setting this argument to True will speed up model build time slightly, but it’s not necessary for correct operation.

Notes

The function parameters must be a combination of any number of the following:

energy : ndarray
The hopping energy between two sites.
x1, y1, z1, x2, y2, z2 : ndarray
Positions of the two lattice sites connected by the hopping parameter.
hop_id : ndarray of int
Hopping identifier: can be checked for equality with hopping names specified in Lattice. For example, energy[hop_id == 't_nn'] *= 1.1 will only modify the energy of the hopping family named t_nn.

The function must return:

ndarray
A modified hopping argument or an ndarray of the same dtype and shape.

Examples

def constant_magnetic_field(B):
    @pb.hopping_energy_modifier
    def f(energy, x1, y1, x2, y2):
        y = 0.5 * (y1 + y2) * 1e-9
        peierls = B * y * (x1 - x2) * 1e-9
        return energy * np.exp(1j * 2*pi/phi0 * peierls)
    return f

model = pb.Model(
    ... # lattice, shape, etc.
    constant_magnetic_field(B=10)
)