qsymm.model module
- class qsymm.model.BlochModel(hamiltonian=None, locals=None, momenta=('k_x', 'k_y', 'k_z'), keep=None, shape=None, format=None)[source]
Bases:
Model- subs(*args, **kwargs)[source]
Substitute symbolic expressions. See
Model.subs.
- class qsymm.model.Model(hamiltonian=None, locals=None, momenta=('k_x', 'k_y', 'k_z'), keep=None, symbol_normalizer=None, normalize=False, shape=None, format=None)[source]
Bases:
UserDict- allclose(other, rtol=1e-05, atol=1e-08, equal_nan=False)[source]
Test whether two Models are approximately equal
- eliminate_zeros(rtol=1e-05, atol=1e-08)[source]
Return a model with small terms removed. Tolerances are in Frobenius matrix norm, relative tolerance compares to the value with largest norm.
- lambdify(nsimplify=False, *, onsite=False, hopping=False)[source]
Return a callable object for the model, with sympy symbols as parameters.
- Parameters:
nsimplify (bool, default False) – Whether or not to attempt to rewrite numerical coefficients as exact symbols in sympification.
onsite (bool, default False) – If True, adds ‘site’ as the first argument to the callable object. Helpful for passing Model objects to kwant Builder objects as onsite functions.
hopping (bool, default False) – If True, adds ‘site1’ and ‘site2’ as the first two arguments to the callable object. Helpful for passing Model objects to kwant Builder objects as hopping functions.
Notes
True (onsite and hopping are mutually exclusive. If both are set to)
:param : :param an error is thrown.:
- subs(*args, **kwargs)[source]
Substitute symbolic expressions. See documentation of
sympy.Expr.subs()for details.Allows for the replacement of momenta in the Model object. Replacing a momentum k with a sympy.Symbol object p replaces the momentum k with p in the Model. Replacing a momentum k with a number removes the momentum k from the Model momenta. Replacing a momentum k with a sympy expression that does not contain any of the Model.momenta also removes the momentum k from the momenta.
- tosympy(nsimplify=False)[source]
Return sympy representation of the Model. If nsimplify=True, attempt to rewrite numerical coefficients as exact formulas.
- transform_symbolic(func)[source]
Transform keys by applying func to all of them. Useful for symbolic substitutions, differentiation, etc.