density_description_file_2.cc File Reference

#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <math.h>
#include <errno.h>
#include <string>
#include "density_description_file_2.h"
#include "densfromf_full.h"
#include "integrals_general.h"
#include "matrix_algebra.h"
#include "memorymanag.h"
#include "output.h"
#include "utilities.h"

Classes

struct  densityFileHeaderStruct

Defines

#define _LARGEFILE_SOURCE   1
#define MATRIX_STORAGE_TYPE_FULL   1
#define MATRIX_STORAGE_TYPE_TRIANGLE   2
#define MATRIX_STORAGE_TYPE_VECTORS   3

Functions

static void ddf_store_triangular_matrix (char *p, int n, const ergo_real *matrix)
 stores the upper triangle of a square matrix in the specified memory block.
static void ddf_store_triangular_matrix_sparse (char *p, long n, matrix_description_struct *matrix)
 stores the upper triangle of the matrix given by the matrix_description_struct in the specified memory block.
static void ddf_get_triangular_matrix_from_storage (const char *p, long n, ergo_real *resultMatrix)
static void ddf_get_triangular_matrix_from_storage_sparse (const char *p, int n, int *rowind, int *colind, ergo_real *values)
static int ddf_get_nvalues_symm_matrix (int n, const ergo_real *matrix)
static int ddf_store_matrix_as_vectors (char *p, int n, const ergo_real *matrix, size_t sizeInBytes)
static int ddf_store_matrix_as_vectors_sparse (char *p, int n, matrix_description_struct *matrix, size_t sizeInBytes)
static int ddf_get_matrix_from_vector_storage (const char *p, size_t sizeInBytes, int n, ergo_real *resultMatrix)
static int ddf_get_matrix_from_vector_storage_sparse (const char *p, size_t sizeInBytes, int n, int *rowind2, int *colind2, ergo_real *values2)
static size_t ddf_get_matrix_storage_size (int storageType, int n, const ergo_real *matrix)
static size_t ddf_get_matrix_storage_size_sparse (int storageType, int n, matrix_description_struct *matrix)
static int ddf_store_matrix (char *p, size_t sizeInBytes, int n, const ergo_real *matrix, int storageType)
static int ddf_store_matrix_sparse (char *p, size_t sizeInBytes, int n, matrix_description_struct *matrix, int storageType)
static int ddf_get_matrix_nvalues_from_storage (const char *p, size_t sizeInBytes, int n, long *result_nvalues, int storageType)
static int ddf_get_matrix_from_storage (const char *p, size_t sizeInBytes, int n, ergo_real *resultMatrix, int storageType)
static int ddf_get_matrix_from_storage_sparse (const char *p, size_t sizeInBytes, int n, int *rowind, int *colind, ergo_real *values, int storageType)
int ddf_writeShellListAndDensityMatricesToFile (const BasisInfoStruct *basisInfo, int noOfDensityMatrices, ergo_real **densityMatrixList, const char *fileName)
int ddf_writeShellListAndDensityMatricesToFile_sparse (const BasisInfoStruct *basisInfo, int noOfDensityMatrices, matrix_description_struct *densityMatrixList, const char *fileName)
 Writes basisInfo and sparse matrices in a format that can be later read by ddf_load_density.
static int ddf_load_density_getSizes (const char *fileName, int *result_noOfShells, int *result_noOfBasisFuncs, int *result_noOfDensitiesOnFile, long *result_noOfValuesList)
static int ddf_read_shells_and_density_matrices (BasisInfoStruct *basisInfo, int noOfDensityMatrices, ergo_real **densityMatrixList, const char *fileName)
 ddf_read_shells_and_density_matrices() reads the basis set information and requested number of density matrices from a specified file.
static int ddf_read_shells_and_density_matrices_sparse (BasisInfoStruct **basisInfo, int noOfDensityMatrices, int **rowindList, int **colindList, ergo_real **valuesList, const char *fileName)
int ddf_load_density (const char *densityFileName, int noOfDensityMatrices, const IntegralInfo &integralInfo, BasisInfoStruct **basisInfo, ergo_real **densityMatrix)
 Function opens fileName, fills in basisInfo (which has to be allocated and nullified), allocates densityMatrixList and reads density matrix or at most two matrices and puts it/them in densityMatrixList.
int ddf_load_density_sparse (const char *densityFileName, const IntegralInfo &integralInfo, BasisInfoStruct **basisInfo, int *noOfDensitiesRead, int **rowindList, int **colindList, ergo_real **valuesList, long *nvaluesList)
 Function opens fileName, fills in basisInfo (which has to be allocated and nullified), allocates densityMatrixList and reads density matrix or at most two matrices and puts it/them in densityMatrixList.

Variables

const int DENSITY_FILE_VERSION_NUMBER = 10002
const ergo_real THRESHOLD_FOR_VECTOR_STORAGE = 1e-12

Define Documentation

#define _LARGEFILE_SOURCE   1

#define MATRIX_STORAGE_TYPE_FULL   1

#define MATRIX_STORAGE_TYPE_TRIANGLE   2

#define MATRIX_STORAGE_TYPE_VECTORS   3


Function Documentation

static int ddf_get_matrix_from_storage ( const char *  p,
size_t  sizeInBytes,
int  n,
ergo_real resultMatrix,
int  storageType 
) [static]

static int ddf_get_matrix_from_storage_sparse ( const char *  p,
size_t  sizeInBytes,
int  n,
int *  rowind,
int *  colind,
ergo_real values,
int  storageType 
) [static]

static int ddf_get_matrix_from_vector_storage ( const char *  p,
size_t  sizeInBytes,
int  n,
ergo_real resultMatrix 
) [static]

static int ddf_get_matrix_from_vector_storage_sparse ( const char *  p,
size_t  sizeInBytes,
int  n,
int *  rowind2,
int *  colind2,
ergo_real values2 
) [static]

static int ddf_get_matrix_nvalues_from_storage ( const char *  p,
size_t  sizeInBytes,
int  n,
long *  result_nvalues,
int  storageType 
) [static]

static size_t ddf_get_matrix_storage_size ( int  storageType,
int  n,
const ergo_real matrix 
) [static]

static size_t ddf_get_matrix_storage_size_sparse ( int  storageType,
int  n,
matrix_description_struct matrix 
) [static]

static int ddf_get_nvalues_symm_matrix ( int  n,
const ergo_real matrix 
) [static]

static void ddf_get_triangular_matrix_from_storage ( const char *  p,
long  n,
ergo_real resultMatrix 
) [static]

static void ddf_get_triangular_matrix_from_storage_sparse ( const char *  p,
int  n,
int *  rowind,
int *  colind,
ergo_real values 
) [static]

int ddf_load_density ( const char *  densityFileName,
int  noOfDensityMatrices,
const IntegralInfo integralInfo,
BasisInfoStruct **  basisInfo,
ergo_real **  densityMatrix 
)

Function opens fileName, fills in basisInfo (which has to be allocated and nullified), allocates densityMatrixList and reads density matrix or at most two matrices and puts it/them in densityMatrixList.

static int ddf_load_density_getSizes ( const char *  fileName,
int *  result_noOfShells,
int *  result_noOfBasisFuncs,
int *  result_noOfDensitiesOnFile,
long *  result_noOfValuesList 
) [static]

int ddf_load_density_sparse ( const char *  densityFileName,
const IntegralInfo integralInfo,
BasisInfoStruct **  basisInfo,
int *  noOfDensitiesRead,
int **  rowindList,
int **  colindList,
ergo_real **  valuesList,
long *  nvaluesList 
)

Function opens fileName, fills in basisInfo (which has to be allocated and nullified), allocates densityMatrixList and reads density matrix or at most two matrices and puts it/them in densityMatrixList.

static int ddf_read_shells_and_density_matrices ( BasisInfoStruct basisInfo,
int  noOfDensityMatrices,
ergo_real **  densityMatrixList,
const char *  fileName 
) [static]

ddf_read_shells_and_density_matrices() reads the basis set information and requested number of density matrices from a specified file.

basisInfo needs to be allocated and zeroed in advance. densityMatrixList must be properly allocated as well.

static int ddf_read_shells_and_density_matrices_sparse ( BasisInfoStruct **  basisInfo,
int  noOfDensityMatrices,
int **  rowindList,
int **  colindList,
ergo_real **  valuesList,
const char *  fileName 
) [static]

static int ddf_store_matrix ( char *  p,
size_t  sizeInBytes,
int  n,
const ergo_real matrix,
int  storageType 
) [static]

static int ddf_store_matrix_as_vectors ( char *  p,
int  n,
const ergo_real matrix,
size_t  sizeInBytes 
) [static]

static int ddf_store_matrix_as_vectors_sparse ( char *  p,
int  n,
matrix_description_struct matrix,
size_t  sizeInBytes 
) [static]

static int ddf_store_matrix_sparse ( char *  p,
size_t  sizeInBytes,
int  n,
matrix_description_struct matrix,
int  storageType 
) [static]

static void ddf_store_triangular_matrix ( char *  p,
int  n,
const ergo_real matrix 
) [static]

stores the upper triangle of a square matrix in the specified memory block.

Parameters:
p memory block
n matrix dimension
matrix square matrix

static void ddf_store_triangular_matrix_sparse ( char *  p,
long  n,
matrix_description_struct matrix 
) [static]

stores the upper triangle of the matrix given by the matrix_description_struct in the specified memory block.

Parameters:
p memory block
n matrix dimension
matrix matrix

int ddf_writeShellListAndDensityMatricesToFile ( const BasisInfoStruct basisInfo,
int  noOfDensityMatrices,
ergo_real **  densityMatrixList,
const char *  fileName 
)

int ddf_writeShellListAndDensityMatricesToFile_sparse ( const BasisInfoStruct basisInfo,
int  noOfDensityMatrices,
matrix_description_struct densityMatrixList,
const char *  fileName 
)

Writes basisInfo and sparse matrices in a format that can be later read by ddf_load_density.

Data loss was observed with large files on AFS, we do extra verification to detect it early on...


Variable Documentation

const int DENSITY_FILE_VERSION_NUMBER = 10002

const ergo_real THRESHOLD_FOR_VECTOR_STORAGE = 1e-12


Generated on Wed Nov 21 09:32:02 2012 for ergo by  doxygen 1.4.7