hopping_energy_modifier¶
- hopping_energy_modifier(is_double: bool = False, is_complex: bool = False, phase: bool = False, **kwargs) partial ¶
Modify the hopping energy, e.g. to apply a magnetic field
- Parameters:
- is_doublebool
Requires the model to use double precision floating point values. Defaults to single precision otherwise.
- is_complexbool
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 toTrue
will speed up model build time slightly, but it’s not necessary for correct operation.- phasebool
Define the phase of the reciprocal space so that the different eigenvectors have the same guage.
Notes
The function parameters must be a combination of any number of the following:
- energyndarray
The hopping energy between two sites.
- x1, y1, z1, x2, y2, z2ndarray
Positions of the two lattice sites connected by the hopping parameter.
- hop_id
support.alias.AliasIndex
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 namedt_nn
.- shiftndarray
Shift of x, y, z
The function must return:
- ndarray
A modified
hopping
argument or anndarray
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) )