current_density

py4vasp.calculation.current_density

(

  • data_context,
  • **kwargs

)

Represents current density on the grid in the unit cell.

A current density j is a vectorial quantity (j_x, j_y, j_z) on every grid point. It describes how the current flows at every point in space.

path

Returns the path from which the output is obtained.

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

() → dict

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. Some quantities provide additional elements which can be passed as selection for other routines.

Returns

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

to_contour

(

  • selection: str | None = None,
  • a: float = None,
  • b: float = None,
  • c: float = None,
  • normal: str | None = None,
  • supercell: int | np.ndarray = None

) → graph

Generate a contour plot of current density.

You need to specify a plane defined by two of the lattice vectors by selecting a cut along the third one. You must only select a single cut and the value should correspond to the fractional length along this third lattice vector. py4vasp will then create a plane from the other two lattice vectors and generate a contour plot within this plane.

Usually, the first remaining lattice vector is aligned with the x-axis and the second one such that the angle between the vectors is preserved. You can overwrite this choice by defining a normal direction. Then py4vasp will rotate the normal vector of the plane to align with the specified direction. This is particularly useful if the lattice vector you cut is aligned with a Cartesian direction.

Parameters

selection: str | None = None
Selects which of the possible available currents is used. Check the selections method for all available choices.
a: float = None
You must select exactly one of these to specify which of the three lattice vectors you want to remove to form a plane. The assigned value represents the fractional length along this lattice vector, so a = 0.3 will remove the first lattice vector and then take the grid points at 30% of the length of the first vector in the b-c plane. The fractional height uses periodic boundary conditions.
b: float = None
You must select exactly one of these to specify which of the three lattice vectors you want to remove to form a plane. The assigned value represents the fractional length along this lattice vector, so a = 0.3 will remove the first lattice vector and then take the grid points at 30% of the length of the first vector in the b-c plane. The fractional height uses periodic boundary conditions.
c: float = None
You must select exactly one of these to specify which of the three lattice vectors you want to remove to form a plane. The assigned value represents the fractional length along this lattice vector, so a = 0.3 will remove the first lattice vector and then take the grid points at 30% of the length of the first vector in the b-c plane. The fractional height uses periodic boundary conditions.
normal: str | None = None
If not set, py4vasp will align the first remaining lattice vector with the x-axis and the second one such that the angle between the lattice vectors is preserved. You can set it to “x”, “y”, or “z”; then py4vasp will rotate the plane in such a way that the normal direction aligns with the specified Cartesian axis. This may look better if the normal direction is close to a Cartesian axis. You may also set it to “auto” so that py4vasp chooses a close Cartesian axis if it can find any.
supercell: int | np.ndarray = None
Replicate the contour plot periodically a given number of times. If you provide two different numbers, the resulting cell will be the two remaining lattice vectors multiplied by the specific number.

Returns

graph
A current density plot in the plane spanned by the 2 remaining lattice vectors.

Examples

Cut a plane at the origin of the third lattice vector.

>>> calculation.current_density.to_contour(c=0)

Replicate a plane in the middle of the second lattice vector 2 times in each direction.

>>> calculation.current_density.to_contour(b=0.5, supercell=2)

Take a slice along the first lattice vector and rotate it such that the normal of the plane aligns with the x axis.

>>> calculation.current_density.to_contour(a=0.3, normal="x")

to_dict

() → dict

Read the current density and structural information into a Python dictionary.

Returns

dict
Contains all available current density data as well as structural information.

to_quiver

(

  • selection: str | None = None,
  • a: float = None,
  • b: float = None,
  • c: float = None,
  • normal: str | None = None,
  • supercell: int | np.ndarray = None

) → graph

Generate a quiver plot of current density.

You need to specify a plane defined by two of the lattice vectors by selecting a cut along the third one. You must only select a single cut and the value should correspond to the fractional length along this third lattice vector. py4vasp will then create a plane from the other two lattice vectors and generate a contour plot within this plane.

Usually, the first remaining lattice vector is aligned with the x-axis and the second one such that the angle between the vectors is preserved. You can overwrite this choice by defining a normal direction. Then py4vasp will rotate the normal vector of the plane to align with the specified direction. This is particularly useful if the lattice vector you cut is aligned with a Cartesian direction.

Parameters

selection: str | None = None
Selects which of the possible available currents is used. Check the selections method for all available choices.
a: float = None
You must select exactly one of these to specify which of the three lattice vectors you want to remove to form a plane. The assigned value represents the fractional length along this lattice vector, so a = 0.3 will remove the first lattice vector and then take the grid points at 30% of the length of the first vector in the b-c plane. The fractional height uses periodic boundary conditions.
b: float = None
You must select exactly one of these to specify which of the three lattice vectors you want to remove to form a plane. The assigned value represents the fractional length along this lattice vector, so a = 0.3 will remove the first lattice vector and then take the grid points at 30% of the length of the first vector in the b-c plane. The fractional height uses periodic boundary conditions.
c: float = None
You must select exactly one of these to specify which of the three lattice vectors you want to remove to form a plane. The assigned value represents the fractional length along this lattice vector, so a = 0.3 will remove the first lattice vector and then take the grid points at 30% of the length of the first vector in the b-c plane. The fractional height uses periodic boundary conditions.
normal: str | None = None
If not set, py4vasp will align the first remaining lattice vector with the x-axis and the second one such that the angle between the lattice vectors is preserved. You can set it to “x”, “y”, or “z”; then py4vasp will rotate the plane in such a way that the normal direction aligns with the specified Cartesian axis. This may look better if the normal direction is close to a Cartesian axis. You may also set it to “auto” so that py4vasp chooses a close Cartesian axis if it can find any.
supercell: int | np.ndarray = None
Replicate the contour plot periodically a given number of times. If you provide two different numbers, the resulting cell will be the two remaining lattice vectors multiplied by the specific number.

Returns

graph
A quiver plot in the plane spanned by the 2 remaining lattice vectors.

Examples

Cut a plane at the origin of the third lattice vector.

>>> calculation.current_density.to_quiver(c=0)

Replicate a plane in the middle of the second lattice vector 2 times in each direction.

>>> calculation.current_density.to_quiver(b=0.5, supercell=2)

Take a slice along the first lattice vector and rotate it such that the normal of the plane aligns with the x axis.

>>> calculation.current_density.to_quiver(a=0.3, normal="x")