Page 1 of 1

MS values in levelsplot

Posted: Thu Aug 01, 2024 6:25 am
by friedrich95

Hello,
is there an easy way to assign the MS levels to the energy levels that are plottet in the levelsplot?

Thank you very much


Re: MS values in levelsplot

Posted: Thu Aug 01, 2024 9:40 pm
by Stefan Stoll

Not directly, but it is possible to color the levels by their |mS| value, i.e. the magnitude of the expectation value of the spin operator S_zL, where zL is the lab z axis along the magnetic field.

For this, use the option Opt.SlopeColor = true.

Here is an example:

Code: Select all

clear, clc

Sys.S = 7/2;
Sys.D = 1000;

Opt.SlopeColor = true;
levelsplot(Sys,'xy',[0 300],[],Opt);

Re: MS values in levelsplot

Posted: Sat Aug 03, 2024 8:15 am
by thanasis

That's a really nice addition!

Is there a way to define a custom color palette for the various ms values?

Thanks,

Thanasis


Re: MS values in levelsplot

Posted: Thu Oct 10, 2024 5:00 pm
by Stefan Stoll

Unfortunately no. The color is hard-wired. You could change it manually after using get(gca,'Children'), but that's probably quite tedious.


Re: MS values in levelsplot

Posted: Thu Oct 17, 2024 12:59 am
by thanasis

Thanks for this Stefan.

In levelsplot, line 197 I changed:

Code: Select all

 colormap(flipud(parula)); -->   colormap(flipud(Opt.ColorMap));

and I gave a new option when I invoke the command:

Code: Select all

Opt.ColorMap = jet;

The only workaround I needed when doing this was to copy letter2vec.m from private to the functions directory (for some reason it needed that particular function and could not find it, even after an easyspin compile).
The result is as expected for the jet color palette:

Selection_574.png
Selection_574.png (18.88 KiB) Viewed 15961 times

Would that be compatible to permanently include in the levelsplot code?

All the best


Re: MS values in levelsplot

Posted: Thu Oct 17, 2024 2:55 pm
by Stefan Stoll

This looks like a reasonable addition. Could you please prepare a PR for this on GitHub?


Re: MS values in levelsplot

Posted: Fri Oct 18, 2024 12:58 am
by thanasis

OK, but I am a git novice: if I understand, I either need to be invited as collaborator to your repo, or fork it and work on my fork. If so, which of the two do you suggest?


Re: MS values in levelsplot

Posted: Sat Oct 19, 2024 2:23 pm
by Stefan Stoll

Fork the repo, make a branch in your fork, and then make a PR from your fork/branch to the main branch of EasySpin.