Solver selection

Before solving a problem, a Hamiltonian must first be defined. For more details, refer to Hamiltonian. Once the Hamiltonian is set, the appropriate solver must be chosen. There are two approaches:
  • Use sigspace.Solver(), which automatically selects the most suitable solver based on the given Hamiltonian.

  • Manually create a solver object. A list of available solvers is provided below.

Manual

sigspace.Solver(H: Hamiltonian)

The solver function determines the most appropriate solver based on the given Hamiltonian. It creates an instance of the selected solver, and raises an exception if no suitable solver is found. :param H: The Hamiltonian which shall be solved :return: An instance of a solver.

1D Schrödinger Equation

class sigspace.Solver1D(H: Hamiltonian)

The solver for one dimensional problems. It can compute ground, excited or bloch states, depending on the node specification (see properties below).

Parameters:

Hamiltonian (Hamiltonian) – The Hamiltonian to be solved.

alpha

Damping factor. Controls the stepsize of the solver. It should normally by smaller then 1. Further reduce it if you have convergence issues. Too low parameters will result in high iteration numbers.

config()

Provides configuration of solver.

Returns:

Returns a dictionary of all public properties of the solver.

grid(start=None, stop=None, num=None)
Creates an equally spaced 1D grid. If potential functions are provided solely through callbacks, grid() must

be called. Either specify start, stop, num or x_pts (x_pts is a tuple of (start, stop, num)).

Parameters:
  • start (float) – Lower limit of space to solve.

  • stop (float) – Upper limit of space to solve.

  • num (int) – Number of points.

  • x_pts (tuple, optional) – Tuple with (start, stop, num) points.

max_iterations

Maximum number of iterations. If max_iterations is reached, solver aborts (default is infinity)

meta

Dict to add meta information to the solver. It can be used to store additional data on the purpose of the simulation. After completion of solve, it is also stored in solution.

property nodes

Use to specify type, location and optimization of nodes to be included in solution. See NodeSpecification1D for more details.

print_info

If is True a short summary will be printed after solver completes (default is False)

print_iter

Specifies after how many iterations a short information shall be printed on the status of the solver (default is infinity => no infos will be printed)

run()

Solves the wave function for the given Hamiltonian.

Returns:

Returns a solution object that summarizes all results.

Return type:

Solution1D

property solver_type
stop_error

If residual (remaining error) drops below stop_error, solver aborts (default is 1e-2)

class sigspace.solver.Solver1D.NodeSpecification1D(nodes=None)

This object is accessible via the nodes property of the solver. It specifies the nodes which the solver shall include in the solution. For one-dimensional problems, the following node types are supported: PointNode, BlochNode.

__len__()
__getitem__()
add(other)

Add a node to be considered by the solver

Parameters:

other – Node object to be added.

get_type(type)

Provides a list of nodes of a specific type.

Parameters:

type – The type of node to be returned.

Returns:

List of nodes

Return type:

Nodes list of the specified type.

remove(idx)

Deletes a specified node.

Parameters:

idx – Removes node at position idx.

summary()

Gives a detailed summary of the nodes

Returns:

Returns a string with the summary.

Return type:

str

class sigspace.PointNode(count=1, pos=None, fixed=False)

This is the standard node type for one-dimensional problems. The node represents a point-like zero crossing. A solution may contain multiple point nodes. To simplify the process, you can directly specify the desired number of zero crossings.

Parameters:
  • count (int) – Number of zero crossings which shall be included in the wave function.

  • pos (array of size count, optional) – Position of nodes

  • fixed (bool, optional) – If set to true the node positions are fixed and are not optimized (default False).

property count

Returns the number of zero crossings which shall be in the wave function.

property fixed

Returns True if node position is not optimized during run

property position

Returns the initial position of the node

class sigspace.BlochNode(k)

Requests the solver to calculate a wave function that satisfies the Bloch function $ \psi = u(x) e^{ikx} $. For more details, refer to the Bloch theorem for more information. This also involves setting periodic boundary conditions. Note that this type of node cannot be combined with other node types.

Parameters:

k (float) – The wave number k of the bloch function.

property k

Returns the wave number of the bloch function.

class sigspace.Solution1D(H, data, pos_state, val_state, nodes)

Solution of a one-dimensional eigenvalue problem. The object includes the numeric results and meta-data from the solver. The object is returned from run().

property H

Copy of Hamiltonian which describes solved problem

property energy

Energy of the wave function

property iterations

Total number of iterations which were needed to solve problem.

property residual

Residual error of solution

property solver_config

Stored configuration which was used by solver

property state

The quantum state of the solution. See State1D for more information.

property time

Total elappsed real time which was needed to solve problem

property timestamp

Timestamp when solver was started

property units

Selected units set

property wave

Wave function of solution. See Wave1D for more information

class sigspace.solver.Solver1D.State1D(*args, **kwargs)

This object represents the quantum state of the solution. It has a few methods to access its values, but mostly it can be modified by application of operators. To get an overview how to apply operators, please have a look at the Bra-ket tutorial.

The values of the state can be accessed via the [] operator.

It is returned as a member of Solution1D.

class sigspace.solver.Solver1D.Wave1D(pts, wave_function, energy=None, nodes=None)

Wave1D describes the wave function of an eigenvalue problem. It is returned as a member of Solution1D. It provides methods to modify and evaluate the wave function.

conj(pts=None)

Conjugate wave function.

Parameters:

pts (optional) – Points at which wave function shall be returned.

Returns:

Returns the conjugated wave function.

density(pts=None)

Retrieves the absolute square of the wave function (probability density). Identical to square() in 1D.

Parameters:

pts (optional) – Points at which wave function shall be returned.

Returns:

Returns squared wave function.

is_normalized()

Returns true if wave function is normalized

Returns:

Always true for one-dimensional wave functions.

normalize()

Normalize wave function.

Returns:

No value.

square(pts=None)

Retrieves the absolute square of the wave function (probability density).

Parameters:

pts (optional) – Points at which wave function shall be returned.

Returns:

Returns squared wave function.

property x

Grid points of solved problem (1D numpy array)

2D Schrödinger Equation

class sigspace.Solver2D(H: Hamiltonian)

The solver for two-dimensional problems. It can compute ground and excited states (only planar nodes).

Parameters:

Hamiltonian (Hamiltonian) – The Hamiltonian to be solved.

alpha

Damping factor. Controls the stepsize of the solver. It should normally by smaller then 1. Further reduce it if you have convergence issues. Too low parameters will result in high iteration numbers.

config()

Provides configuration of solver.

Returns:

Returns a dictionary of all public properties of the solver.

grid(x_pts: tuple, y_pts=None)

Creates an equally spaced 2D mesh grid. Function takes tuple of (start, stop, num). If only one is specified then the values are used for both dimensions.

Parameters:
  • x_pts (tuple of the form (start, stop, num)) – Specifies grid along x-axis

  • y_pts (tuple of the form (start, stop, num)) – Specifies grid along y-axis. If not specified, x_pts will be used.

max_iterations

Maximum number of iterations. If max_iterations is reached, solver aborts (default is infinity)

meta

Dict to add meta information to the solver. It can be used to store additional data on the purpose of the simulation. After completion of solve, it is also stored in solution.

property nodes

Use to specify type, location and optimization of nodes to be included in solution. See NodeSpecification2D for more details.

print_info

If is True a short summary will be printed after solver completes (default is False)

print_iter

Specifies after how many iterations a short information shall be printed on the status of the solver (default is infinity => no infos will be printed)

run()

Solves the wave function for the given Hamiltonian.

Returns:

Returns a solution object that summarizes all results.

Return type:

Solution2D

property solver_type
stop_error

If residual (remaining error) drops below stop_error, solver aborts (default is 1e-2)

class sigspace.Solution2D(H, data, shape, pts, wave, estimated_planar_nodes)

Solution of a two-dimensional eigenvalue problem. The object includes the numeric results and meta-data from the solver. The object is returned from run().

property H

Copy of Hamiltonian which describes solved problem

property energy

Energy of the wave function

estimate_nodes()

Estimates which possible node shapes can be applied to the problem.

Returns:

An array of possible node configurations.

property iterations

Total number of iterations which were needed to solve problem.

property residual

Residual error of solution

property solver_config

Stored configuration which was used by solver

property state

The quantum state of the solution. See State2D for more information.

property time

Total elappsed real time which was needed to solve problem

property timestamp

Timestamp when solver was started

property units

Selected units set

property wave

Wave function of solution. See Wave2D for more information

class sigspace.solver.Solver2D.State2D(*args, **kwargs)

This object represents the quantum state of the solution. It has a few methods to access its values, but mostly it can be modified by application of operators. To get an overview how to apply operators, please have a look at the Bra-ket tutorial.

The values of the state can be accessed via the [] operator.

It is returned as a member of Solution2D.

property x

Mesh array of x-coordinates

property y

Mesh array of y-coordinates

class sigspace.solver.Solver2D.Wave2D(x, y, pts, wave_function, energy=None, nodes=None)

Wave2D describes the wave function of an eigenvalue problem. It is returned as a member of Solution2D. It provides methods to modify and evaluate the wave function.

conj(pts=None, x=None, y=None)

Conjugate wave function.

Parameters:
  • pts (optional) – Points at which wave function shall be returned. Shape must be (number of points, 2)

  • x (optional) – X-points at which wave function shall be returned.

  • y (optional) – Y-points at which wave function shall be returned.

Returns:

Returns the conjugated wave function.

density(pts=None, x=None, y=None)

Retrieves the absolute square of the wave function (probability density). Identical to square() in 2D.

Parameters:
  • pts (optional) – Points at which wave function shall be returned. Shape must be (number of points, 2)

  • x (optional) – X-points at which wave function shall be returned.

  • y (optional) – Y-points at which wave function shall be returned.

Returns:

Returns squared wave function.

is_normalized()

Returns true if wave function is normalized

Returns:

Always true for two-dimensional wave functions.

matrix()

Returns a 2D mesh containing the wave function. Grid points are stored in (x, y)

Returns:

2D mesh containing the wave function.

normalize()

Normalize wave function.

Returns:

No value.

property shape

Shape of solved problem

square(pts=None, x=None, y=None)

Retrieves the absolute square of the wave function (probability density).

Parameters:
  • pts (optional) – Points at which wave function shall be returned. Shape must be (number of points, 2)

  • x (optional) – X-points at which wave function shall be returned.

  • y (optional) – Y-points at which wave function shall be returned.

Returns:

Returns squared wave function.

property x

x mesh points of solved problem

property y

y mesh points of solved problem

3D Schrödinger Equation

class sigspace.Solver3D(H: Hamiltonian)

The solver for three-dimensional ground state problems.

Parameters:

Hamiltonian (Hamiltonian) – The Hamiltonian to be solved.

alpha

Damping factor. Controls the stepsize of the solver. It should normally by smaller then 1. Further reduce it if you have convergence issues. Too low parameters will result in high iteration numbers.

config()

Provides configuration of solver.

Returns:

Returns a dictionary of all public properties of the solver.

grid(x_pts: tuple, y_pts=None, z_pts=None)

Creates an equally spaced 3D mesh grid. Function takes tuple of (start, stop, num). If only one is specified then the values are used for the other dimensions.

Parameters:
  • x_pts (tuple of the form (start, stop, num)) – Specifies grid along x-axis

  • y_pts (tuple of the form (start, stop, num)) – Specifies grid along y-axis. If not specified, x_pts will be used.

  • z_pts (tuple of the form (start, stop, num)) – Specifies grid along z-axis. If not specified, x_pts will be used.

max_iterations

Maximum number of iterations. If max_iterations is reached, solver aborts (default is infinity)

meta

Dict to add meta information to the solver. It can be used to store additional data on the purpose of the simulation. After completion of solve, it is also stored in solution.

print_info

If is True a short summary will be printed after solver completes (default is False)

print_iter

Specifies after how many iterations a short information shall be printed on the status of the solver (default is infinity => no infos will be printed)

run()

Solves the wave function for the given Hamiltonian.

Returns:

Returns a solution object that summarizes all results.

Return type:

Solution3D

property solver_type
stop_error

If residual (remaining error) drops below stop_error, solver aborts (default is 1e-2)

class sigspace.Solution3D(H, data, shape, pts, wave)

Solution of a two-dimensional eigenvalue problem. The object includes the numeric results and meta-data from the solver. The object is returned from run().

property H

Copy of Hamiltonian which describes solved problem

property energy

Energy of the wave function

property iterations

Total number of iterations which were needed to solve problem.

property residual

Residual error of solution

property solver_config

Stored configuration which was used by solver

property state

The quantum state of the solution. See State3D for more information.

property time

Total elappsed real time which was needed to solve problem

property timestamp

Timestamp when solver was started

property units

Selected units set

property wave

Wave function of solution. See Wave3D for more information

class sigspace.solver.Solver3D.State3D(*args, **kwargs)

This object represents the quantum state of the solution. It has a few methods to access its values, but mostly it can be modified by application of operators. To get an overview how to apply operators, please have a look at the Bra-ket tutorial.

The values of the state can be accessed via the [] operator.

It is returned as a member of Solution3D.

property pts

Grid points where the state values are located.

property x

Mesh array of x-coordinates

property y

Mesh array of y-coordinates

property z

Mesh array of z-coordinates

class sigspace.solver.Solver3D.Wave3D(shape, pts, wave_function, energy, nodes=None)

Wave3D describes the wave function of an eigenvalue problem. It is returned as a member of Solution3D. It provides methods to modify and evaluate the wave function.

conj(pts=None, x=None, y=None, z=None)

Conjugate wave function.

Parameters:
  • pts (optional) – Points at which wave function shall be returned. Shape must be (number of points, 3)

  • x (optional) – X-points at which wave function shall be returned.

  • y (optional) – Y-points at which wave function shall be returned.

  • z (optional) – Z-points at which wave function shall be returned.

Returns:

Returns the conjugated wave function.

density(pts=None, x=None, y=None, z=None)

Retrieves the absolute square of the wave function (probability density). Identical to square() in 3D.

Parameters:
  • pts (optional) – Points at which wave function shall be returned. Shape must be (number of points, 3)

  • x (optional) – X-points at which wave function shall be returned.

  • y (optional) – Y-points at which wave function shall be returned.

  • z (optional) – Z-points at which wave function shall be returned.

Returns:

Returns squared wave function.

is_normalized()

Returns true if wave function is normalized

Returns:

Always true for three-dimensional wave functions.

matrix()

Returns a 3D mesh containing the wave function. Grid points are stored in (x, y, z)

Returns:

3D mesh containing the wave function.

normalize()

Normalize wave function.

Returns:

No value.

property shape

Shape of solved problem

square(pts=None, x=None, y=None, z=None)

Retrieves the absolute square of the wave function (probability density).

Parameters:
  • pts (optional) – Points at which wave function shall be returned. Shape must be (number of points, 3)

  • x (optional) – X-points at which wave function shall be returned.

  • y (optional) – Y-points at which wave function shall be returned.

  • z (optional) – Z-points at which wave function shall be returned.

Returns:

Returns squared wave function.

property x

x mesh points of solved problem

property y

y mesh points of solved problem

property z

z mesh points of solved problem