GithubHelp home page GithubHelp logo

smtg-ucl / sumo Goto Github PK

View Code? Open in Web Editor NEW
187.0 14.0 78.0 239.44 MB

Heavyweight plotting tools for ab initio calculations

Home Page: https://smtg-bham.github.io/sumo/

License: MIT License

TeX 1.00% Python 99.00%
computational-chemistry materials-science plotting python

sumo's Introduction

Sumo

Build Status JOSS Paper Pypi Repository Zenodo Repository

Sumo is a Python toolkit for plotting and analysis of ab initio solid-state calculation data, built on existing Python packages from the solid-state chemistry/physics community. It is hoped that these command-line tools will bring some of the benefits of these libraries to a wider user-base while providing publication-ready plotting (powered by Matplotlib.)

The main features include:

  1. An extensive framework for generating high-symmetry k-point paths.
    • Crystallographic spacegroups are determined using Spglib.
    • Conventional crystallographic paths are built in as well as interfaces to the SeeK-path and Pymatgen implementations.
  2. Plotting scripts for electronic and phonon band structures, density of states, and optical absorption diagrams.
    • VASP calculations are imported using Pymatgen.
    • The Phonopy framework is supported for phonon band structures.
  3. Analysis scripts to calculate parabolic and non-parabolic band effective masses.
    • Curve fitting is performed using Scipy.

The code currently primarily supports VASP calculations, and has partial support for CASTEP and for LMTO calculations with Questaal. We would like to add support for additional solid-state codes in future releases. Code contributions to interface with these packages are welcome.

Sumo is free to use, however, we ask that you cite the code if you use it in your research. See the "contributing" section for information about reporting bugs and getting involved.

Usage

Sumo is intended to be used via the command-line, however, a fully-documented python API is also provided. A manual, including tutorials and API documentation, is available online. Additionally, the built-in help (-h) option for each command provides a summary of the available options.

A guide to using each command can be found on the Tutorial page.

For a preview of the functionality of sumo, see the Gallery.

Currently, the scripts provided are:

  • sumo-kgen: For generating VASP KPOINTS files along high-symmetry k-point paths.
  • sumo-bandplot: For plotting publication-ready electronic band structure diagrams.
  • sumo-dosplot: For plotting publication-ready electronic density of states diagrams.
  • sumo-optplot: For plotting publication-ready optical absorption diagrams.
  • sumo-phonon-bandplot: For plotting publication-ready phonon band structure diagrams.
  • sumo-bandstats: For calculating electron and hole effective masses from a band structure.

Information on how to tweak the style of sumo plots is provided on the Customising Sumo Plots page.

Feature support for different codes

Features VASP CASTEP Questaal
k-point path generation Y Y (1) Y
band plotting Y Y Y
band projections Y N N
band analysis Y N N
total DOS plot Y Y Y
projected DOS Y Y Y
phonon band plot Y (2) Y N
  1. Brillouin-zone path can also be written for CASTEP phonon calculation
  2. VASP phonons are plotted from Phonopy output files

Installation

Sumo is a Python 3 package and requires a typical scientific Python stack; we recommend using your main package manager if possible (e.g. apt, Homebrew), or Anaconda to install Python 3 with setuptools. It is a good idea to also use this package manager to install Numpy and Matplotlib, as building them with setuptools can be troublesome. Sumo can then be installed using the Python package manager "Pip", which will automatically setup other Python packages as required:

pip install --user sumo

If this is your first entry to the scientific Python ecosystem, be aware that the full stack including Scipy with need several hundred MB of disk space.

Developer installation

Regular users can skip this section!

Sumo can also be installed from a copy of the source repository (https://github.com/smtg-bham/sumo); this will be preferred for development work or if using experimental code branches.

To clone the project from Github and make a local installation:

git clone https://github.com/smtg-bham/sumo.git
cd sumo
pip install --user -e .

The -e and --user options are recommended: Instead of copying files, with -e pip will create links to the source folder so that that tweaks to the code will be immediately reflected on the PATH. The --user flag installs to a directory in your home folder (usually under the hidden directory ~/.local), preventing interference with your root Python installation.

Tests

From a developer installation, the unit tests can be run (from the root directory of the project) using:

pytest

Automatic testing is run on the master branch of Sumo and proposed features using GitHub Actions.

Documentation

To build the documentation from the project files, install sumo with extra Sphinx dependencies before compiling with sphinx-build.

pip install --user .[docs]
sphinx-build docs/src docs_build

The user guide can then be explored from docs/build/html/index.html.

How to cite sumo

If you use sumo in your research, please consider citing the following work:

Alex M. Ganose, Adam J. Jackson, David O. Scanlon. sumo: Command-line tools for plotting and analysis of periodic ab initio calculations. Journal of Open Source Software, 2018 3 (28), 717, doi:10.21105/joss.00717.

License

Sumo is made available under the MIT License.

Detailed requirements

Sumo is currently compatible with Python 3.5+ and relies on a number of open-source python packages, specifically:

Contributing

Bugs reports and feature requests

There are probably still some bugs. If you think you've found one, please report it on the Issue Tracker. This is also the place to propose ideas for new features or ask questions about the design of Sumo. Poor documentation is considered a bug, but please be as specific as possible when asking for improvements.

Code contributions

We welcome your help in improving and extending the package with your own contributions. This is managed through Github pull requests; for external contributions we prefer the "fork and pull" workflow while core developers use branches in the main repository:

  1. First open an Issue to discuss the proposed contribution. This discussion might include how the changes fit Sumo's scope and a general technical approach.
  2. Make your own project fork and implement the changes there. Please keep your code style compliant with PEP8.
  3. Open a pull request to merge the changes into the main project. A more detailed discussion can take place there before the changes are accepted.

sumo's People

Contributors

ajjackson avatar alexsquires avatar azanre avatar badw avatar bjmorgan avatar cnsavory avatar ezpzbz avatar frssp avatar kavanase avatar kbspooner avatar mkhorton avatar oashour avatar shyamd avatar utf avatar yw-fang avatar zccaayo avatar zhubonan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sumo's Issues

Overlay multiple phonon band structures

I thought we already had an issue for this but don't see it.

This feature was previously discussed with @kinzani @meinhorn @warda-rahim @zccaayo
and is particularly relevant for calculations in the Quasi-harmonic approximation: accept multiple sets of phonon data and plot them in different colours on the same band structure.

This may be achieved using the existing Python API, without much issue for e.g. supercell size convergence. However, for QHA calcs there is an interesting artefact that emerges: slight differences in lattice parameters lead to slightly inequivalent reciprocal-space paths. The "absolutely correct" solution here is to refuse to plot different lattices on the same band structure as the axis becomes technically incorrect. The pragmatic "let's actually do science here" solution is to arbitrarily choose one of the structures and rescale the reciprocal lattice for the others so the features at high-symmetry points may be compared easily.

sumo-bandplot --dos crashes for more than 1 element

Trying to plot combined band structure and DOS diagrams causes sumo to crash when using the default colour scheme.

One example is the command given in the tutorials for Cs2SnI6:
sumo-bandplot --dos ../dos/vasprun.xml.gz --ymin -4

This appears to be because the default band structure style file only contains four colours, and the DOS, when plotted by sumo-bandplot, is drawing from these, rather than the specific DOS cycle. So, for any element after the first (if including d orbitals) it can't find sufficient colours.

Dielectric loss function

I have written some functionality to plot dielectric loss functions, which could be useful in the code.
A lot of the functionality is replication of the absorption plotting. I have taken the lazy route of copying and modifying the absorption routines rather than extending the existing routines.

I am not sure what your stance is on this. I would guess that the easiest route is to create a Pull Request and allow you to review the code and decide from there.

Correct NEDOS

Dear all,
Sumo - Great program. Thank you for writing it and making it available.

What are the optimum INCAR settings you would suggest when running a DOS job. For example my INCAR has a setting of:

EMIN = -30.0 #Minimum range energy for DOS carefull must have decimals
EMAX = 15.0 #Maximum range energy for DOS carefull must have decimals
NEDOS = 4000 #Number of DOS sample sites

and there is a lot of noise in the plot. (plot attached)

Your example figures really look smooth and nice.

Thanks & Regards.

dos.pdf

A continuous reminder “No handles with labels found to put in legend.” using sumo-optplot

After type the following command, a tip is given (please see 1). But then, this tip will always appear if you enter the all relevant "sumo-optplot" command (please see 2).

1

tg@tg:~/useful-tools/sumo-1.0.4/tests/data/RbSnI6$ sumo-optplot --bandgap ./vasprun.xml 
No handles with labels found to put in legend.

2

tg@tg:~/useful-tools/sumo-1.0.4/tests/data/RbSnI6$ sumo-optplot
No handles with labels found to put in legend.

sumo-phonon-bandplot with --primitive-axis and --born gives an error

sumo-phonon-bandplot with --primitive-axis and --born work fine separately but give an error when used together:

sumo-phonon-bandplot --dim 2 2 2 --primitive-axis 0. 0.5 0.5   0.5 0.0 0.5   0.5 0.5  0. --born BORN
Using supercell with dimensions:
	[[2. 0. 0.]
	 [0. 2. 0.]
	 [0. 0. 2.]]

Calculating force constants...
Traceback (most recent call last):
  File "/global/home/users/kinzani/miniconda3/envs/p3/bin/sumo-phonon-bandplot", line 10, in <module>
    sys.exit(main())
  File "/global/home/users/kinzani/miniconda3/envs/p3/lib/python3.6/site-packages/sumo/cli/phonon_bandplot.py", line 414, in main
    eigenvectors=args.eigenvectors, dos=args.dos)
  File "/global/home/users/kinzani/miniconda3/envs/p3/lib/python3.6/site-packages/sumo/cli/phonon_bandplot.py", line 191, in phonon_bandplot
    write_fc=False)
  File "/global/home/users/kinzani/miniconda3/envs/p3/lib/python3.6/site-packages/sumo/phonon/phonopy.py", line 93, in load_phonopy
    phonon.set_nac_params(nac_params)
  File "/global/home/users/kinzani/miniconda3/envs/p3/lib/python3.6/site-packages/phonopy/api_phonopy.py", line 445, in set_nac_params
    self.nac_params = nac_params
  File "/global/home/users/kinzani/miniconda3/envs/p3/lib/python3.6/site-packages/phonopy/api_phonopy.py", line 442, in nac_params
    self._set_dynamical_matrix()
  File "/global/home/users/kinzani/miniconda3/envs/p3/lib/python3.6/site-packages/phonopy/api_phonopy.py", line 2582, in _set_dynamical_matrix
    symprec=self._symprec)
  File "/global/home/users/kinzani/miniconda3/envs/p3/lib/python3.6/site-packages/phonopy/structure/symmetry.py", line 453, in symmetrize_borns_and_epsilon
    site_sym = u_sym.get_site_symmetry(i)
  File "/global/home/users/kinzani/miniconda3/envs/p3/lib/python3.6/site-packages/phonopy/structure/symmetry.py", line 124, in get_site_symmetry
    self._symprec)
  File "/global/home/users/kinzani/miniconda3/envs/p3/lib/python3.6/site-packages/phonopy/structure/symmetry.py", line 174, in _get_site_symmetry
    pos = positions[atom_number]
IndexError: index 2 is out of bounds for axis 0 with size 2

issue regarding installating sumo using pip

Hello Sir. I would like to use SUMO for post processing my calculations. However, I am unable to install sumo on ubuntu 16.04. I have installed pip using sudo. But then when I use command 'pip3 install --user sumo' an error occurs. I have copy pasted the error below. Kindly help me in this regard.

Obtaining file:///home/shruthi/nair/softwares/sumo-master
Collecting spglib (from sumo===1.2.0)
Exception:
Traceback (most recent call last):
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connection.py", line 137, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/util/connection.py", line 67, in create_connection
for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
File "/usr/lib/python3.5/socket.py", line 732, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 560, in urlopen
body=body, headers=headers)
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 346, in _make_request
self._validate_conn(conn)
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 787, in _validate_conn
conn.connect()
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connection.py", line 217, in connect
conn = self._new_conn()
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connection.py", line 146, in _new_conn
self, "Failed to establish a new connection: %s" % e)
requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f08a91a6a58>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 328, in run
wb.build(autobuilding=True)
File "/usr/lib/python3/dist-packages/pip/wheel.py", line 748, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 360, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 512, in _prepare_file
finder, self.upgrade, require_hashes)
File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 273, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/lib/python3/dist-packages/pip/index.py", line 442, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/usr/lib/python3/dist-packages/pip/index.py", line 400, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/usr/lib/python3/dist-packages/pip/index.py", line 545, in _get_pages
page = self._get_page(location)
File "/usr/lib/python3/dist-packages/pip/index.py", line 648, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/usr/lib/python3/dist-packages/pip/index.py", line 757, in get_page
"Cache-Control": "max-age=600",
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 480, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python3/dist-packages/pip/download.py", line 378, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 468, in request
resp = self.send(prep, **send_kwargs)
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/adapter.py", line 46, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/adapters.py", line 376, in send
timeout=timeout
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 610, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 228, in increment
total -= 1
TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'

ImportError: cannot import name 'gcd'

[root@centostg gt]# sumo-kgen
Traceback (most recent call last):
File "/root/.local/bin/sumo-kgen", line 7, in
from sumo.cli.kgen import main
File "/root/.local/lib/python3.4/site-packages/sumo/cli/kgen.py", line 23, in
from sumo.symmetry.kpoints import get_path_data, write_kpoint_files
File "/root/.local/lib/python3.4/site-packages/sumo/symmetry/init.py", line 9, in
from sumo.symmetry.kpath import Kpath
File "/root/.local/lib/python3.4/site-packages/sumo/symmetry/kpath.py", line 14, in
from pymatgen.core.structure import Structure
File "/usr/lib64/python3.4/site-packages/pymatgen/init.py", line 55, in
from pymatgen.core import *
File "/usr/lib64/python3.4/site-packages/pymatgen/core/init.py", line 8, in
from .structure import Structure, IStructure, Molecule, IMolecule
File "/usr/lib64/python3.4/site-packages/pymatgen/core/structure.py", line 18, in
from math import gcd
ImportError: cannot import name 'gcd'

[root@centostg gt]# pip install gcd
Requirement already satisfied: gcd in /usr/lib/python3.4/site-packages (0.1.0)
Requirement already satisfied: Click>=6.0 in /root/.local/lib/python3.4/site-packages (from gcd) (7.0)

Minor issue about font?

I've just installed SUMO and tested it.

sumo-dosplot
findfont: Font family ['sans-serif'] not found. Falling back to DejaVu Sans.
findfont: Font family ['sans-serif'] not found. Falling back to DejaVu Sans.

I'm using SUMO on Cent OS 7 though I found some solutions for Ubuntu OS.

Vertical DOS Plot

Right now, I'm hackishly using _makedos to do this myself but it would be really nice if there was an option in get_plot to produce a vertical plot or a get_vertical_plot that had many of the same options as get_plot.

I met errors when I do projected band structure

When I use sumo-bandplot to plot the projected band structure.
I met this error
" File "/home/rqzhang/repos/miniconda3/lib/python3.7/site-packages/scipy/interpolate/interpolate.py", line 696, in _check_bounds
raise ValueError("A value in x_new is above the interpolation "
ValueError: A value in x_new is above the interpolation range."

If I do not use the Projected, the band structure is OK.

Could you give me some suggestion?

kgen: primitive and conventional cells

Summary of discussion with @utf and @scanlond based on user feedback.

  • Users can get confusing/incorrect results when using kgen with a non-primitive POSCAR
  • kgen warns that results may be incorrect and writes a POSCAR_prim file along with a KPOINTS which corresponds to that primitive/standard cell setting.
  • If the user ignores this warning and uses their current POSCAR with this KPOINTS file, their results will usually be wrong.
  • A solution to this would be to refuse to output KPOINTS until kgen is satisfied it will match POSCAR
  • A scenario in which this could be a problem is magnetically-ordered structures in which the true electronic unit cell resembles a supercell of an underlying lattice.
    • A simple solution is to provide an "I promise this is the primitive cell" flag which causes kgen to work with the cell given.
    • For magnetic materials it could be possible to provide information about magnetic moments, in which case this stuff should be inferred correctly (and a primitive cell consistent with the magnetic ordering might still be found).
    • If the user is determined to treat a magnetic material as though it has the periodicity of an underlying structural unit, they really need to look into band-unfolding instead.
  • A key point is that we should not endorse the calculation of "band structure diagrams" with non-primitive cells as the results will contain band-folding.

Proposal from @utf

  • By default refuse to generate the k-points if the cell convention doesn't match the one expected
  • Have an option to override this behaviour
  • Implement a magmom option to set the magnetic moments on each atom (the functionality for this is available in spglib, seekpath and pymatgen)
  • Make kgen support line mode band structures to make band unfolding easier

Default Colors for Elements/Orbitals

It would be really nice if there was a default color scheme for all elements, or could auto generate something based on the total number of elements/orbitals. Right now, I'm just hard-coding in color brewer color sets for X number of elements.

Energy unit conversion for phonon dispersion plotter

At the moment, sumo-phonon-bandplot only allows Frequency in units of THz on the y axis. It may be very useful, aiming for publication-ready plotting, to have the ability to plot the y axis in units of (m)eV and cm^-1, which are more comparable to certain other techniques/data.

I find a bug while using sumo-bandstats

  • While I run ‘sumo-bandstats’,it reports that:
Indirect band gap: 0.609 eV
Traceback (most recent call last):
  File "/usr/local/bin/sumo-bandstats", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.5/site-packages/sumo/cli/bandstats.py", line 320, in main
    parabolic=args.nonparabolic)
  File "/usr/local/lib/python3.5/site-packages/sumo/cli/bandstats.py", line 101, in bandstats
    _log_band_gap_information(bs)
  File "/usr/local/lib/python3.5/site-packages/sumo/cli/bandstats.py", line 178, in _log_band_gap_information
    direct_bg = direct_data[spins[0]]['value']
TypeError: 'dict_keys' object does not support indexing
  • Then I changed several part of bandstats.py, and it runs successfully.

  • My changes are:
    line 178: direct_bg = direct_data[list(spins)[0]]['value']
    line 181: for spin in direct_data.keys():
    line 221: + '({})'.format(spin.name) for spin in spins]

  • But I don't know whether this change is correct. To be honest, I don't know the details in the code. Could you help me to fix the problem? Thanks a lot.

Bandstats Effective Mass Interpretation

How does one interpret the values below from the output of the bandstats function?
I understand these values are essentially derived from the inverse of the second derivative or concavity of the conduction and valence band edges at a given k-point but which should be interpreted as the 'true' value?

m_h: -0.187 | band 1 | [0.00, 0.00, 0.00] (1) -> [0.50, 0.50, 0.50]
m_h: -0.288 | band 1 | [0.00, 0.00, 0.00] (1) -> [0.00, 0.00, 0.00] (1)
m_h: -0.252 | band 1 | [0.00, 0.00, 0.00] (1) -> [0.00, 0.00, 0.00] (1)
m_h: -0.961 | band 2 | [0.00, 0.00, 0.00] (1) -> [0.50, 0.50, 0.50]
m_h: -0.494 | band 2 | [0.00, 0.00, 0.00] (1) -> [0.00, 0.00, 0.00] (1)
m_h: -0.401 | band 2 | [0.00, 0.00, 0.00] (1) -> [0.00, 0.00, 0.00] (1)
m_h: -0.961 | band 3 | [0.00, 0.00, 0.00] (1) -> [0.50, 0.50, 0.50]
m_h: -0.494 | band 3 | [0.00, 0.00, 0.00] (1) -> [0.00, 0.00, 0.00] (1)
m_h: -2.150 | band 3 | [0.00, 0.00, 0.00] (1) -> [0.00, 0.00, 0.00] (1)

Electron effective masses:
m_e: 0.986 | band 4 | [0.00, 0.44, 0.44] -> [0.00, 0.00, 0.00] (1)
m_e: 1.392 | band 4 | [0.00, 0.44, 0.44] -> [0.00, 0.00, 0.00] (1)

`sumo-phonon-bandplot` label issue - possible new phonopy API

when running sumo-phonon-bandplot I end up with the error:

    sys.exit(main())
  File "/Users/badw/Library/Python/3.7/lib/python/site-packages/sumo/cli/phonon_bandplot.py", line 410, in main
    eigenvectors=args.eigenvectors, dos=args.dos)
  File "/Users/badw/Library/Python/3.7/lib/python/site-packages/sumo/cli/phonon_bandplot.py", line 203, in phonon_bandplot
    phonon._band_structure.write_yaml(labels=labels, filename=yaml_file)
TypeError: write_yaml() got an unexpected keyword argument 'labels'```

perhaps this is a change in phonopy?

Tusen Takk.

sumo-kgen and sumo-bandstats running errors

Thanks for your hard work for providing such a perfect code. I think this code is very helpful for the photovoltaic community. I am also a Ph.D. student. My research is also focused on the simulation of organic-inorganic hybrid perovskite materials. And I followed you for a long time through your papers.

According to the tutorial you gave, running "sumo-kgen" and "sumo-bandstats" commands in the corresponding directory will report an error. But other commands (e.g., sumo-dosplot) all work well.
Although I think that these errors may be caused by the pymatgen software on my computer. Do you have any suggestions?

1

tg@tg:~/useful-tools/sumo-1.0.4/tests/data/ZnO$ sumo-kgen
/home/tg/.local/lib/python3.6/site-packages/pymatgen/io/vasp/inputs.py:385: UserWarning: Elements in POSCAR cannot be determined. Defaulting to false names H H He He.
  " ".join(atomic_symbols))
Traceback (most recent call last):
  File "/home/tg/.local/bin/sumo-kgen", line 11, in <module>
    sys.exit(main())
  File "/home/tg/.local/lib/python3.6/site-packages/sumo/cli/kgen.py", line 232, in main
    cart_coords=args.cartesian, kpt_list=kpoints, labels=labels)
  File "/home/tg/.local/lib/python3.6/site-packages/sumo/cli/kgen.py", line 108, in kgen
    labels=labels)
  File "/home/tg/.local/lib/python3.6/site-packages/sumo/symmetry/kpoints.py", line 122, in get_path_data
    kpath = BradCrackKpath(structure, symprec=symprec, spg=spg)
  File "/home/tg/.local/lib/python3.6/site-packages/sumo/symmetry/brad_crack_kpath.py", line 66, in __init__
    self._kpath = self._get_bradcrack_data(bravais)
  File "/home/tg/.local/lib/python3.6/site-packages/sumo/symmetry/brad_crack_kpath.py", line 83, in _get_bradcrack_data
    with open(json_file, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/tg/.local/lib/python3.6/site-packages/sumo/symmetry/bradcrack.json'

2

2) tg@tg:~/useful-tools/sumo-1.0.4/tests/data/Cs2SnI6/bandstructure$ sumo-bandstats
Traceback (most recent call last):
  File "/home/tg/.local/bin/sumo-bandstats", line 11, in <module>
    sys.exit(main())
  File "/home/tg/.local/lib/python3.6/site-packages/sumo/cli/bandstats.py", line 320, in main
    parabolic=args.nonparabolic)
  File "/home/tg/.local/lib/python3.6/site-packages/sumo/cli/bandstats.py", line 101, in bandstats
    _log_band_gap_information(bs)
  File "/home/tg/.local/lib/python3.6/site-packages/sumo/cli/bandstats.py", line 174, in _log_band_gap_information
    direct_data = bs.get_direct_band_gap_dict()
AttributeError: 'BandStructureSymmLine' object has no attribute 'get_direct_band_gap_dict'

problems with --project flag in Bandplot: incompatibility with multiple branches

Dear users,
I found the following error when trying projected band plots.
Thanks for the help.
Best regards
Ricardo

sumo-bandplot --project Ti,O 
/usr/local/lib/python3.4/dist-packages/pymatgen/__init__.py:87: UserWarning: 
Pymatgen will drop Py2k support from v2019.1.1. Pls consult the documentation
at https://www.pymatgen.org for more details.
  at https://www.pymatgen.org for more details.""")
Traceback (most recent call last):
  File "/usr/local/bin/sumo-bandplot", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.4/dist-packages/sumo/cli/bandplot.py", line 473, in main
    dpi=args.dpi, fonts=[args.font])
  File "/usr/local/lib/python3.4/dist-packages/sumo/cli/bandplot.py", line 244, in bandplot
    dos_options=dos_opts, fonts=fonts)
  File "/usr/local/lib/python3.4/dist-packages/sumo/plotting/bs_plotter.py", line 329, in get_projected_plot
    weights = interp1d(distances, weights, axis=2)(temp_dists)
  File "/usr/local/lib/python3.4/dist-packages/scipy/interpolate/interpolate.py", line 431, in __init__
    _Interpolator1D.__init__(self, x, y, axis=axis)
  File "/usr/local/lib/python3.4/dist-packages/scipy/interpolate/polyint.py", line 60, in __init__
    self._set_yi(yi, xi=xi, axis=axis)
  File "/usr/local/lib/python3.4/dist-packages/scipy/interpolate/polyint.py", line 125, in _set_yi
    raise ValueError("x and y arrays must be equal in length along "
**ValueError: x and y arrays must be equal in length along interpolation axis.**

a bug in kgen.py

hi there
thanks u guys offer such a best code lol
help us a lot!
there is a bug while using sumo-kgen --density, which can't change density
suggest u guys to modify 'sumo/cli/kgen.py' according to the following lines:
106 kpath, kpoints, labels = get_path_data(poscar.structure, mode=mode,
107 symprec=symprec,line_density=density,
108 kpt_list=kpt_list,
109 labels=labels)

Add support for lobster plots

Pymatgen now handles LOBSTER inputs and outputs. Additionally, LOBSTER now supports k-dependent orbital projects.

Apparently the orbital projection is better than the default in VASP.

We should add a lobster plotter module to sumo, with support for the following plots:

  • Orbital projected DOS and band structures using LOBSTER decomposition.
  • Bonding/antibonding projected band structure and density of states plots.

sumo-bandplot --project gives KeyError: <Spin.up: 1>

Hi!
Not sure if this is a problem on my side, however I can not seem to figure out a solution.

I have bandstructures of a Si Ge alloy (one cubic, one tetragonal) with varying composition.
Plotting DOS, bandstats, bandplot etc all works fine and sumo does a great job, thank you all for that!

However when I run let's say
sumo-bandplot --project Ge,Si --ymin -4 --ymax 4
to look at orbital contributions of the individual elements using --projected

all I get is an error in bandstructure.py that ends in
KeyError: <Spin.up: 1>

all calculations are non-spin polarized, does that matter?
I am using the latest sumo version with python3.6 under macos 10.13.6

here is the full error:

File "/Library/Python/3.6/bin/sumo-bandplot", line 10, in <module>
   sys.exit(main())
 File "/Library/Python/3.6/lib/python/site-packages/sumo/cli/bandplot.py", line 548, in main
   dpi=args.dpi, fonts=args.font)
 File "/Library/Python/3.6/lib/python/site-packages/sumo/cli/bandplot.py", line 297, in bandplot
   no_base_style=no_base_style)
 File "/Library/Python/3.6/lib/python/site-packages/sumo/plotting/__init__.py", line 61, in wrapper
   return get_plot(*args, **kwargs)
 File "/Library/Python/3.6/lib/python/site-packages/sumo/plotting/bs_plotter.py", line 365, in get_projected_plot
   normalise='select')
 File "/Library/Python/3.6/lib/python/site-packages/sumo/electronic_structure/bandstructure.py", line 72, in get_projections_by_branches
   projections = get_projections(bs, selection, normalise=normalise)
 File "/Library/Python/3.6/lib/python/site-packages/sumo/electronic_structure/bandstructure.py", line 159, in get_projections
   for nk in range(nkpts)] for nb in range(nbands)]
 File "/Library/Python/3.6/lib/python/site-packages/sumo/electronic_structure/bandstructure.py", line 159, in <listcomp>
   for nk in range(nkpts)] for nb in range(nbands)]
 File "/Library/Python/3.6/lib/python/site-packages/sumo/electronic_structure/bandstructure.py", line 159, in <listcomp>
   for nk in range(nkpts)] for nb in range(nbands)]
KeyError: <Spin.up: 1>

thanks!

Installation Issue

I'm getting no response from the sudo terminal commands when performing the standard pip installation.
Below is the result of my most recent pip installation attempt.
Is it necessary to build from the source files?

Requirement already satisfied: sumo in /home/darnoceloc/.local/lib/python3.6/site-packages (1.0.9)
Requirement already satisfied: h5py in /home/darnoceloc/.local/lib/python3.6/site-packages (from sumo) (2.8.0)
Requirement already satisfied: spglib in /home/darnoceloc/miniconda3/lib/python3.6/site-packages (from sumo) (1.10.3.65)
Requirement already satisfied: pymatgen>=2017.12.30 in /home/darnoceloc/.local/lib/python3.6/site-packages (from sumo) (2018.6.27)
Requirement already satisfied: scipy in /home/darnoceloc/miniconda3/lib/python3.6/site-packages (from sumo) (1.1.0)
Requirement already satisfied: seekpath in /home/darnoceloc/.local/lib/python3.6/site-packages (from sumo) (1.8.1)
Requirement already satisfied: phonopy in /home/darnoceloc/.local/lib/python3.6/site-packages (from sumo) (1.13.2.13)
Requirement already satisfied: numpy in /home/darnoceloc/.local/lib/python3.6/site-packages (from sumo) (1.14.4)
Requirement already satisfied: matplotlib in /home/darnoceloc/.local/lib/python3.6/site-packages (from sumo) (2.2.2)
Requirement already satisfied: six in /home/darnoceloc/miniconda3/lib/python3.6/site-packages (from h5py->sumo) (1.11.0)
Requirement already satisfied: monty>=0.9.6 in /home/darnoceloc/miniconda3/lib/python3.6/site-packages (from pymatgen>=2017.12.30->sumo) (1.0.2)
Requirement already satisfied: palettable>=2.1.1 in /home/darnoceloc/miniconda3/lib/python3.6/site-packages (from pymatgen>=2017.12.30->sumo) (3.1.1)
Requirement already satisfied: ruamel.yaml>=0.15.6 in /home/darnoceloc/miniconda3/lib/python3.6/site-packages (from pymatgen>=2017.12.30->sumo) (0.15.42)
Requirement already satisfied: requests in /home/darnoceloc/miniconda3/lib/python3.6/site-packages (from pymatgen>=2017.12.30->sumo) (2.19.1)
Requirement already satisfied: pandas in /home/darnoceloc/miniconda3/lib/python3.6/site-packages (from pymatgen>=2017.12.30->sumo) (0.23.2)
Requirement already satisfied: tabulate in /home/darnoceloc/miniconda3/lib/python3.6/site-packages (from pymatgen>=2017.12.30->sumo) (0.8.2)
Requirement already satisfied: pydispatcher>=2.0.5 in /home/darnoceloc/miniconda3/lib/python3.6/site-packages (from pymatgen>=2017.12.30->sumo) (2.0.5)
Requirement already satisfied: sympy in /home/darnoceloc/miniconda3/lib/python3.6/site-packages (from pymatgen>=2017.12.30->sumo) (1.1.1)
Requirement already satisfied: future>=0.15 in /home/darnoceloc/.local/lib/python3.6/site-packages (from seekpath->sumo) (0.16.0)
Requirement already satisfied: PyYAML in /home/darnoceloc/miniconda3/lib/python3.6/site-packages (from phonopy->sumo) (3.12)
Requirement already satisfied: kiwisolver>=1.0.1 in /home/darnoceloc/.local/lib/python3.6/site-packages (from matplotlib->sumo) (1.0.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /home/darnoceloc/miniconda3/lib/python3.6/site-packages (from matplotlib->sumo) (2.2.0)
Requirement already satisfied: pytz in /home/darnoceloc/miniconda3/lib/python3.6/site-packages (from matplotlib->sumo) (2018.5)
Requirement already satisfied: cycler>=0.10 in /home/darnoceloc/miniconda3/lib/python3.6/site-packages (from matplotlib->sumo) (0.10.0)
Requirement already satisfied: python-dateutil>=2.1 in /home/darnoceloc/miniconda3/lib/python3.6/site-packages (from matplotlib->sumo) (2.7.3)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /home/darnoceloc/miniconda3/lib/python3.6/site-packages (from requests->pymatgen>=2017.12.30->sumo) (3.0.4)
Requirement already satisfied: idna<2.8,>=2.5 in /home/darnoceloc/miniconda3/lib/python3.6/site-packages (from requests->pymatgen>=2017.12.30->sumo) (2.7)
Requirement already satisfied: urllib3<1.24,>=1.21.1 in /home/darnoceloc/miniconda3/lib/python3.6/site-packages (from requests->pymatgen>=2017.12.30->sumo) (1.23)
Requirement already satisfied: certifi>=2017.4.17 in /home/darnoceloc/miniconda3/lib/python3.6/site-packages (from requests->pymatgen>=2017.12.30->sumo) (2018.4.16)
Requirement already satisfied: setuptools in /home/darnoceloc/miniconda3/lib/python3.6/site-packages (from kiwisolver>=1.0.1->matplotlib->sumo) (39.2.0)

Missing style files

using the bandplot function in the latest version sumo, it may cause some errors. These files (*.mplstyle) need to be added in the following PATH.
/home/tg/.local/lib/python3.6/site-packages/sumo/plotting/sumo_base.mplstyle

Projected band structure issues

Projected band structures currently have the following issues:

  • Cryptic error messages when the projection string is not exactly as expected (e.g. incorrect number of projections, elements/orbitals don't exist, projections don't exist).
  • RGB mode only supports 3 orbitals (not 2 or 1).

bandstats band numbers don't correlate to vasp bands number

The band indices don't correspond to the band indices outputted by VASP. I appreciate this is a python thing starting from 0 etc. but it would be nice if the sumo-bandstats screen output corresponded to the VASP output.

From sumo-bandstats:

Direct band gap: 0.900 eV
k-point: [0.00, 0.00, 0.50]
k-point indexes: 190, 191, 359
Band indexes: 55, 56

From EIGENVAL:

.
.
.

56        4.887403   1.000000
57        6.206457   0.000000
.
.
.



Overlapping symmetry labels in band plots

Originally posted in #25 by @obaica

high symmetry kpoints issue
...If the distance between the two high symmetry points is very close, the following problem will occur in plotting. please see the above picture.

What solution do you propose for this? A workaround at the moment would be to request a larger plot with the --height and --width options, to get relatively smaller text.

I'm not a big fan of pushing labels away from the lines, but in an extreme case such as this it does seem like the only decent solution.

There no f_0 orbital in f electron system

When I use sumo plot pdos, I can not find f_0 orbital, Could you give me some suggestion?
As we know, there are 7 orbitals for f electrons,but I can not find f_0 orbital.
Is it a bug or something I did wrong?
please see the following:

image
This script I use:

dosplot(filename="/scratch/rqzhang/SmB6/SQS/222/MAE/vasprun.xml",
width=a,height=b, lm_orbitals=({'Sm': ('f')}),elements=({"Sm":'d'}),ylabel='PDOS (a.u.)',
legend_cutoff=3,
xmin=-1.5, xmax=0.5,num_columns=1, plot_total=True,legend_frame_on=True

legend problem when total DOS is removed

Hello, the sumo code is extremely useful and I find it very user friendly. I noticed that when I use
"--no-total" the code shows the info from all atoms including even DOS less than 3% ie the default value, this makes the legend and graph so cluttered. Specifically, is it possible to remove the legend and/or solve this problem? Thanks in advance.

y-axis in the DOS plot

hi there,
i wondering if the y-axis in the subplot can be automatically adjust into the reasonable range?
for example, there are two atoms in my system, and A atoms range from 0-5, and B atoms range from 0-10,
which is easy for us to do qualitative analysis.
thanks you and wish ur reply

Cannot plot the band structure

Dear all,

I just installed sumo on my operation system (windows 7).

However, when running the command "sumo-bandplot -h" in the cmd, it can not give the band structure plot as expected and the error "no such command" pops out. Anyone knows what's going on ? Thanks in advance.

Best regards

possibility to project a single atom in band structure

it might be a bit niche, but I was wondering whether it was possible to project a single atom, e.g. Bi.5 (potentially even Bi.5.s.p.d) on the band structure? I know this is something you can do with the DOS options but I was thinking it would be nice to see on the actual bands.

Default argument dos_options causes error

I'm trying to use this right now and I'm finding that a lot of "optional" args are actually required with defaults that are in the CLI code. For instance the dos_options in the bandstructure/dos plotting is by default None in the code. This breaks and I have to set it to a series of values I figured out by scouring the CLI code. The methods should initialize to intelligent defaults if not specified.

having issue with the sumo-bandplot command

I tried to plot band structure with the sumo-bandplot command, but received the following error message:

Traceback (most recent call last):
File "/lustre/home/mdhossa55/anaconda3/bin/sumo-bandplot", line 11, in
load_entry_point('sumo==1.1.2', 'console_scripts', 'sumo-bandplot')()
File "/lustre/home/mdhossa55/anaconda3/lib/python3.6/site-packages/sumo-1.1.2-py3.6.egg/sumo/cli/bandplot.py", line 467, in main
File "/lustre/home/mdhossa55/anaconda3/lib/python3.6/site-packages/pkg_resources/init.py", line 1143, in resource_filename
self, resource_name
File "/lustre/home/mdhossa55/anaconda3/lib/python3.6/site-packages/pkg_resources/init.py", line 1650, in get_resource_filename
return self._extract_resource(manager, zip_path)
File "/lustre/home/mdhossa55/anaconda3/lib/python3.6/site-packages/pkg_resources/init.py", line 1671, in _extract_resource
timestamp, size = self._get_date_and_size(self.zipinfo[zip_path])
KeyError: 'sumo.plotting/orbital_colours.conf'

Could you please let me the possible steps to fix this? Many thanks in advance!

Kind regards,
Anower

Axis label options

Raised by @shyamd in #8 :

it might be a good idea to change the Energy Label to something like E-E_f (eV) when zero'ing to the Fermi level.

I'm not a fan of automatically changing labels in this case, but it would be good to have custom label options. (E.g. I personally prefer my DOS intensity axis to be labelled "DOS".)

I propose that

  • dosplot gains --xlabel and --ylabel arguments
  • bandplot gains --ylabel and --doslabel (for combined band/dos plots)

Plot bandstructure generated with 0-weight SC procedure

I would like to plot a bandstructure which has been generated using the 0-weight (fake) SC procedure outlined here. It would be useful if there was a sumo-bandstats option to plot only the zero-weighted k-points. I'm happy to try and implement this if you could confirm that this is not already possible and agree that this would be a useful enhancement.

Support for Questaal

We've been using the Questaal code and while it does come with some plotting tools the outputs are tricky to customize and don't really fit our house style. This makes it a strong candidate for some support in Sumo.

Desired features

  • Generation of band structure paths
  • Plotting of band structures
  • PDOS plotting
  • Optics plotting

The setup for these calculations is a bit less "fire and forget" than VASP so these will probably have to make some (documented) assumptions about how the calculation is performed.

User interface

I don't have a strong opinion on this. Should they be accessed with the regular tools and a --questaal or --code=questaal flag? Or should there be another sumo-questaal-bandplot script? If the former, then we should aim for feature parity with VASP, or as close as is reasonable.

Implementation notes

Path generation

The code should read an init.ext file and write a syml.ext. Note that init.ext files can be specified with a minimal basis of atoms to which space group operations are applied, so this is not entirely trivial.

Band structures

Sumo's band plotter is built on Pymatgen's band structure object. We should aim to instantiate a BandStructureSymmLine object. This requires k-point positions, eigenvalues, reciprocal lattice vectors, Fermi energy and labels for special points. If using orbital projections then the structure is needed too.

Presumably we should read the k-points and eigenvalues from bnds.ext and the lattice vectors from init.se. Then we don't need to use plbnds at all. What's the best way of obtaining the Fermi energy?

Optics

Questaal provides relatively affordable Bethe-Salpeter calculations, but bethesalpeter only outputs the frequency-dependent dielectric constant; converting to other optical properties is needed through the same relations as for VASP. (We don't need to do the Kramers-Kronig transformation though as both real and imaginary parts are provided.)

The main DFT code lmf offers a range of different optics modes which produce different outputs. Presumably mode 1 (linear imaginary dielectric constant) is the main target? It may be necessary to check the ctrl.ext file to verify that the calculation type is as expected.

Issues in optplot

The refactoring of the optics modules seems to have introduced a number of bugs:

  • The --bandgap option throws an error.
  • When plotting multiple systems simultaneously the output files are named incorrectly: Somehow I now have absorption_0.dat and absorption_0.dat_1.dat.
  • For plotting multiple systems, the automatic label generation no longer works. Previously, it would assign the label as the latex formatted composition. Now it just lists the materials as "1", "2", "3".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.