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

BandsData: problems with k-point labels. #2491

Closed
3 tasks done
yakutovicha opened this issue Feb 15, 2019 · 1 comment
Closed
3 tasks done

BandsData: problems with k-point labels. #2491

yakutovicha opened this issue Feb 15, 2019 · 1 comment

Comments

@yakutovicha
Copy link
Contributor

yakutovicha commented Feb 15, 2019

It is not enough to correctly import a set of k-points and bands into a BandsData object to be able to use it properly. If k-points labels are not specified - the bands object will complain:

/home/epfl/work/venv-lsmo/local/lib/python2.7/site-packages/aiida/orm/data/array/bands.py in _matplotlib_get_dict(self, main_file_name, comments, title, legend, legend2, y_max_lim, y_min_lim, y_origin, prettify_format, **kwargs)
    805         labels = plot_info['labels']
    806         # prepare xticks labels
--> 807         tick_pos, tick_labels = zip(*labels)
    808 
    809         #all_data['bands'] = the_bands.tolist()

ValueError: need more than 0 values to unpack

if I add (at least one) labels: it works

In [9]: n.labels =[(0,'G')]

In [10]: n.show_mpl()

In [11]: 

another problem occurs if one does not include the labels of the very first and very last k-point:

In [11]: n2.labels =[(10,'A'), (20, 'B')] # total number is 39

In [12]: n2.show_mpl()

In [13]: 

as one can see in the figure below, the k-points 0-9 and 21-38 were cut:
bands

And the last thing is the lack of documentation. Without help I would spend a lot more time trying to figure out the label-related logic.

Therefore the suggestions to improve would be:

  • - fix empty labels array bug
  • - fix problem with cutting k-points
  • - add documentation on how to create and visualize BandsData object
@yakutovicha yakutovicha self-assigned this Feb 15, 2019
@yakutovicha yakutovicha added this to the v0.12.3 milestone Feb 15, 2019
ltalirz pushed a commit that referenced this issue Feb 28, 2019
fixes #2491 

* fix problem with empty labels array
* Fix bands plotting

If the first and/or the last kpoint label does not point to the first and/or
the last kpoint - the plotted band structure was cut on the left and/or right
sides. To avoid this I add empty labels to the first and/or the last kpoints
if they are not labeled.

* Add documentation on how to use the BandsData object
@sphuber
Copy link
Contributor

sphuber commented Mar 6, 2019

Fixed in PR #2492

@sphuber sphuber closed this as completed Mar 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants