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

TBLattice wrong init raises SegFault #910

Open
the-hampel opened this issue Sep 1, 2023 · 1 comment
Open

TBLattice wrong init raises SegFault #910

the-hampel opened this issue Sep 1, 2023 · 1 comment
Labels

Comments

@the-hampel
Copy link
Member

With wrong input to TBLattice one can provoke a Segmentation Fault. For a two orbital model if one not specifies orbital positions, or defines them wrong is not protected by an error message:

from triqs.lattice.tight_binding import TBLattice
import numpy as np

t = 1.0

H_r = TBLattice(
    units=[
        (1.5, np.sqrt(3)/2, 0),
        (1.5, -np.sqrt(3)/2, 0),
    ],
    hoppings={
        (0, 0) : [[[0, -t], [-t, 0]]],
        (1, 0) : [[[0, -t], [0, 0]]],
        (-1, 0) : [[[0, 0], [-t, 0]]],
        (0, 1) : [[[0, -t], [0, 0]]],
        (0, -1) : [[[0, 0], [-t, 0]]],
    },
    orbital_positions=[(0, 0, 0)]
                )

gives:

Warning: could not identify MPI environment!
Starting serial run at: 2023-09-01 20:24:40.910407
Segmentation fault
@the-hampel the-hampel added the Bug label Sep 1, 2023
@HugoStrand
Copy link
Member

Also not giving a tuple in the hopping dictionary gives a hard segfault,

from triqs.lattice.tight_binding import TBLattice

H_r = TBLattice(
    units=[(1, 0, 0)],
    hoppings={
        (0) : [[1.]] # Key is missing a comma and is not a tuple, using (0,) works.
    },
    )
> python test.py 
Warning: could not identify MPI environment!
Starting serial run at: 2023-09-01 21:50:50.026024
zsh: segmentation fault  python test.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants