nics

py4vasp.calculation.nics

(

  • data_context,
  • **kwargs

)

This class accesses information on the nucleus-independent chemical shift (NICS).

path

Returns the path from which the output is obtained.

plot

(*args, **kwargs) → View

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

View
A visualization of the quantity within the crystal structure.

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 chemical shift.

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

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.
selection: str | None = None
Axis along which to plot. Can be one of “xx”, “xy”, … Can also be “isotropic” to plot the trace. If selection is None, it defaults to “isotropic”.
supercell: int | np.ndarray = None
If present the data is replicated the specified number of times along each direction.

Returns

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

Examples

>>> from py4vasp import calculation

Cut a plane through the isotropic chemical shift at the origin of the third lattice vector.

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

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

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

Take a slice of the chemical shift with “xy” selection along the first lattice vector and rotate it such that the plane normal aligns with the x axis.

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

Cut a plan through the isotropic chemical shift at the origin of the third lattice vector, then show isosurface level values along contour lines.

>>> plot = calculation.nics.to_contour(c=0, selection=0.3, normal="x")
>>> plot.series[0].show_contour_values = True
>>> plot.show()

to_dict

() → dict

Read NICS into a dictionary.

Returns

dict
Contains the structure information as well as the nucleus-independent chemical shift represented on a grid in the unit cell.

to_ngl

(*args, **kwargs) → NGLWidget

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

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

to_numpy

(selection: str | None = None) → np.ndarray

Convert NICS to a numpy array.

The resulting shape will be the NICS grid data with respect to the selection.

Parameters

selection: str | None = None
The tensor element(s) to extract. Can be None (in which case the whole tensor is returned), isotropic, or one of “xx”, “xy”, …

Returns

np.ndarray
All components of NICS.

to_vasp_viewer

(*args, **kwargs) → VASPViewerWidget

Convert the view to a VASP Viewer widget.

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

Returns

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

to_view

(

  • selection: str | None = None,
  • supercell: int | np.ndarray = None,
  • **user_options

) → View

Plot the selected chemical shift as a 3d isosurface within the structure.

Parameters

selection: str | None = None
Axis along which to plot. Can be one of “xx”, “xy”, … Can also be “isotropic” to plot the trace. If selection is None, it defaults to “isotropic”.
supercell: int | np.ndarray = None
If present the data is replicated the specified number of times along each direction.
**user_options
Further arguments with keyword that get directly passed on to the visualizer. Most importantly, you can set isolevel to adjust the value at which the isosurface is drawn.

Returns

View
Visualize an isosurface of the selected chemical shift within the 3d structure.

Examples

>>> from py4vasp import calculation

Plot the isotropic chemical shift as a 3d isosurface.

>>> calculation.nics.plot()

Plot the chemical shift with “xx” selection as a 3d isosurface.

>>> calculation.nics.plot(selection="xx")

Plot the isotropic chemical shift with specified isolevel as a 3d isosurface.

>>> calculation.nics.plot(isolevel=0.6)