ERGO_methods

libra_py.ERGO_methods.energies(en, nocc, nvirt, act_space=None)[source]

This function creates a diagonal matrix of energies of the states included in the active space.

Parameters
  • en (list of floats) – energies of all (occupied + unoccupied) orbitals as read from the ErgoSCF

  • nocc (int) – the number of occupied orbitals in the pool of the printed out MO files

  • nvirt (int) – the number of unoccupied (virtual) orbitals in the pool of the printed out MO files

  • act_space (list of ints) – indices of the orbitals we are interested in The indexing convention is relative to HOMO, that is 0 is HOMO, -1 is HOMO-1, 1 is LUMO, etc.

Returns

matrix with orbital energies (ordered from lowest to highest)

Here, N is the size of the active space

Return type

( CMATRIX(N,N) )

libra_py.ERGO_methods.find_last_file(prefix, suffix)[source]

This functions searches for the last file in a series of files named prefix`%i`suffix, for instance “A1.txt”, “A2.txt”, “A3.txt”, etc.

Parameters
  • prefix (string) – the prefix of the filenames

  • suffix (string) – the suffix of the filenames

Returns

(i, filename), where:

  • i : the largest index of the existing file

  • filename : the name of the last existing file

Return type

(int, string)

libra_py.ERGO_methods.get_mtx_matrices(filename, act_sp1=None, act_sp2=None)[source]

Get the matrices printed out by the DFTB+

Parameters
  • filename (string) – the name of the file to read. In the MatrixMarket (mtx) format

  • act_sp1 (list of ints or None) – the row active space to extract from the original files Indices here start from 0. If set to None - the number of AOs will be determined automatically from the file. [default: None]

  • act_sp2 (list of ints or None) – the cols active space to extract from the original files Indices here start from 0. If set to None - the number of AOs will be determined automatically from the file. [default: None]

Returns

X: where N = len(act_sp1) and M = len(act_sp2)

These are the corresponding property matrices (converted to the complex type)

Return type

list of CMATRIX(N, M)

libra_py.ERGO_methods.read_mo_restricted(nocc, nvirt, act_space=None)[source]

This function reads the MO files produced by ErgoSCF in the case of spin-unpolarized (restricted) formulation. The names of the files are known, so the we do not need to specify that

Parameters
  • nocc (int) – the number of occupied orbitals in the pool of the printed out MO files

  • nvirt (int) – the number of unoccupied (virtual) orbitals in the pool of the printed out MO files

  • act_space (list of ints) – indices of the orbitals we are interested in The indexing convention is relative to HOMO, that is 0 is HOMO, -1 is HOMO-1, 1 is LUMO, etc.

Returns

( [mo_a] )

  • mo_a ( CMATRIX(nao, nocc+nvirt) ): alpha orbitals

Return type

( list )

libra_py.ERGO_methods.read_mo_unrestricted(nocc, nvirt, act_space=None)[source]

This function reads the MO files produced by ErgoSCF in the case of spin-polarized (unrestricted) formulation. The names of the files are known, so the we do not need to specify that

Parameters
  • nocc (int) – the number of occupied orbitals in the pool of the printed out MO files

  • nvirt (int) – the number of unoccupied (virtual) orbitals in the pool of the printed out MO files

  • act_space (list of ints) – indices of the orbitals we are interested in The indexing convention is relative to HOMO, that is 0 is HOMO, -1 is HOMO-1, 1 is LUMO, etc.

Returns

( [mo_a, mo_b] )

  • mo_a ( CMATRIX(nao, nocc+nvirt) ): alpha orbitals

  • mo_b ( CMATRIX(nao, nocc+nvirt) ): beta orbitals

Return type

( list )

libra_py.ERGO_methods.read_spectrum_restricted()[source]

This function reads the eigenspectrum files produced by ErgoSCF in the case of spin-unpolarized (restricted) formulation. The names of the files are known, so the we do not need any arguments

Note: the ordering of the orbitals in the ErgoSCF is:

H L H-1 L+1 … …

So, the occupied orbitals order is reverted in the created array

Args: None

Returns

( [e_a], [nocc, nvirt])

  • e_a ( list of floats ): energies of the alpha orbitals printed out

    this list contains both occupied and unoccupied orbitals

  • nocc ( int ): the number of occupied orbitals, it should be less than

    len(e_a) and len(e_b)

  • nvirt ( int ): the number of unoccupied orbitals, it should be less than

    len(e_a) and len(e_b)

Return type

(list, list)

libra_py.ERGO_methods.read_spectrum_unrestricted()[source]

This function reads the eigenspectrum files produced by ErgoSCF in the case of spin-polarized (unrestricted) formulation. The names of the files are known, so the we do not need any arguments

Note: the ordering of the orbitals in the ErgoSCF is:

H L H-1 L+1 … …

So, the occupied orbitals order is reverted in the created array

Args: None

Returns

( [e_a, e_b], [nocc, nvirt])

  • e_a ( list of floats ): energies of the alpha orbitals printed out

    this list contains both occupied and unoccupied orbitals

  • e_b ( list of floats ): energies of the beta orbitals printed out

    this list contains both occupied and unoccupied orbitals

  • nocc ( int ): the number of occupied orbitals, it should be less than

    len(e_a) and len(e_b)

  • nvirt ( int ): the number of unoccupied orbitals, it should be less than

    len(e_a) and len(e_b)

Return type

(list, list)

libra_py.ERGO_methods.xyz_traj2gen_ovlp(infile, md_iter1, md_iter2)[source]

This file converts the xyz trajectory file to a string that contains the superimposed geometries of the `md_iter1` and `md_step2` steps that can be used to setup the input for the ErgoSCF calculations

Parameters
  • infile (string) – the name of the input xyz trajectory file

  • md_iter1 (int) – index of the first timeframe to extract

  • md_iter2 (int) – index of the second timeframe to extract

Returns

atoms and coordinates section [ units: same as in xyz file ]

Return type

string

libra_py.ERGO_methods.xyz_traj2gen_sp(infile, md_iter)[source]

This file converts the xyz trajectory file to a string that contains the geometry of the `md_iter` step that can be used to setup the input for the ErgoSCF calculations

Parameters
  • infile (string) – the name of the input xyz trajectory file

  • md_iter (int) – index of the timeframe to extract

Returns

atoms and coordinates section [ units: same as in xyz file ]

Return type

string