mapping

libra_py.workflows.nbra.mapping.energy_arb(SD, e)[source]

Computes the energy of a Slater Determinat (SD) state

Parameters
  • SD (list of ints) – indices of the orbitals occupied in this SD SeeAlso: `inp` in the `sd2indx(inp,nbasis)` function

  • e (MATRIX(nbasis, nbasis)) – energies of all 1-electron levels (alpha- and beta- components)

Returns

the sum of the orbital energies for the occupied spin-orbitals -

This is the approximation of the SD energy

Return type

double

libra_py.workflows.nbra.mapping.energy_mat_arb(SD, e, dE)[source]

Computes a matrix of the SD energies

Parameters
  • SD (list of lists of ints) – a list of SD determinants, such that: SD[iSD] is a list of integers defining which orbitals are occupied in SD with index `iSD` and how SeeAlso: `inp` in the `sd2indx(inp,nbasis)` function

  • e (MATRIX(nbasis, nbasis)) – energies of all 1-electron levels (alpha- and beta- components)

  • dE (list of doubles) – energy corrections added to each SD

Returns

the matrix of energies in the SD basis. Here, N = len(SD) - the number of SDs.

Return type

CMATRIX(N,N)

libra_py.workflows.nbra.mapping.orbs2spinorbs(s)[source]

This function converts the matrices in the orbital basis (e.g. old PYXAID style) to the spin-orbital basis. Essentially, it makes a block matrix of a double dimension:

( s 0 )

s –> ( 0 s )

This is meant to be used for backward compatibility with PYXIAD-generated data

Parameters

s (CMATRIX(N,N)) – whatever matrix in the orbital basis, N - is the number of doubly-occupied orbitals

Returns

whatever matrix in the spin-orbital basis. It has a doubled dimensionality

Return type

CMATRIX(2N, 2N)

libra_py.workflows.nbra.mapping.ovlp_arb(SD1, SD2, S, use_minimal=False)[source]

Compute the overlap of two generic SDs: <SD1|SD2>

Parameters
  • SD1 (lists of ints) – first SD, such that: SeeAlso: `inp` in the `sd2indx(inp,nbasis)` function

  • SD2 (lists of ints) – second SD, such that: SeeAlso: `inp` in the `sd2indx(inp,nbasis)` function

  • S (CMATRIX(N,N)) – is the matrix in the space of 1-el spin-orbitals (either spin-diabatic or spin-adiabatic or both) , N - is the number of 1-el orbitals.

  • use_minimal (Boolean) – If True, use the minimal subset of Kohn-Sham orbitals needed to describe the overlap of the SDs

Returns

the overlap of the two determinants <SD1|SD2>

Return type

complex

libra_py.workflows.nbra.mapping.ovlp_mat_arb(SD1, SD2, S, use_minimal=True)[source]

Compute a matrix of overlaps in the SD basis

Parameters
  • SD1 (list of lists of N ints) – a list of N SD determinants, such that: SD1[iSD] is a list of integers defining which orbitals are occupied in SD with index `iSD` and how SeeAlso: `inp` in the `sd2indx(inp,nbasis)` function

  • SD2 (list of lists of M ints) – a list of M SD determinants, such that: SD2[iSD] is a list of integers defining which orbitals are occupied in SD with index `iSD` and how SeeAlso: `inp` in the `sd2indx(inp,nbasis)` function

  • S (CMATRIX(K,K)) – is the matrix in the space of 1-el spin-orbitals (either spin-diabatic or spin-adiabatic or both) , K - is the number of 1-el orbitals.

  • use_minimal (Boolean) – If True, use the minimal subset of Kohn-Sham orbitals needed to describe the overlap of the SDs. This is passed to the funciton that computes the overlaps

Returns

overlap matrix composed of elements <SD1(i)|SD2(j)>

Return type

CMATRIX(N, M)

libra_py.workflows.nbra.mapping.sd2indx(inp, nbasis, do_sort=False)[source]

This function maps a list of integers defining the occupied spin-orbitals in a SD onto the global indices of the orbitals that are being occupied.

Parameters
  • inp (list of ints) –

    indices of the occupied spin-orbitals. Indexing starts with 1, not 0!

    Positive number `n` correspond to an alpha electron occupying the orbital (whether it is an alpha-spatial or beta-spatial component) `n`

    Negative number `-n` correspond to a beta electron occupying the orbital (whether it is an alpha-spatial or beta-spatial component) `n`

  • nbasis (int) – the total number of orbitals orbitals (both alpha- and beta- spatial components ) in the selected active space [currently not really used!]

  • do_sort (Boolean) –

    the flag to tell whether the indices should be sorted in a particular order:

    • True - for new scheme (needed for the SAC) [default]

    • use with False for Pyxaid mapping!

Returns

the indices of the orbitals occupied in this SD (different convention)

Return type

list of ints

Example

Assume out active space consists of 4 orbitals: |1^a>, |1^b>, |2^a>, |2^b>. Here, the superscript indicates the spin-component of the given orbital.

In the step2 they are grouped as |1^a>, |2^a>, |1^b>, |2^b>

And indexed (overall) as: 1 2 3 4 (as used in the input)

0 1 2 3 (as used in the output)

Note: this indexing convention assumes starting from 1, not from 0!

So the `nbasis` should be = 4

Input SD = [1, -3] means that the orbital |1^a> is occupied by an alpha electron |a> and the orbital |1^b> is occupied by a beta electron |b>, so the SD is:

SD = 1/sqrt(2) * | |1^a>|a> |1^b>|b> |

This function will return the global indices of the occupied orbitals in the set of active orbitals. That is the conversion will be: [1, -3] -> [0, 2] Note that the output indices start from 0