Basis set#

This module provides the Basis class which is assigned as a part of SpinSystem object upon its instantiation. Here is an example of accessing the most important functionality of the class:

import spinguin as sg                   # Import the package
spin_system = sg.SpinSystem(["1H"])     # Create an example spin system
spin_system.basis.max_spin_order = 1    # Set the maximum spin order
spin_system.basis.build()               # Build the basis set
class Basis(spin_system: SpinSystem)[source]#

Basis class manages the basis set of a spin system. Most importantly, the basis set contains the information on the truncation of the basis set and is responsible for building and making changes to the basis set.

property basis: ndarray#

Contains the actual basis set as an array of dimensions (N, M) where N is the number of states in the basis and M is the number of spins in the system. The basis set is constructed from Kronecker products of irreducible spherical tensor operators, which are indexed using integers starting from 0 with increasing rank l and decreasing projection q:

  • 0 –> T(0, 0)

  • 1 –> T(1, 1)

  • 2 –> T(1, 0)

  • 3 –> T(1, -1) and so on…

build()[source]#

Builds the basis set for the spin system. Prior to building the basis, the maximum spin order should be defined. If it is not defined, it is set equal to the number of spins in the system (may be very slow)!

property dim: int#

Dimension of the basis set.

property max_spin_order: int#

Specifies the maximum number of a active spins that are included in the product operators that constitute the basis set. Must be at least 1 and not larger than the number of spins in the system.

truncate_by_coherence(coherence_orders: list, *objs: ndarray | csc_array) None | ndarray | csc_array | tuple[ndarray | csc_array][source]#

Truncates the basis set by retaining only the product operators that correspond to coherence orders specified in the coherence_orders list.

Optionally, superoperators or state vectors can be given as input. These will be converted to the truncated basis.

Parameters:

coherence_orders (list) – List of coherence orders to be retained in the basis.

Returns:

objs_transformed – Superoperators and state vectors transformed into the truncated basis.

Return type:

ndarray or csc_array or tuple