ergo
grid_reader.h
Go to the documentation of this file.
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 
38 /* -*-mode:c; c-style:bsd; c-basic-offset:4;indent-tabs-mode:nil; -*- */
39 
40 #if !defined(_GRID_READER_H_)
41 #define _GRID_READER_H_ 1
42 
43 #include "sparse_pattern.h"
44 #include "grid_stream.h"
45 #include "grid_interface.h"
46 #include "grid_params.h"
47 #include "grid_matrix.h"
48 
49 struct DftGridReader;
50 
52 Dft::Matrix* createGridMatrix(const Dft::SparseMatrix& mat);
53 
54 DftGridReader* grid_open_full(const class GridGenMolInfo *mol_info,
55  const Dft::GridParams& gss,
56  Dft::SparsePattern *pattern,
57  const Dft::Matrix* dmat,
58  const BasisInfoStruct& bis);
59 
60 bool grid_is_ready();
61 
62 int grid_getchunk_blocked(DftGridReader* grid_handle, int maxlen,
63  int *nblocks, int *shlblocks,
64  real (*coor)[3], real *weight);
65 
66 #define grid_getchunk_plain(r,m,coor,w) \
67  (grid_getchunk_blocked((r),(m),NULL,NULL,(coor),(w)))
68 void grid_close(DftGridReader *rawgrid);
69 void grid_free_files();
70 void grid_set_tmpdir(const char *tmpdir);
71 
72 #endif /* !defined(_GRID_READER_H_) */
73 
74 
FullMatrixWrapper
Definition: grid_reader.cc:50
FullMatrixWrapper::at
virtual ergo_real at(int row, int col) const
Definition: grid_reader.cc:54
Dft::HiCuGridParams::compare_to_refined
int compare_to_refined
Definition: grid_params.h:52
Dft::HiCuGridParams::maxError
ergo_real maxError
Definition: grid_params.h:47
grid_hicu.h
Hierarchical Cubature (HiCu) grid generation.
grid_file
static FILE * grid_file
Definition: grid_reader.cc:125
dft_common.h
Common DFT routines. Mostly functional mixing.
grid_file_name
static char * grid_file_name
Definition: grid_reader.cc:127
ergo_real
double ergo_real
Definition: realtype.h:69
Dft::FullMatrix::nbast
int nbast
Definition: grid_matrix.h:56
Dft::HiCuGridParams::use_energy_criterion_only
int use_energy_criterion_only
Definition: grid_params.h:54
grid_open_stream
static void grid_open_stream(const class GridGenMolInfo &molInfo, const Dft::GridParams &gss, Dft::SparsePattern *pattern, DftGridReader *reader)
Definition: grid_reader.cc:172
createGridMatrix
Dft::Matrix * createGridMatrix(const Dft::FullMatrix &mat)
Definition: grid_reader.cc:78
GRID_PATT_NAME
#define GRID_PATT_NAME
Definition: grid_reader.cc:122
grid_set_tmpdir
void grid_set_tmpdir(const char *tmpdir)
Definition: grid_reader.cc:116
Dft::HiCuGridParams::do_double_checking
int do_double_checking
Definition: grid_params.h:51
grid_interface.h
Dft::FullMatrix
Definition: grid_matrix.h:53
BasisInfoStruct
Definition: basisinfo.h:112
real
ergo_real real
Definition: test.cc:46
sparse_pattern.h
Class that can be used to store sparse matrix patterns.
SparseMatrixWrapper::at
virtual ergo_real at(int row, int col) const
Definition: grid_reader.cc:67
Dft::HiCuGridParams::start_box_size_debug
ergo_real start_box_size_debug
Definition: grid_params.h:49
SparseMatrixWrapper::SparseMatrixWrapper
SparseMatrixWrapper(const Dft::SparseMatrix &m)
Definition: grid_reader.cc:66
Dft::GridParams
A structure describing the grid settings.
Definition: grid_params.h:59
SparseMatrixWrapper::asFull
virtual const ergo_real * asFull() const
Definition: grid_reader.cc:72
Dft::GridParams::hicuParams
HiCuGridParams hicuParams
Definition: grid_params.h:74
grid_stream.h
Streaming grid generator.
grid_tmpdir
std::string grid_tmpdir
Definition: grid_reader.cc:97
grid_set_tmpdir
void grid_set_tmpdir(const char *tmpdir)
Definition: grid_reader.cc:116
dft_get_num_threads
EXTERN_C int dft_get_num_threads(void)
Definition: dft_common.cc:203
Dft::HiCuGridParams::use_energy_criterion
int use_energy_criterion
Definition: grid_params.h:53
Dft::HiCuGridParams::box_size
ergo_real box_size
Definition: grid_params.h:48
dal_new
#define dal_new(sz, tp)
Definition: dft_common.h:125
grid_atexit_registered
static int grid_atexit_registered
Definition: grid_reader.cc:150
patt_file_name
static char * patt_file_name
Definition: grid_reader.cc:128
grid_open_full
DftGridReader * grid_open_full(const class GridGenMolInfo *mol_info, const Dft::GridParams &gss, Dft::SparsePattern *pattern, const Dft::Matrix *dmat, const BasisInfoStruct &bis)
Returns a handle to a grid file.
Definition: grid_reader.cc:282
grid_open_cartesian
static void grid_open_cartesian(const BasisInfoStruct &bis, const Dft::GridParams &gss, const Dft::Matrix *dmat, Dft::SparsePattern *pattern, DftGridReader *reader)
Definition: grid_reader.cc:222
grid_free_files
void grid_free_files()
Frees all the cached data if any.
Definition: grid_reader.cc:135
SparseMatrixWrapper::isSparse
virtual bool isSparse() const
Definition: grid_reader.cc:69
grid_atexit
static void grid_atexit(void)
Definition: grid_reader.cc:152
mat
Definition: allocate.cc:39
grid_open_full
DftGridReader * grid_open_full(const class GridGenMolInfo *mol_info, const Dft::GridParams &gss, Dft::SparsePattern *pattern, const Dft::Matrix *dmat, const BasisInfoStruct &bis)
Returns a handle to a grid file.
Definition: grid_reader.cc:282
DftGridReader::f
FILE * f
Definition: grid_reader.cc:167
MY_MPI_NUM
static const int MY_MPI_NUM
Definition: grid_reader.cc:170
grid_stream_generate
unsigned grid_stream_generate(ErgoGridStream *stream, const char *fname, int noOfThreads)
Generate grid for given molecule.
Definition: grid_stream.cc:1033
grid_params.h
Code organizing various settings related to grids used for numerical integration.
grdone_mutex
static pthread_mutex_t grdone_mutex
Definition: grid_reader.cc:130
grid_stream_free
void grid_stream_free(ErgoGridStream *stream)
Definition: grid_stream.cc:1064
FullMatrixWrapper::isSparse
virtual bool isSparse() const
Definition: grid_reader.cc:56
grid_getchunk_blocked
int grid_getchunk_blocked(DftGridReader *rawgrid, int maxlen, int *nBlocks, int *shlBlocks, real(*coor)[3], real *weight)
grid_getchunk_blocked() reads grid data also with screening information if only nblocks and shlblocks...
Definition: grid_reader.cc:325
grid_get_fname
static char * grid_get_fname(const char *base, int filenum)
Definition: grid_reader.cc:99
SparseMatrixWrapper::asSparse
virtual const Dft::SparseMatrix * asSparse() const
Definition: grid_reader.cc:70
Dft::GridParams::gridType
GridType gridType
Definition: grid_params.h:70
grid_close
void grid_close(DftGridReader *rawgrid)
Closes the shared grid handle that is specifed as the argument.
Definition: grid_reader.cc:386
DftGridReader
Definition: grid_reader.cc:166
grid_stream_new
ErgoGridStream * grid_stream_new(const struct Dft::GridParams &gss, const GridGenMolInfo &molInfo)
Creates the grid object.
Definition: grid_stream.cc:999
grid_getchunk_blocked
int grid_getchunk_blocked(DftGridReader *grid_handle, int maxlen, int *nblocks, int *shlblocks, real(*coor)[3], real *weight)
grid_getchunk_blocked() reads grid data also with screening information if only nblocks and shlblocks...
Definition: grid_reader.cc:325
ErgoGridStream
Ergo-specific GridStream implementation.
Definition: grid_stream.cc:973
Dft::HiCuGridParams::use_error_per_volume
int use_error_per_volume
Definition: grid_params.h:50
SparseMatrixWrapper
Definition: grid_reader.cc:63
grid_close
void grid_close(DftGridReader *rawgrid)
Closes the shared grid handle that is specifed as the argument.
Definition: grid_reader.cc:386
FullMatrixWrapper::asSparse
virtual const Dft::SparseMatrix * asSparse() const
Definition: grid_reader.cc:57
Dft::FullMatrix::mat
ergo_real * mat
Definition: grid_matrix.h:55
grid_file_open_count
static int grid_file_open_count
Definition: grid_reader.cc:126
Dft::HiCuGridParams::do_variation_checking
int do_variation_checking
Definition: grid_params.h:55
SparseMatrixWrapper::matrix
const Dft::SparseMatrix & matrix
Definition: grid_reader.cc:64
GRID_BASE_NAME
#define GRID_BASE_NAME
Definition: grid_reader.cc:121
Dft::GridParams::TYPE_STANDARD
@ TYPE_STANDARD
Definition: grid_params.h:68
grid_stream_set_sparse_pattern
void grid_stream_set_sparse_pattern(ErgoGridStream *stream, Dft::SparsePattern *pattern)
Definition: grid_stream.cc:1020
hicu_grid_generate
int hicu_grid_generate(const char *grid_file_name, const BasisInfoStruct &bis, ergo_real maxError, ergo_real boxSize, ergo_real startBoxSizeDebug, int use_error_per_volume, int do_double_checking, int compare_to_refined, int use_energy_criterion, int use_energy_criterion_only, int do_variation_checking, const Dft::Matrix *dmat, Dft::SparsePattern *sparsePattern, int nThreads, bool generateSparsePatternOnly)
Definition: grid_hicu.cc:2687
GridGenMolInfo
GridGenMolInfo is an abstract class providing information about the molecule so that the grid generat...
Definition: grid_interface.h:45
Dft::GridParams::TYPE_HICU
@ TYPE_HICU
Definition: grid_params.h:68
FullMatrixWrapper::FullMatrixWrapper
FullMatrixWrapper(const Dft::FullMatrix &m)
Definition: grid_reader.cc:53
grid_matrix.h
Generic matrix interface. It is not optimized for speed.
FullMatrixWrapper::asFull
virtual const ergo_real * asFull() const
Definition: grid_reader.cc:59
grid_mutex
static pthread_mutex_t grid_mutex
Definition: grid_reader.cc:129
Dft::Matrix
Definition: grid_matrix.h:44
grid_reader.h
Grid Generator interface. Functions for opening grid file, reading chunks from it,...
grid_is_ready
bool grid_is_ready()
Definition: grid_reader.cc:160
grid_free_files
void grid_free_files()
Frees all the cached data if any.
Definition: grid_reader.cc:135
createGridMatrix
Dft::Matrix * createGridMatrix(const Dft::FullMatrix &mat)
Definition: grid_reader.cc:78
grid_is_ready
bool grid_is_ready()
Definition: grid_reader.cc:160
FullMatrixWrapper::matrix
const Dft::FullMatrix & matrix
Definition: grid_reader.cc:51