Skip to content

Spinor projection #24

Description

@Chengcheng-Xiao

Problem

With --lsorbit and --spin one can plot the spin components along a specific direction (x, y, z). However, If one doesn't use --occL option, the negative values in the projection (corresponds to the spin "down" state) is by default discarded and the plot will miss almost half of the weights.

For example:

Plotted with (BCC Iron):

pyband -y -10 10 --occ '1' --lsorbit --spin z

Benefit of fixing this

The only benefit of not using the line collection plot for this use scenario that if we also want to set --spd, then zero weighted points will disappear in scatter plot while in the line collection plot they will show up the same as spin flipping points. i.e.:

Plotted with (BCC Iron):

pyband -y -10 10 --occ '1' --spd 'p'  --lsorbit --spin z --occL --occLC_cbar_vmin -1 --occLC_cbar_vmax 1

Proposed solution

Obviously this use scenario is better suited with --occL so the easiest way is to issue an error or select --occL automatically if --lsorbit and --spin option is used together.

So, to enable this feature, one could override the user selected occMarkerColor (and issue a warning) and set the positive values to red and negative values to blue while retaining the weight based size for points by taking the absolute value of the weight. As a side note, I think only use red and blue is enough since these plots already have too many information on them and I doubt people would want to show multiple contributions from atomic orbitals alongside spin informations....

To do this, change these lines in bandplot to:

                if whts is not None:
                    for ii in range(len(opts.occ)):
                        color = ['red' if weight > 0 else 'blue' for weight in whts[ii][Ispin, :, Iband]]
                        ax.scatter(kpath, bands[Ispin, :, Iband],
                                   color=color,#opts.occMarkerColor[ii],
                                   s=np.abs(whts[ii][Ispin, :, Iband]) *
                                   opts.occMarkerSize[ii],
                                   marker=opts.occMarker[ii], zorder=1, lw=0.0,
                                   alpha=0.5)

The proposed solution yields:

Plotted with (BCC Iron):

pyband -y -10 10 --occ '1' --lsorbit --spin z

And:

Plotted with (BCC Iron):

pyband -y -10 10 --occ '1' --spd 'p'  --lsorbit --spin z

If you think this is good enough, I'll submit a pull request and add this use scenario to the README file. 🤓

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions