smtg-bham / galore Goto Github PK
View Code? Open in Web Editor NEWGaussian and Lorentzian smearing of simulated spectra
License: GNU General Public License v3.0
Gaussian and Lorentzian smearing of simulated spectra
License: GNU General Public License v3.0
I think CLI options --no-total
(to hide the solid black line of the total XPS spectrum) and --legend-cutoff
options as available with sumo-dosplot
would be nice additions to the functionality of Galore.
They would be useful options to improve the clarity of output XPS plots, as often the orbital character of the XPS peaks are hidden by the solid black line (if only a single orbital contribution dominates at a given energy range, as is typical) and also the legend often includes many orbital contributions that have negligible contributions to the XPS spectrum.
don't know how easy it is to implement this, but could be quite handy to scale and match the simulated XPS to the experimental xps data in a plot i.e.
As a precursor to interactive cleverness (Issue #7) we should get a basic overlay up-and-running. My initial scope for this is:
--overlay FILENAME
--overlay_offset
and --overlay_scale
for basic alignment tweaksWorking out the appropriate y scale for overlay data is probably going to be a pain. Maybe have a message reporting the automatically estimated value, which makes the maxima the same?
The test case will be rutile SnO2 for comparison with Farahani et al. (2014) https://doi.org/10.1103/PhysRevB.90.155413 - I have a nice DOS calculated with PBE0 which we can use to try and reproduce the plot in the paper.
Galore needs to be added to python path in order to load module 'galore', and doesn't do this automatically.
Thanks for the great package. I have been using it to plot XPS and I would like to suggest a few things:
I initially made the project private as we hadn't discussed it yet. Everyone seems fairly relaxed about making this generally available; are there any key milestones we should be trying to hit before public release or can we follow the "release early, release often" philosophy and open it up now? @scanlond @utf @badw @cnsavory
When a (P)DOS is plotted with no broadening specified from the command line, the plot appears to be filled due to zig-zagging of the resampled line. A small amount of broadening, comparable to the sampling width, would be much less "surprising". If the raw unbroadened output is desired, the user could always set -g=0
, say.
Describe the bug
Plotting PDOS is broken on master (1270488) with error message
tdos = np.zeros(len(next(pdos_data.values())['energy']))
TypeError: 'ValuesView' object is not an iterator
To Reproduce
galore vasprun.xml --pdos -p
Expected behavior
Generate a plot and not an error message
To fix
tdos = np.zeros(len(next(pdos_data.items()[1])['energy']))
should work.See SMTG-Bham/sumo#62 for an identical problem with Sumo
Is your feature request related to a problem? Please describe.
The output of spin-polarised DOS from sumo
doesn't play nicely with the galore
lookup for cross-sections.
Example, the O_dos
file :
O_dos.dat.gz
If I run galore O_dos.dat --plot --pdos --weighting alka
I get Could not find cross-section data for element O, orbital sup. Skipping this orbital.
Describe the solution you'd like
I would like a solution whereby galore
would seamlessly take spin-polarised output from sumo
as input. In the way that it can read the vasprun.xml
.
Describe alternatives you've considered
I can alter the header of the sumo
generated file, but this raises some other probems. E.g. if I change the header to: # energy s s p p d d
The code runs and plots, but I do get the following output, which seems like something has gone wrong:
Orbital cross-section weights per electron:
O s: 9.500e-04
Could not find cross-section data for element O, orbital s_1. Skipping this orbital.
O p: 6.000e-05
Could not find cross-section data for element O, orbital p_1. Skipping this orbital.
Could not find cross-section data for element O, orbital d_1. Skipping this orbital.
Additional context
n/a
would it be possible for galore to automatically default to truetype font so the figure can be edited easily later? I know you can put this in the matplotlibrc file as pdf.fonttype = 42
but I have been spoilt by sumo which has it by default. ;)
apologies for my laziness!
merci,
Ben
It would be pleasant to have an interactive tool for adjusting the broadening and energy offset of ab initio data and overlaid experimental data.
@utf has done some prototyping with Matplotlib widgets already. Javascript-based plots could be a little bit prettier and more responsive, but would require the broadening functions to be re-implemented.
Hello,
Currently galore has the option to provide a plot of the photoionisation cross sections for a specific range of elements using the galore-plot-cs function. However, the output is only provided as a .png file and the format appears to be Matplotlib.
Would it be possible to save the plot as a .csv, .xlsx or .txt file? This would be very useful so that I could plot the graph in a different plotting software (i.e. Origin).
Thanks!
Although I've already written the code to load a DOS from the DOSCAR and POSCAR files, it probably makes sense to write a quick vasprun.xml parser instead. That way only one file is needed for analysis.
The main caveat is that the vasprun.xml file is generally at least an order of magnitude larger than the DOSCAR file. Also, the DOS is given to a greater precision in the DOSCAR file. What do people think?
Describe the bug
If the KPOINTS
file from a vasp
calculation exists and has #
ed comments in it, Galore throws the following error:
File "/usr/local/bin/galore", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.6/site-packages/galore/cli/galore.py", line 56, in main
run(**args)
File "/usr/local/lib/python3.6/site-packages/galore/cli/galore.py", line 74, in run
simple_dos_from_files(**kwargs)
File "/usr/local/lib/python3.6/site-packages/galore/cli/galore.py", line 144, in simple_dos_from_files
x_values, broadened_data = galore.process_1d_data(**kwargs)
File "/usr/local/lib/python3.6/site-packages/galore/__init__.py", line 91, in process_1d_data
xy_data = galore.formats.read_vasprun_totaldos(input)
File "/usr/local/lib/python3.6/site-packages/galore/formats.py", line 446, in read_vasprun_totaldos
dos = read_vasprun(filename)
File "/usr/local/lib/python3.6/site-packages/galore/formats.py", line 321, in read_vasprun
band = vr.get_band_structure()
File "/usr/local/lib/python3.6/site-packages/pymatgen/io/vasp/outputs.py", line 757, in get_band_structure
kpoint_file = Kpoints.from_file(kpoints_filename)
File "/usr/local/lib/python3.6/site-packages/pymatgen/io/vasp/inputs.py", line 1186, in from_file
return Kpoints.from_string(f.read())
File "/usr/local/lib/python3.6/site-packages/pymatgen/io/vasp/inputs.py", line 1214, in from_string
kpts = [int(i) for i in lines[3].split()]
File "/usr/local/lib/python3.6/site-packages/pymatgen/io/vasp/inputs.py", line 1214, in <listcomp>
kpts = [int(i) for i in lines[3].split()]
ValueError: invalid literal for int() with base 10: '#'
To Reproduce
Using the data in the file attached below, run:
galore vasprun.xml
Expected behavior
You should get the error message described above.
Images
System information:
Additional context
The problem can be circumvented by removing the KPOINTS
file entirely, but this does not seem satisfactory and I can certainly imagine that some users may not easily diagnose the cause of this error in the future.
Would it be possible to write out a .dat file of the output convoluted spectrum? Would be handy to be able to have option to plot output in own graph plotting tool/plot with experiment.
Dear developer
I would like to know in which python file shall I look so that I can change the axis size, font, and other stuff? Tks.
with kind regards,
Peter
As per the JOSS Review guidelines, it would be good if you added some info on community guidelines on contribution, posting issues, and seeking support. Doesn't have to be complicated, but always good to be succinct.
It's also a good guide to customize the issue template.
Similar to issue #42, I think a --fill-between
CLI option would be a nice addition to the functionality of Galore, where this gives an output XPS plot with a semi-transparent fill for each orbital contribution (as with sumo-dosplot
) which would aid the clarity of the output plots.
I'll try implement this in my local version of galore
and make a PR soon.
Currently Galore relies on the inbuilt orbital assignment of supported DFT codes, which may not be the best approach. The LOBSTER code can also be used to generate an alternative PDOS assignment; it would be worth evaluating if this is helpful for PES simulation.
An entirely reasonable feature request from @cnsavory .
There should be a way for users to specify a preferred colour palette. Some kind of config file would be more practical than endless command-line strings. I suggest a heirarchy of something like: [file specified as arg] > ./galore.conf
> ~/.galore.conf
> [defaults]
The absolute worst-case for number of lines would be something like a quaternary system with lots of f-orbitals. In this case the automatic palette should do something clever with line styles and markers.
At the moment the width of the Gaussian and Lorentzian functions are the direct values (γ, c) from the functions:
g(x) = exp(-(x-x˳)² / (2 c² ))
l(x) = 0.5 γ / (π (x-x˳)² + (0.5 γ)²)
Would it be better to convert from a specified full-width-half-maximum FWHM value?
From wikipedia:
I think the γ for that Lorentzian form is already equal to the FWHM, but will check that.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.