projector¶
(
- data_context,
- **kwargs
)
The projectors used for atom and orbital resolved quantities.
This is a utility class that facilitates projecting quantities such as the
electronic band structure and the DOS on atoms and orbitals. As a user, you can
investigate the available projections with the to_dict() or selections()
methods. The former is useful for scripts, when you need to know which array
index corresponds to which orbital or atom. The latter describes the available
selections that you can use in the methods that project on orbitals or atoms.
path
project
(
- selection:
str, - projections:
np.ndarray
) → dict
Select a certain subset of the given projections and return them with a suitable label.
Parameters
- selection:
str - selection : str
A string specifying the projection of the orbitals. There are four distinct
possibilities:
-
To specify the atom, you can either use its element name (Si, Al, …) or its index as given in the input file (1, 2, …). For the latter option it is also possible to specify ranges (e.g. 1:4).
-
To select a particular orbital you can give a string (s, px, dxz, …) or select multiple orbitals by their angular momentum (s, p, d, f).
-
For the spin, you have the options up, down, or total.
-
If you used a different k-point mesh choose “kpoints_opt” or “kpoints_wan” to select them instead of the default mesh specified in the KPOINTS file.
You separate multiple selections by commas or whitespace and can nest them using parenthesis, e.g. Sr(s, p) or s(up), p(down). The order of the selections does not matter, but it is case sensitive to distinguish p (angular momentum l = 1) from P (phosphorus).
It is possible to add or subtract different components, e.g., a selection of “Ti(d) - O(p)” would project onto the d orbitals of Ti and the p orbitals of O and then compute the difference of these two selections.
If you are unsure about the specific projections that are available, you can use
>>> calculation.projector.selections() {'atom': [...], 'orbital': [...], 'spin': [...]}to get a list of all available ones.
-
- projections:
np.ndarray - A data array where the first three indices correspond to spin, atom, and orbital, respectively. The selection will be parsed and mapped onto the corresponding dimension.
Returns
dict- Each selection receives a label describing its spin, atom, and orbital, where default choices are skipped. The value associated to the label contains the corresponding subsection of the projections array summed over all remaining spin components, atoms, and orbitals.
read
selections
to_dict
dict
Return a map from labels to indices in the arrays produced by VASP.
Returns
dict- A dictionary containing three dictionaries for spin, atom, and orbitals. Each of those describes which indices VASP uses to store certain elements for projected quantities. If VASP was run without setting LORBIT this will return an empty dictionary.
Examples
For nonpolarized SrTiO3 with LORBIT = 10, this would work like this
>>> calculation.projector.to_dict()
{
"atom": {
"Sr": slice(0, 1),
"Ti": slice(1, 2),
"O": slice(2, 5),
"1": slice(0, 1),
"2": slice(1, 2),
"3": slice(2, 3),
"4": slice(3, 4),
"5": slice(4, 5),
},
"orbital": {
"s": slice(0, 1),
"p": slice(1, 2),
"d": slice(2, 3),
"f": slice(3, 4),
},
"spin": {
"total": slice(0, 1),
}
}