1 /* Ergo, version 3.8, a program for linear scaling electronic structure
2  * calculations.
3  * Copyright (C) 2019 Elias Rudberg, Emanuel H. Rubensson, Pawel Salek,
4  * and Anastasia Kruchinina.
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  * Primary academic reference:
20  * Ergo: An open-source program for linear-scaling electronic structure
21  * calculations,
22  * Elias Rudberg, Emanuel H. Rubensson, Pawel Salek, and Anastasia
23  * Kruchinina,
24  * SoftwareX 7, 107 (2018),
25  * <http://dx.doi.org/10.1016/j.softx.2018.03.005>
26  *
27  * For further information about Ergo, see <http://www.ergoscf.org>.
28  */
29 
30 /** @file density_description_file.h
31 
32     @brief An interface file for writing and reading density matrices
33     to/from a file, including basis set information.
34 
35     @author: Elias Rudberg <em>responsible</em>
36 */
37 
38 #ifndef DENSITY_DESC_FILE
39 #define  DENSITY_DESC_FILE 1
40 
41 #include "basisinfo.h"
42 
43 
44 int ddf_writeShellListAndDensityMatricesToFile(const BasisInfoStruct & basisInfo,
45 					       int noOfDensityMatrices,
46 					       ergo_real** densityMatrixList,
47 					       const char* fileName);
48 
49 typedef struct
50 {
51   long nvalues;
52   int* rowind;
53   int* colind;
54   ergo_real* values;
55 } matrix_description_struct;
56 
57 /** Writes basisInfo and sparse matrices in a format that can be later
58     read by ddf_load_density.
59 */
60 
61 int ddf_writeShellListAndDensityMatricesToFile_sparse(const BasisInfoStruct & basisInfo,
62 						      int noOfDensityMatrices,
63 						      matrix_description_struct* densityMatrixList,
64 						      const char* fileName);
65 
66 
67 /** Function opens fileName, fills in basisInfo (which has
68    to be allocated and nullified), allocates densityMatrixList and
69    reads density matrix or at most two matrices and puts it/them in
70    densityMatrixList.
71 */
72 int ddf_load_density(const char *densityFileName,
73 		     int noOfDensityMatrices,
74 		     const IntegralInfo& integralInfo,
75 		     BasisInfoStruct **basisInfo,
76 		     ergo_real **densityMatrixList);
77 
78 /** Function opens fileName, fills in basisInfo (which has
79    to be allocated and nullified), allocates densityMatrixList and
80    reads density matrix or at most two matrices and puts it/them in
81    densityMatrixList.
82 */
83 int ddf_load_density_sparse(const char *densityFileName,
84 			    const IntegralInfo& integralInfo,
85 			    BasisInfoStruct **basisInfo,
86 			    int *noOfDensitiesRead,
87 			    int** rowindList,
88 			    int** colindList,
89 			    ergo_real** valuesList,
90 			    long* nvaluesList);
91 
92 
93 #endif /*  DENSITY_DESC_FILE */
94