Solver selection¶
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, x_pts=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:
- 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 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.
- class sigspace.solver.SolverBase.State(*args, **kwargs)¶
- The quantum state of an eigenvalue problem. You can apply operators to modify it. See
the Bra-ket tutorial.
- property nodes¶
Nodes included in the solution.
- property wave¶
Wave function of quantum state
2D Schrödinger Equation¶
- class sigspace.Solver2D(H: Hamiltonian)¶
Solver for 2D Schrödinger equation
- 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.
- 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)
- 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)¶
Solution of a two-dimensional eigenvalue problem. The object includes the numeric results and meta data from the solver.
- 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 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.
- class sigspace.solver.SolverBase.State(*args, **kwargs)¶
- The quantum state of an eigenvalue problem. You can apply operators to modify it. See
the Bra-ket tutorial.
- property nodes¶
Nodes included in the solution.
- property wave¶
Wave function of quantum state