SMTG-Bham / sumo

Heavyweight plotting tools for ab initio calculations
https://smtg-bham.github.io/sumo/
MIT License
205 stars 81 forks source link

Support for Questaal #31

Closed ajjackson closed 5 years ago

ajjackson commented 6 years ago

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

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.

ajjackson commented 6 years ago

Pymatgen has support for the Stuttgart LMTO code which has common ancestry with Questaal and similar flags. Unfortunately _pymatgen.io.lmto.LMTOCtrl.fromfile() does not seem to be able to read a valid init.ext file directly.

cnsavory commented 6 years ago

Re: the Fermi energy for band structures, isn't it included at the top of the bnds.ext file?

cnsavory commented 6 years ago

Regarding the optics - one of questaal's interesting modes is that it can plot a joint density of states, which would be nice to have and plot if possible, as well as the dielectric etc.

ajjackson commented 6 years ago

It gets worse: we need to use Questaal's pre-processor to read input files as users are encouraged to fill them with macros.

ajjackson commented 6 years ago

(For anyone interested in using this, "plotting of band structures" is working fine in the default mode. It just needs another session of testing to be sure all the Cartesian/units cases are handled correctly before it can be ticked off.)

cnsavory commented 5 years ago

RE: discussion tonight, option for multiple/mixed input of VASP and Questaal outputs for comparison optical plots in sumo-optplot?

ajjackson commented 5 years ago

Request from @jbuckeridge : if reading opt.ext and generating real part of dielectric function, automatically save an eps_real.dat file. Much as I'm wary of writing files without prompting, this one seems very useful and fairly harmless. Will do.

ajjackson commented 5 years ago

Both of those optics features are now implemented: we can mix-n-match Questaal and Vasp optics by providing a list of options e.g. sumo-optplot -f opt.ext vasprun.xml -c questaal vasp --bandgaps 0.617 vasprun.xml --labels QSGW PBE0

utf commented 5 years ago

The mixed Questaal/VASP optics plotting is really cool! Thanks for this @ajjackson.

ajjackson commented 5 years ago

DOS plotting is in! Support should be fairly comprehensive but a few compromises and rough edges remain. See the lengthy commit notes here:

https://github.com/SMTG-UCL/sumo/commit/3d45945c75aab987fbba6d69349e2e79638e0037

A little refactoring is probably in order to make more sense of the project structure: specifically a good chunk of electronic_structure.dos is actually Vasp-specific and should maybe be moved to a new sumo.io.vasp . I'm happy to leave that for a rainy day, perhaps once the Questaal interface is feature-complete and we can take a step back and think about the future of code interfaces in Sumo. Building this interface has been a good education in hacking Pymatgen; so far it has all been possible but the shadow of Vasp is very visible in some of the decisions (e.g. there are no g-orbitals in the Orbital object which is required to structure a PDOS.)

cnsavory commented 5 years ago

Something coming up from the Questaal workshop - sumo currently isn't able to plot Questaal derived band structures separated by orbital contribution, as it can for VASP. The fplot implementation involves a separate run for the selected orbital but still outputs one bnds file, so hopefully wouldn't change the sumo workflow too much. Could band projection for Questaal band structures be a possible option for a future sumo release?

ajjackson commented 5 years ago

If there's a sensible workflow to get the information out, it shouldn't be too hard to "do it like vasp". I think we can improve the final appearance from Vasp too, but that part should be shared in any case.

Do we have a consistent recipe for getting a known set of useful information? As with the DOS plotter, I'd rather we keep the sumo settings simple, generate a lot of data and deal with summing etc in sumo if need be. I'm a little worried by the prospect of multiple Questaal runs, do you have to rename any files to avoid clobbering?

ajjackson commented 5 years ago

Closing this for now as initial objectives have been hit and infrastructure is in the main code. Further enhancements can happen but deserve their own Issue pages.