chemtools.calculators.gamessreader module

GamessReader : reading gamess binary files.

class BinaryFile(filename, mode='r', order='fortran')[source]

Bases: object

Class representing a binary file (C or Fortran ordered).

file = None

The file handler.

order = None

The order for file (‘c’ or ‘fortran’).

read(dtype, shape=(1, ))[source]

Read an array of dtype and shape from current position.

shape must be any tuple made of integers or even () for scalars.

The current position will be updated to point to the end of read data.

seek(offset, whence=0)[source]

Move to new file position.

Argument offset is a byte count. Optional argument whence defaults to 0 (offset from start of file, offset should be >= 0); other values are 1 (move relative to current position, positive or negative), and 2 (move relative to end of file, usually negative, although many platforms allow seeking beyond the end of a file). If the file is opened in text mode, only offsets returned by tell() are legal. Use of other offsets causes undefined behavior.

tell()[source]

Returns current file position, an integer (may be a long integer).

write(arr)[source]

Write an arr to current position.

The current position will be updated to point to the end of written data.

class DictionaryFile(filename, irecln=4090, int_size=8)[source]

Bases: chemtools.calculators.gamessreader.BinaryFile

Wrapper for reading GAMESS(US) dictionary file (*.F10).

read_record(nrec, dtype=None)[source]

Read a logical record ‘rec’ from the dictionary file and return a numpy array of type defined in the ‘records’ list, and size defined through ‘self.ifilen’ array.

class GamessFortranReader(log)[source]

Bases: object

Class for holding method for reading gamess binary files:
$JOB.F08 : two electron integrals over AO’s, $JOB.F09 : two electron integrals over MO’s, $JOB.F10 : the dictionary file with 1-e integrals, orbitals etc., $JOB.F15 : GUGA and ORMAS two-electron reduced density matrix,
get_onee_size(aos=True)[source]

Get the size of the vector holding upper (or lower) triangle of a square matrix of size naos or nmos.

get_twoe_size(aos=False)[source]

Get the size of the 1d vector holding upper (or lower) triangle of a supermatrix of size nmos (2RDM and two-electrons integrals).

read_rdm2(filename=None, nmo=None)[source]

Read the 2rdm from the gamess-us file

read_twoeao(filename=None, nmo=None)[source]

Read the two electron integrals from the gamess-us file

read_twoemo(filename=None, nmo=None)[source]

Read the two electron integrals from the gamess-us file

class GamessReader(log)[source]

Bases: object

Class for holding method for reading gamess binary files:
  • $JOB.F08 : two electron integrals over AO’s,
  • $JOB.F09 : two electron integrals over MO’s,
  • $JOB.F15 : GUGA and ORMAS two-electron reduced density matrix,
TODO:
CI coefficients, and CI hamiltonian matrix elements.
get_onee_size(aos=True)[source]

Get the size of the vector holding upper (or lower) triangle of a square matrix of size naos or nmos.

get_twoe_size()[source]

Get the size of the 1d vector holding upper (or lower) triangle of a supermatrix of size nmos (2RDM and two-electrons integrals).

read_rdm2(filename=None, nmo=None)[source]

Read the 2rdm from the gamess-us file

read_twoeao(filename=None, nmo=None)[source]

Read the two electron integrals from the gamess-us file

class SequentialFile(filename, logfile=None)[source]

Bases: chemtools.calculators.gamessreader.BinaryFile

get_index_buffsize(buff_size, int_size)[source]

Return the index buffer size for reading 2-electron integrals

ijkl(i, j, k, l)[source]

Based on the four orbital indices i,j,k,l return the address in the 1d vector.

read_ci_coeffs()[source]

Read CI coefficients from file NFT12 and return them as a numpy array of floats.

readseq(buff_size=15000, int_size=8, mos=False, skip_first=False)[source]

Read FORTRAN sequential unformatted file with two-electron quantities:

  • two electron integrals over AO’s: .F08 file
  • two electron integrals over MO’s: .F09 file
  • elements of the two particle density matrix: .F15 file
Args:
buff_size : int
size of the buffer holding values to be read, in gamessus it is stored under NINTMX variable and in Linux version is equal to 15000 which is the default value
large_labels : bool
a flag indicating if large labels should were used, if largest label i (of the MO) is i<255 then large_labels should be False (case LABSIZ=1 in gamessus), otherwise set to True (case LABSIZ=2 in gamess(us),
skip_first : bool
skips the first record of the file is set to True,
Returns:
numpy 1D array holding the values
factor(i, j, k, l)[source]

Based on the orbitals indices return the factor that takes into account the index permutational symmetry.

ijkl(i, j, k, l)[source]

Based on the four orbital indices i, j, k, l return the address in the 1d vector.

print_twoe(twoe, nbf)[source]

Print the two-electron integrals.

rec

alias of record

tri2full(vector, sym=True)[source]

Convert a triagonal matrix whose elements are stored in the vector into a rectangular matrix of the shape given by shape tuple.