Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onsite term not set correctly #5

oroszl opened this issue Jul 9, 2017 · 2 comments

onsite term not set correctly #5

oroszl opened this issue Jul 9, 2017 · 2 comments


Copy link

oroszl commented Jul 9, 2017

First of all, let me express my greatest admiration for the package.. It is really useful!
Specially I would like to express my profound gratitude for implementing the KPM stuff!
So I have been playing around with the package. The current problem I am investigating is a 3D lattice with two orbitals on a single site and I have came up on a small bug.
Let me illustrate it with the following small bit of code

import pybinding as pb
import numpy as np
import matplotlib.pyplot as plt

def makesys(U):
    lat.add_sublattices(('A', [0,0,0],U ))
                 ([1,0,0], 'A', 'A', eye(2)),
                 ([0,1,0], 'A', 'A', eye(2)),
                 ([0,0,1], 'A', 'A', eye(2))
    model = pb.Model(lat,pb.primitive(a1=2, a2=2,a3=2))
    return model

Now I define two models. The first has the identity matrix as onsite term the other has the first Pauli matrix.


looking at the first site onsite element of the generated Hamiltonian I get in the first case the expected result:

>matrix([[ 1.,  0.],
>        [ 0.,  1.]], dtype=float32)

in the second case however the zero matrix is returned !

>matrix([[ 0.,  0.],
>        [ 0.,  0.]], dtype=float32)
Copy link

Thanks for reporting the bug and for the nice reproducible code example! Looks like the Hamiltonian builder was mistakenly ignoring the onsite matrix if the diagonal elements were all zero. This should be fixed now in 9d511b6.

I'll release v0.9.4 with the bug fix later this week. If you need the fix sooner, you can get it by installing the latest dev version as described here: compiling from source.

Copy link

oroszl commented Jul 11, 2017

Thanks for the fix. I think We can close this

@oroszl oroszl closed this as completed Jul 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

2 participants