libctqwMPI API¶

(source: ctqwMPI.F90)

I/O subroutines¶

subroutine exportvec(vec, filename, filetype)

export a PETSc vector to a file

Parameters: vec [real] :: the PETSc vector to export filename [character,in] :: filename only, no path, of the output file filetype [character,in] :: filetype to export (‘txt’ or ‘bin’)
subroutine importvec(vec, filename, filetype)

import a PETSc vector from a file

Parameters: vec [real] :: the PETSc vector to import the file into filename [character,in] :: filename only, no path, of the input file filetype [character,in] :: filetype to export (‘txt’ or ‘bin’)
subroutine exportmat(mat, filename, filetype)

export a PETSc matrix to a file

Parameters: mat [integer] :: the input PETSc matrix filename [character,in] :: the filename of the exported file filetype [character,in] :: filetype to export (‘txt’ or ‘bin’)
subroutine importmat(mat, filename, filetype)

import a PETSc matrix from a file

Parameters: mat [integer] :: the PETSc matrix to import the file into filename [character,in] :: filename only, no path, of the input file filetype [character,in] :: filetype to export (‘txt’ or ‘bin’)

Matrix Array subroutines¶

subroutine identity(mat, n)

creates a $$n\times n$$ identity matrix

Parameters: mat [integer] n [integer] :: the $$n\times n$$ identity matrix output
subroutine kron(m1, r1, c1, m2, r2, c2, kronprod)

compute the Kronecker product of two arrays

Parameters: m1 [integer] r1 [real] :: number of rows in matrix 1 c1 [real] :: matrix 1 m2 [integer] r2 [real] :: number of rows in matrix 2 c2 [real] :: kronecker product output kronprod [integer]

Hamiltonian subroutines¶

subroutine importadjtoh(mat, filename, p, d, amp, interaction, bosonic, nd)

Import an adjacency matrix from a file, and create a PETSc Hamiltonian matrix.

Parameters: mat [integer] :: output Hamiltonian matrix filename [character,in] :: dense adjacency matrix file in text format p [character,in] :: number of particles in the system (‘1’, ‘2’, or ‘3’) d [real] amp [real] interaction [integer] :: interaction amplitude bosonic [real] :: whether to generate bosonic hamiltonian or not nd [integer] :: amplitude of defects adjtoh()

convert an adjacency array to a PETSc Hamiltonian matrix

Parameters: mat [integer] :: output Hamiltonian matrix adjarray [real] p [character,in] :: number of particles in the system (‘1’, ‘2’, or ‘3’) d [real] amp [real] interaction [integer] :: interaction amplitude bosonic [real] :: whether to generate bosonic hamiltonian or not nd [integer] :: amplitude of defects n [integer]
subroutine hamiltonian_p1_line(a, d, amp, nd, n)
Parameters: a [real] d [real] amp [real] nd [integer] n [integer]
subroutine hamiltonian_p2_line(h2, d, amp, interaction, nd, n)
Parameters: h2 [real] d [real] amp [real] interaction [integer] nd [integer] n [integer]
subroutine hamiltonian_p3_line(h3, d, amp, interaction, bosonic, nd, n)
Parameters: h3 [real] d [real] amp [real] interaction [integer] bosonic [real] :: whether to generate bosonic hamiltonian or not nd [integer] n [integer] adjtoh()

Statespace subroutines¶

function coord(x, y, n)

convert from a 2D to 1D statespace for 2 particles, using $$coord = n(x + n/2 - 1) + y + n/2 - 1$$

Parameters: x [integer,in] :: vertex location of particle 1 y [integer,in] :: vertex location of particle 2 n [integer,in] :: number of nodes in the system coord [integer] :: output 2P statepace coordinate p2_init()
function coord3p(x, y, z, n)

convert from a 2D to 1D statespace for 2 particles, using $$coord2P = xn^2 + ny + z$$

Parameters: x [integer,in] :: vertex location of particle 1 y [integer,in] :: vertex location of particle 2 z [integer,in] :: vertex location of particle 3 n [integer,in] :: number of nodes in the system coord3p [integer] p3_init()
subroutine marginal1(psi, prob, n)

Calculates the marginal probability of 1 particle state psi; i.e. $$|\psi|^2$$

Parameters: psi [real] :: input statespace PETSc vector prob [real] :: output PETSc vector containing the probabilities n [integer] :: length of vector psi
subroutine marginal2(psi, psim, p, n)

Calculates the marginal probability of particle number p

Parameters: psi [real] :: input PETSc statespace vector of length $$n^p$$ psim [real] p [character,in] :: the particle to calculate the marginal probability (‘1’, ‘2’, ‘3’) n [integer] :: number of vertices in the graph
subroutine marginal3(psi, psim, p, n)
Parameters: psi [real] psim [real] p [character,in] n [integer]
subroutine p1_init(psi0, init_state, num, n)
Parameters: psi0 [real] init_state [integer] num [integer] n [integer]
subroutine p2_init(psi0, init_state, num, n)
Parameters: psi0 [real] init_state [integer] num [integer] n [integer] graphiscert() coord()
subroutine p3_init(psi0, init_state, num, n)
Parameters: psi0 [real] init_state [integer] num [integer] n [integer] graphiscert() coord3p()

MatrixExp and Eigenvalues¶

subroutine qw_krylov(a, t, v, y)
Parameters: a [real] t [real] v [real] y [real] graphiscert()
subroutine min_max_eigs(a, rank_bn, eval, eval_error, which, eig_solver, worktype, worktypeint, tolin, max_it, verbose, error)
Parameters: a [real] rank_bn [real] eval [real] eval_error [real] which [character,in] eig_solver [character,in] worktype [character,in] worktypeint [real] tolin [real] max_it [integer] verbose [real] error [real] graphiscert()
subroutine qw_cheby(psi0, psi, dt, h, emin, emax, rank_bn, n)
Parameters: psi0 [real] psi [real] dt [real] h [real] emin [real] emax [real] rank_bn [real] n [integer] graphiscert()

Entanglement subroutines¶

subroutine partial_trace_array(psi, rhox, n)
Parameters: psi [real] rhox [real] n [integer]
subroutine partial_trace_mat(psi, rhox, n)
Parameters: psi [real] rhox [real] n [integer] entanglement()
subroutine entanglement(psi, n, vne, eig_solver, worktype, worktypeint, tolin, max_it, verbose, error)
Parameters: psi [real] n [integer] vne [real] eig_solver [character,in] worktype [character,in] worktypeint [real] tolin [real] max_it [integer] verbose [real] error [real] partial_trace_mat()

GraphIso subroutines¶

Parameters: adjarray [real] n [integer] number_of_edges [integer]
Parameters: edgenum [real] adjarray [real] n [integer] getedgestate [real] getedgestate()
Parameters: init_states [integer] localstatenum [integer] adjarray [real] n [integer] graphiscert()