Bases: object
Contains methods for initializing, creating and manipulating Hamiltonian matrices.
Parameters: | N (int) – number of nodes to initialize the Hamiltonian object with. |
---|---|
Returns: | : creates an unallocated PETSc matrix on communicator petsc4py.PETSc.COMM_WORLD. This is accessed via the attribute Hamiltonian.mat. |
Return type: | petsc4py.PETSc.Mat |
Returns: | : an associated EigSolver object is also created at Hamiltonian.EigSolver. |
Return type: | EigSolver |
Hamiltonian.Emax(**kwargs) | Returns the maximum Eigenvalue of the matrix. |
Hamiltonian.Emin(**kwargs) | Returns the minimum Eigenvalue of the matrix. |
Hamiltonian.createLine([d, amp]) | Create a 1 particle infinite line Hamiltonian. |
Hamiltonian.createLine2P([d, amp, interaction]) | Create a 2 particle infinite line Hamiltonian. |
Hamiltonian.createLine3P([d, amp, interaction]) | Create a 3 particle infinite line Hamiltonian. |
Hamiltonian.destroy() | Destroys all associated PETSc matrices. |
Hamiltonian.importAdj(filename, filetype[, ...]) | Create a Hamiltonian from an imported adjacency matrix. |
Hamiltonian.importAdjToH(filename, filetype) | Create a Hamiltonian from an imported adjacency matrix. |
Hamiltonian.reinitialize() | Destroy and reinitialize the PETSc matrix Hamiltonian.mat. |
Returns the maximum Eigenvalue of the matrix.
Example
>>> Emax = Hamiltonian.Emax()
Returns the minimum Eigenvalue of the matrix.
Example
>>> Emin = Hamiltonian.Emin()
Create a 1 particle infinite line Hamiltonian.
Parameters: |
|
---|---|
Returns: | : Hamiltonian.mat, the Hamiltonian matrix. |
Return type: | petsc4py.PETSc.Mat() |
Important
Fortran interface
This function calls the Fortran function hamiltonian_p1_line().
Create a 2 particle infinite line Hamiltonian.
Parameters: |
|
---|---|
Returns: | : Hamiltonian.mat, the Hamiltonian matrix. |
Return type: | petsc4py.PETSc.Mat() |
Important
Fortran interface
This function calls the Fortran function hamiltonian_p2_line().
Create a 3 particle infinite line Hamiltonian.
Parameters: |
|
---|---|
Returns: | : Hamiltonian.mat, the Hamiltonian matrix. |
Return type: | petsc4py.PETSc.Mat() |
Important
Fortran interface
This function calls the Fortran function hamiltonian_p3_line().
Create a Hamiltonian from an imported adjacency matrix.
Parameters: |
|
---|---|
Returns: | :this allocates and builds a Hamiltonian matrix at Hamiltonian.mat. |
Return type: | petsc4py.PETSc.Mat() |
Returns: | : the original adjacency matrix is also stored as a PETSc matrix at Hamiltonian.Adj. |
Return type: | petsc4py.PETSc.Mat() |
Important
Note
Create a Hamiltonian from an imported adjacency matrix.
Parameters: |
|
---|---|
Returns: | : * Hamiltonian.mat (petsc4py.PETSc.Mat) - the Hamiltonian matrix. * Hamiltonian.Adj (petsc4py.PETSc.Mat) - the adjacency matrix stored as a PETSc matrix. * Hamiltonian.nodePos (array) - the \((x,y)\) coordinates of the graph vertices. * Hamiltonian.lineX (array) - the \(x\) coordinates of the edges connecting graph vertices. * Hamiltonian.lineY (array) - the \(y\) coordinates of the edges connecting graph vertices. |
Important
Fortran interface
This function calls the Fortran function importadjtoh() and is faster than importAdjToH(), but with a ‘pickier’ text file importer.