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
Call to:

adjtoh()

subroutine adjtoh(mat, adjarray, p, d, amp, interaction, bosonic, nd, n)

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]
Called from:

importadjtoh(), graphiscert(), hamiltonian_p3_line()

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]
Call to:

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
Return:

coord [integer] :: output 2P statepace coordinate

Called from:

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
Return:

coord3p [integer]

Called from:

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]
Called from:

graphiscert()

Call to:

coord()

subroutine p3_init(psi0, init_state, num, n)
Parameters:
  • psi0 [real]
  • init_state [integer]
  • num [integer]
  • n [integer]
Called from:

graphiscert()

Call to:

coord3p()

MatrixExp and Eigenvalues

subroutine qw_krylov(a, t, v, y)
Parameters:
  • a [real]
  • t [real]
  • v [real]
  • y [real]
Called from:

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]
Called from:

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]
Called from:

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]
Called from:

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]
Call to:

partial_trace_mat()

GraphIso subroutines

function number_of_edges(adjarray, n)
Parameters:
  • adjarray [real]
  • n [integer]
Return:

number_of_edges [integer]

Called from:

getalledgestates(), getalledgestates3p()

function getedgestate(edgenum, adjarray, n)
Parameters:
  • edgenum [real]
  • adjarray [real]
  • n [integer]
Return:

getedgestate [real]

Called from:

getedgestate(), getalledgestates(), getalledgestates3p()

Call to:

getedgestate()

subroutine getalledgestates(init_states, localstatenum, adjarray, n)
Parameters:
  • init_states [integer]
  • localstatenum [integer]
  • adjarray [real]
  • n [integer]
Called from:

graphiscert()

Call to:

number_of_edges(), getedgestate()

subroutine getalledgestates3p(init_states, localstatenum, adjarray, n)
Parameters:
  • init_states [integer]
  • localstatenum [integer]
  • adjarray [real]
  • n [integer]
Called from:

graphiscert()

Call to:

number_of_edges(), getedgestate()

subroutine graphiscert(cert, certlength, adjarray, p, tol, expm_method, eig_solver, emax_estimate, worktype, worktypeint, tolin, max_it, bosonic, verbose, n)
Parameters:
  • cert [real]
  • certlength [real]
  • adjarray [real]
  • p [real]
  • tol [real]
  • expm_method [character,in]
  • eig_solver [character,in]
  • emax_estimate [real]
  • worktype [character,in]
  • worktypeint [real]
  • tolin [real]
  • max_it [integer]
  • bosonic [real]
  • verbose [real]
  • n [integer]
Call to:

adjtoh(), getalledgestates3p(), getalledgestates(), min_max_eigs(), p3_init(), p2_init(), qw_cheby(), qw_krylov(), d_refsor()

subroutine d_refsor(xdont)

:p real xdont(:) [inout]:

Called from:graphiscert(), buildfrequencytable()

Note

d_refsor(), a highly optimised Fortran sorting implementation written by Michel Olagnon and part of the ORDERPACK 2.0 suite of ranking and sorting algorithms for Fortran 90.