magnetism

py4vasp.calculation.magnetism
class py4vasp.calculation._magnetism.Magnetism(*args, **kwargs)

The local moments describe the charge and magnetization near an atom.

The projection on local moments is particularly relevant in the context of magnetic materials. It analyzes the electronic states in the vicinity of an atom by projecting the electronic orbitals onto the localized projectors of the PAWs. The local moments help understanding the magnetic ordering, the spin polarization, and the influence of neighboring atoms on the magnetic behavior.

This class allows to access the computed moments from a VASP calculation. Remember that VASP calculates the projections only if you need to set LORBIT in the INCAR file. If the system is computed without spin polarization, the resulting moments correspond only to the local charges resolved by angular momentum. For collinear calculation, additionally the magnetic moment are computed. In noncollinear calculations, the magnetization becomes a vector. When comparing the results extracted from VASP to experimental observation, please be aware that the finite size of the radius in the projection may influence the observed moments. Hence, there is no one-to-one correspondence to the experimental moments.

Examples

If you access a method of this class, the result will depend on the steps that you selected with the [] operator. Without any selection the results from the final step will be used.

>>> calc.magnetism.read()

To select the results for all steps, you don’t specify the array boundaries.

>>> calc.magnetism[:].read()

You can also select specific steps or a subset of steps as follows

>>> calc.magnetism[5].read()
>>> calc.magnetism[1:6].read()
charges()

Read the charges of the selected steps.

Returns:

Contains the charges for the selected steps projected on atoms and orbitals.

Return type:

np.ndarray

Examples

If you access this method, the result will depend on the steps of the class that you selected with the [] operator. Without any selection the results from the final step will be used.

>>> calc.magnetism.charges()

To select the results for all steps, you don’t specify the array boundaries.

>>> calc.magnetism[:].charges()

You can also select specific steps or a subset of steps as follows

>>> calc.magnetism[5].charges()
>>> calc.magnetism[1:6].charges()
length_moments = 1.5

Length in Å how a magnetic moment is displayed relative to the largest moment.

moments(selection='total')

Read the magnetic moments of the selected steps.

Parameters:

selection (str) – If VASP was run with LORBMOM = T, the orbital moments are computed and the routine will default to the total moments. You can specify “spin” or “orbital” to select the individual contributions instead.

Returns:

Contains the magnetic moments for the selected steps projected on atoms and orbitals.

Return type:

np.ndarray

Notes

The index order is different compared to the raw data when noncollinear calculations are used. This routine returns the magnetic moments as (steps, atoms, orbitals, directions).

Examples

If you access this method, the result will depend on the steps of the class that you selected with the [] operator. Without any selection the results from the final step will be used.

>>> calc.magnetism.moments()

To select the results for all steps, you don’t specify the array boundaries.

>>> calc.magnetism[:].moments()

You can also select specific steps or a subset of steps as follows

>>> calc.magnetism[5].moments()
>>> calc.magnetism[1:6].moments()
plot(*args, **kwargs)

Wrapper around to_view() method.

This method will visualize the quantity in the structure. Please refer to the to_view() method for a documentation of the allowed arguments.

Returns:

A visualization of the quantity within the crystal structure.

Return type:

View

print()

Print a string representation of this instance.

read(*args, **kwargs)

Convenient wrapper around to_dict. Check that function for examples and optional arguments.

selections()

Returns possible alternatives for this particular quantity VASP can produce.

The returned dictionary contains a single item with the name of the quantity mapping to all possible selections. Each of these selection may be passed to other functions of this quantity to select which output of VASP is used.

Returns:

The key indicates this quantity and the values possible choices for arguments to other functions of this quantity.

Return type:

dict

to_dict()

Read the charges and magnetization data into a dictionary.

Returns:

Contains the charges and magnetic moments generated by VASP projected on atoms and orbitals.

Return type:

dict

Notes

The index order is different compared to the raw data when noncollinear calculations are used. This routine returns the magnetic moments as (steps, atoms, orbitals, directions).

Examples

If you access this method, the result will depend on the steps of the class that you selected with the [] operator. Without any selection the results from the final step will be used.

>>> calc.magnetism.to_dict()

To select the results for all steps, you don’t specify the array boundaries.

>>> calc.magnetism[:].to_dict()

You can also select specific steps or a subset of steps as follows

>>> calc.magnetism[5].to_dict()
>>> calc.magnetism[1:6].to_dict()
to_ngl(*args, **kwargs)

Convert the view to an NGL widget.

This method wraps the to_view() method and converts the resulting View to an NGL widget. The to_view() method documents all the possible arguments of this function.

Returns:

A widget to display the structure and other quantities in the unit cell.

Return type:

NGLWidget

to_view(selection='total', supercell=None)

Visualize the magnetic moments as arrows inside the structure.

Parameters:

selection (str) – If VASP was run with LORBMOM = T, the orbital moments are computed and the routine will default to the total moments. You can specify “spin” or “orbital” to select the individual contributions instead.

Returns:

Contains the atoms and the unit cell as well as an arrow indicating the strength of the magnetic moment. If noncollinear magnetism is used the moment points in the actual direction; for collinear magnetism the moments are aligned along the z axis by convention.

Return type:

View

Examples

If you access this method, the result will depend on the steps of the class that you selected with the [] operator. Without any selection the results from the final step will be used.

>>> calc.magnetism.to_view()

To select the results for all steps, you don’t specify the array boundaries.

>>> calc.magnetism[:].to_view()

You can also select specific steps or a subset of steps as follows

>>> calc.magnetism[5].to_view()
>>> calc.magnetism[1:6].to_view()
total_charges()

Read the total charges of the selected steps.

Returns:

Contains the total charges for the selected steps projected on atoms. This corresponds to the charges summed over the orbitals.

Return type:

np.ndarray

Examples

If you access this method, the result will depend on the steps of the class that you selected with the [] operator. Without any selection the results from the final step will be used.

>>> calc.magnetism.total_charges()

To select the results for all steps, you don’t specify the array boundaries.

>>> calc.magnetism[:].total_charges()

You can also select specific steps or a subset of steps as follows

>>> calc.magnetism[5].total_charges()
>>> calc.magnetism[1:6].total_charges()
total_moments(selection='total')

Read the total magnetic moments of the selected steps.

Parameters:

selection (str) – If VASP was run with LORBMOM = T, the orbital moments are computed and the routine will default to the total moments. You can specify “spin” or “orbital” to select the individual contributions instead.

Returns:

Contains the total magnetic moments for the selected steps projected on atoms. This corresponds to the magnetic moments summed over the orbitals.

Return type:

np.ndarray

Notes

The index order is different compared to the raw data when noncollinear calculations are used. This routine returns the magnetic moments as (steps, atoms, orbitals, directions).

Examples

If you access this method, the result will depend on the steps of the class that you selected with the [] operator. Without any selection the results from the final step will be used.

>>> calc.magnetism.total_moments()

To select the results for all steps, you don’t specify the array boundaries.

>>> calc.magnetism[:].total_moments()

You can also select specific steps or a subset of steps as follows

>>> calc.magnetism[5].total_moments()
>>> calc.magnetism[1:6].total_moments()