#include <stdlib.h>
#include <cmath>
#include <stdio.h>
#include <errno.h>
#include <memory.h>
#include <time.h>
#include <pthread.h>
#include <stdexcept>
#include "grid_hicu.h"
#include "basisinfo.h"
#include "integrals_general.h"
#include "cubature_rules.h"
#include "utilities.h"
#include "pi.h"
#include "box_system.h"
#include "integrator.h"
#include "functionals.h"
#include "aos.h"
#include "dft_common.h"
#include "rho-mat.h"
#include "units.h"
Classes | |
struct | ShellSpecStructWithExtent |
struct | DensitySpecStruct |
struct | rhoTreeNode_ |
struct | GridGenerationParamsStruct |
struct | compute_grid_for_box_params_struct |
struct | ComputeGridResultValuesStruct |
struct | compute_grid_thread_func_struct |
Defines | |
#define | __CVERSION__ |
#define | _XOPEN_SOURCE 500 |
#define | _XOPEN_SOURCE_EXTENDED 1 |
#define | USE_EXP_STD |
#define | USE_ERF_STD |
#define | DO_EXTRA_ERROR_CHECKING |
#define | FILE_BATCH_N 1000000 |
#define | MAX_NO_OF_POINTS_PER_BATCH 100 |
#define | MAX_NO_OF_SHLBLOCKS 44444 |
#define | EXPONENT_DIFF_LIMIT 1e-22 |
#define | DISTR_CENTER_DIST_LIMIT 1e-22 |
#define | N_BATCH_JOBS 22 |
#define | MAX_NO_OF_POINTS_PER_WRITE 50000 |
#define | HICU_SPARSE_MATRIX_ACCESS_ROUTINE at |
#define | solid_harmonic_s_0(x, y, z, x2, y2, z2, r2) 1 |
#define | solid_harmonic_p_2(x, y, z, x2, y2, z2, r2) x |
#define | solid_harmonic_p_0(x, y, z, x2, y2, z2, r2) y |
#define | solid_harmonic_p_1(x, y, z, x2, y2, z2, r2) z |
#define | solid_harmonic_d_0(x, y, z, x2, y2, z2, r2) (x * y) |
#define | solid_harmonic_d_1(x, y, z, x2, y2, z2, r2) (y * z) |
#define | solid_harmonic_d_2(x, y, z, x2, y2, z2, r2) ((2 * z2 - x2 - y2) / (2 * std::sqrt((ergo_real)3))) |
#define | solid_harmonic_d_3(x, y, z, x2, y2, z2, r2) (x * z) |
#define | solid_harmonic_d_4(x, y, z, x2, y2, z2, r2) (0.5 * (x2 - y2)) |
#define | solid_harmonic_f_0(x, y, z, x2, y2, z2, r2) ((0.5 * std::sqrt(2.5) * (3 * x2 - y2) * y) / std::sqrt((ergo_real)15)) |
#define | solid_harmonic_f_1(x, y, z, x2, y2, z2, r2) (x * y * z) |
#define | solid_harmonic_f_2(x, y, z, x2, y2, z2, r2) (0.5 * std::sqrt((ergo_real)1.5) * (5 * z2 - r2) * y / std::sqrt((ergo_real)15)) |
#define | solid_harmonic_f_3(x, y, z, x2, y2, z2, r2) (0.5 * (5 * z2 - 3 * r2) * z / std::sqrt((ergo_real)15)) |
#define | solid_harmonic_f_4(x, y, z, x2, y2, z2, r2) (0.5 * std::sqrt((ergo_real)1.5) * (5 * z2 - r2) * x / std::sqrt((ergo_real)15)) |
#define | solid_harmonic_f_5(x, y, z, x2, y2, z2, r2) (0.5 * (x2 - y2) * z) |
#define | solid_harmonic_f_6(x, y, z, x2, y2, z2, r2) (0.5 * std::sqrt((ergo_real)2.5) * (x2 - 3 * y2) * x / std::sqrt((ergo_real)15)) |
#define | MAX_DEPTH 888 |
#define | MAX_NO_OF_TEST_POINTS 1000 |
Typedefs | |
typedef rhoTreeNode_ | rhoTreeNode |
typedef std::vector< std::vector< std::vector< int > > > | tripleVectorOfInt |
typedef real | coor3DPtr [3] |
Functions | |
static void | print_box (BoxStruct *box) |
static void | get_distribution_box (BoxStruct *box, DistributionSpecStruct *distr, real targetRhoError) |
static void | get_shell_box (BoxStruct *box, ShellSpecStructWithExtent *shell) |
static real | compute_value_at_point (DensitySpecStruct *density, int noOfNonzeroShells, int *nonZeroShellsIndexList, int noOfNonzeroBasFuncs, int *nonZeroBasFuncsIndexList, const real *localFullDensityMatrix, real(*coor)[3], real *workList) |
static real | compute_integral_from_points (const BasisInfoStruct &bis, DensitySpecStruct *density, int noOfNonzeroShells, int *nonZeroShellsIndexList, int noOfNonzeroBasFuncs, int *nonZeroBasFuncsIndexList, const real *localFullDensityMatrix, int nPoints, real(*coor)[3], real *weight, real *workList, real &minValue, real &maxValue, real &maxAbsValue) |
template<class Treal> | |
Treal | hicuErf (Treal a) |
template<> | |
float | hicuErf (float a) |
template<> | |
double | hicuErf (double a) |
template<> | |
long double | hicuErf (long double a) |
static real | to_power (real x, int n) |
static real | compute_1d_gaussian_integral_recursive (real a, real b, int n, real alpha) |
static real | compute_1d_gaussian_integral (real a, real b, int n, real alpha) |
static real | compute_integral_over_box (DistributionSpecStruct *distr, BoxStruct *box) |
static int | get_rhotree_indexes_for_box (int *resultList, int resultListMaxCount, const rhoTreeNode *node, const BoxStruct *inputBoxPtr) |
static void | callbackGga (DftIntegratorBl *grid, int bllen, real &energy) |
static void | callbackLda (DftIntegratorBl *grid, int bllen, real &energy) |
static void | integrate_density_and_energy (const BasisInfoStruct &bis, DensitySpecStruct *density, DftIntegratorBl *integrator, real &electrons, real &energy, int noOfGridPoints, real(*coor)[3], real *weight, real *dmagao) |
static int | compute_grid_for_box (compute_grid_for_box_params_struct *params, int maxlen, real(*coor)[3], real *weight, BoxStruct *box, real analyticalIntegralValue, real *workList, ComputeGridResultValuesStruct &resultValues, bool resolutionIsOk) |
static rhoTreeNode * | BuildRhoTreeBranch (int noOfDistributionsTot, DistributionSpecStruct *rho_alt_1, ShellSpecStructWithExtent *rho_alt_2, int distrIndexListN, int *distrIndexList, real targetRhoError) |
static rhoTreeNode * | BuildRhoTree (int noOfDistributions, DistributionSpecStruct *rho_alt_1, ShellSpecStructWithExtent *rho_alt_2, real targetRhoError) |
static void | free_rho_tree_memory (rhoTreeNode *rootNode) |
static int | round_real (real x) |
static void | getSubBox (const BoxStruct &startBox, BoxStruct &subBox, int Nx, int Ny, int Nz, int ix, int iy, int iz) |
static void * | compute_grid_thread_func (void *arg) |
static int | compute_grid (const BasisInfoStruct &bis, DensitySpecStruct *density, const GridGenerationParamsStruct &gridGenerationParams, real boxdist, real startBoxSizeDebug, const char *gridFileName, int noOfThreads, bool generateSparsePatternOnly, Dft::SparsePattern *sparsePattern) |
static int | do_merge_sort_distrs (int n, DistributionSpecStruct *list, DistributionSpecStruct *workList) |
static int | compute_extent_for_shells (ShellSpecStructWithExtent *shellList, const BasisInfoStruct &bis, real targetRhoError) |
static int | get_product_distrs (const BasisInfoStruct &bis, const Dft::Matrix &dmat, real targetRhoError, DistributionSpecStruct *rho, int maxCount) |
static void | get_shell_list_with_extents (const BasisInfoStruct &bis, int maxCountShellList, ShellSpecStructWithExtent *shellList, real targetRhoError) |
static int | get_density (const BasisInfoStruct &bis, DistributionSpecStruct *rho, int maxCountRho, real targetRhoError, int nbast, const Dft::Matrix &dmat, BasisFuncStruct *basisFuncList) |
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) |
void | grid_generate_sparse_pattern (const BasisInfoStruct &bis, ergo_real maxError, ergo_real boxSize, ergo_real startBoxSizeDebug, Dft::SparsePattern &sparsePattern) |
Variables | |
static const int | CUBATURE_RULE = 3 |
static const int | CUBATURE_RULE_2 = 6 |
const real | COORD_DIFF_FOR_SAMEPOINT_CRITERION = 1.0e-11 |
const real | DISTR_PRODUCT_THRESHOLD = 1e-12 |
const real | DENSITY_ACCURACY_COMPARISON_FACTOR = 10.0 |
const real | RELATIVE_DENSITY_VARIATION_LIMIT = 0.5 |
const real | DISTR_COEFF_CUTOFF_VALUE = 1e-12 |
const real | TARGET_RHO_ERROR_FACTOR = 1e-4 |
pthread_mutex_t | global_main_hicu_mutex = PTHREAD_MUTEX_INITIALIZER |
const int | HICU_GRID_PLOT_RESOLUTION = 50 |
#define __CVERSION__ |
#define _XOPEN_SOURCE 500 |
#define _XOPEN_SOURCE_EXTENDED 1 |
#define DISTR_CENTER_DIST_LIMIT 1e-22 |
#define DO_EXTRA_ERROR_CHECKING |
#define EXPONENT_DIFF_LIMIT 1e-22 |
#define FILE_BATCH_N 1000000 |
#define HICU_SPARSE_MATRIX_ACCESS_ROUTINE at |
#define MAX_DEPTH 888 |
#define MAX_NO_OF_POINTS_PER_BATCH 100 |
#define MAX_NO_OF_POINTS_PER_WRITE 50000 |
#define MAX_NO_OF_SHLBLOCKS 44444 |
#define MAX_NO_OF_TEST_POINTS 1000 |
#define N_BATCH_JOBS 22 |
#define solid_harmonic_d_0 | ( | x, | |||
y, | |||||
z, | |||||
x2, | |||||
y2, | |||||
z2, | |||||
r2 | ) | (x * y) |
#define solid_harmonic_d_1 | ( | x, | |||
y, | |||||
z, | |||||
x2, | |||||
y2, | |||||
z2, | |||||
r2 | ) | (y * z) |
#define solid_harmonic_d_2 | ( | x, | |||
y, | |||||
z, | |||||
x2, | |||||
y2, | |||||
z2, | |||||
r2 | ) | ((2 * z2 - x2 - y2) / (2 * std::sqrt((ergo_real)3))) |
#define solid_harmonic_d_3 | ( | x, | |||
y, | |||||
z, | |||||
x2, | |||||
y2, | |||||
z2, | |||||
r2 | ) | (x * z) |
#define solid_harmonic_d_4 | ( | x, | |||
y, | |||||
z, | |||||
x2, | |||||
y2, | |||||
z2, | |||||
r2 | ) | (0.5 * (x2 - y2)) |
#define solid_harmonic_f_0 | ( | x, | |||
y, | |||||
z, | |||||
x2, | |||||
y2, | |||||
z2, | |||||
r2 | ) | ((0.5 * std::sqrt(2.5) * (3 * x2 - y2) * y) / std::sqrt((ergo_real)15)) |
#define solid_harmonic_f_1 | ( | x, | |||
y, | |||||
z, | |||||
x2, | |||||
y2, | |||||
z2, | |||||
r2 | ) | (x * y * z) |
#define solid_harmonic_f_2 | ( | x, | |||
y, | |||||
z, | |||||
x2, | |||||
y2, | |||||
z2, | |||||
r2 | ) | (0.5 * std::sqrt((ergo_real)1.5) * (5 * z2 - r2) * y / std::sqrt((ergo_real)15)) |
#define solid_harmonic_f_3 | ( | x, | |||
y, | |||||
z, | |||||
x2, | |||||
y2, | |||||
z2, | |||||
r2 | ) | (0.5 * (5 * z2 - 3 * r2) * z / std::sqrt((ergo_real)15)) |
#define solid_harmonic_f_4 | ( | x, | |||
y, | |||||
z, | |||||
x2, | |||||
y2, | |||||
z2, | |||||
r2 | ) | (0.5 * std::sqrt((ergo_real)1.5) * (5 * z2 - r2) * x / std::sqrt((ergo_real)15)) |
#define solid_harmonic_f_5 | ( | x, | |||
y, | |||||
z, | |||||
x2, | |||||
y2, | |||||
z2, | |||||
r2 | ) | (0.5 * (x2 - y2) * z) |
#define solid_harmonic_f_6 | ( | x, | |||
y, | |||||
z, | |||||
x2, | |||||
y2, | |||||
z2, | |||||
r2 | ) | (0.5 * std::sqrt((ergo_real)2.5) * (x2 - 3 * y2) * x / std::sqrt((ergo_real)15)) |
#define solid_harmonic_p_0 | ( | x, | |||
y, | |||||
z, | |||||
x2, | |||||
y2, | |||||
z2, | |||||
r2 | ) | y |
#define solid_harmonic_p_1 | ( | x, | |||
y, | |||||
z, | |||||
x2, | |||||
y2, | |||||
z2, | |||||
r2 | ) | z |
#define solid_harmonic_p_2 | ( | x, | |||
y, | |||||
z, | |||||
x2, | |||||
y2, | |||||
z2, | |||||
r2 | ) | x |
#define solid_harmonic_s_0 | ( | x, | |||
y, | |||||
z, | |||||
x2, | |||||
y2, | |||||
z2, | |||||
r2 | ) | 1 |
#define USE_ERF_STD |
#define USE_EXP_STD |
typedef struct rhoTreeNode_ rhoTreeNode |
typedef std::vector< std::vector< std::vector<int> > > tripleVectorOfInt |
static rhoTreeNode* BuildRhoTree | ( | int | noOfDistributions, | |
DistributionSpecStruct * | rho_alt_1, | |||
ShellSpecStructWithExtent * | rho_alt_2, | |||
real | targetRhoError | |||
) | [static] |
static rhoTreeNode* BuildRhoTreeBranch | ( | int | noOfDistributionsTot, | |
DistributionSpecStruct * | rho_alt_1, | |||
ShellSpecStructWithExtent * | rho_alt_2, | |||
int | distrIndexListN, | |||
int * | distrIndexList, | |||
real | targetRhoError | |||
) | [static] |
static void callbackGga | ( | DftIntegratorBl * | grid, | |
int | bllen, | |||
real & | energy | |||
) | [static] |
static void callbackLda | ( | DftIntegratorBl * | grid, | |
int | bllen, | |||
real & | energy | |||
) | [static] |
static int compute_extent_for_shells | ( | ShellSpecStructWithExtent * | shellList, | |
const BasisInfoStruct & | bis, | |||
real | targetRhoError | |||
) | [static] |
static int compute_grid | ( | const BasisInfoStruct & | bis, | |
DensitySpecStruct * | density, | |||
const GridGenerationParamsStruct & | gridGenerationParams, | |||
real | boxdist, | |||
real | startBoxSizeDebug, | |||
const char * | gridFileName, | |||
int | noOfThreads, | |||
bool | generateSparsePatternOnly, | |||
Dft::SparsePattern * | sparsePattern | |||
) | [static] |
static int compute_grid_for_box | ( | compute_grid_for_box_params_struct * | params, | |
int | maxlen, | |||
real * | coor[3], | |||
real * | weight, | |||
BoxStruct * | box, | |||
real | analyticalIntegralValue, | |||
real * | workList, | |||
ComputeGridResultValuesStruct & | resultValues, | |||
bool | resolutionIsOk | |||
) | [static] |
static void* compute_grid_thread_func | ( | void * | arg | ) | [static] |
static real compute_integral_from_points | ( | const BasisInfoStruct & | bis, | |
DensitySpecStruct * | density, | |||
int | noOfNonzeroShells, | |||
int * | nonZeroShellsIndexList, | |||
int | noOfNonzeroBasFuncs, | |||
int * | nonZeroBasFuncsIndexList, | |||
const real * | localFullDensityMatrix, | |||
int | nPoints, | |||
real * | coor[3], | |||
real * | weight, | |||
real * | workList, | |||
real & | minValue, | |||
real & | maxValue, | |||
real & | maxAbsValue | |||
) | [static] |
static real compute_integral_over_box | ( | DistributionSpecStruct * | distr, | |
BoxStruct * | box | |||
) | [static] |
static real compute_value_at_point | ( | DensitySpecStruct * | density, | |
int | noOfNonzeroShells, | |||
int * | nonZeroShellsIndexList, | |||
int | noOfNonzeroBasFuncs, | |||
int * | nonZeroBasFuncsIndexList, | |||
const real * | localFullDensityMatrix, | |||
real * | coor[3], | |||
real * | workList | |||
) | [static] |
static int do_merge_sort_distrs | ( | int | n, | |
DistributionSpecStruct * | list, | |||
DistributionSpecStruct * | workList | |||
) | [static] |
static void free_rho_tree_memory | ( | rhoTreeNode * | rootNode | ) | [static] |
static int get_density | ( | const BasisInfoStruct & | bis, | |
DistributionSpecStruct * | rho, | |||
int | maxCountRho, | |||
real | targetRhoError, | |||
int | nbast, | |||
const Dft::Matrix & | dmat, | |||
BasisFuncStruct * | basisFuncList | |||
) | [static] |
static void get_distribution_box | ( | BoxStruct * | box, | |
DistributionSpecStruct * | distr, | |||
real | targetRhoError | |||
) | [static] |
static int get_product_distrs | ( | const BasisInfoStruct & | bis, | |
const Dft::Matrix & | dmat, | |||
real | targetRhoError, | |||
DistributionSpecStruct * | rho, | |||
int | maxCount | |||
) | [static] |
static int get_rhotree_indexes_for_box | ( | int * | resultList, | |
int | resultListMaxCount, | |||
const rhoTreeNode * | node, | |||
const BoxStruct * | inputBoxPtr | |||
) | [static] |
static void get_shell_box | ( | BoxStruct * | box, | |
ShellSpecStructWithExtent * | shell | |||
) | [static] |
static void get_shell_list_with_extents | ( | const BasisInfoStruct & | bis, | |
int | maxCountShellList, | |||
ShellSpecStructWithExtent * | shellList, | |||
real | targetRhoError | |||
) | [static] |
static void getSubBox | ( | const BoxStruct & | startBox, | |
BoxStruct & | subBox, | |||
int | Nx, | |||
int | Ny, | |||
int | Nz, | |||
int | ix, | |||
int | iy, | |||
int | iz | |||
) | [static] |
void grid_generate_sparse_pattern | ( | const BasisInfoStruct & | bis, | |
ergo_real | maxError, | |||
ergo_real | boxSize, | |||
ergo_real | startBoxSizeDebug, | |||
Dft::SparsePattern & | sparsePattern | |||
) |
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 | |||
) |
long double hicuErf | ( | long double | a | ) |
double hicuErf | ( | double | a | ) |
float hicuErf | ( | float | a | ) |
Treal hicuErf | ( | Treal | a | ) |
static void integrate_density_and_energy | ( | const BasisInfoStruct & | bis, | |
DensitySpecStruct * | density, | |||
DftIntegratorBl * | integrator, | |||
real & | electrons, | |||
real & | energy, | |||
int | noOfGridPoints, | |||
real * | coor[3], | |||
real * | weight, | |||
real * | dmagao | |||
) | [static] |
static void print_box | ( | BoxStruct * | box | ) | [static] |
static int round_real | ( | real | x | ) | [static] |
const real COORD_DIFF_FOR_SAMEPOINT_CRITERION = 1.0e-11 |
const int CUBATURE_RULE = 3 [static] |
const int CUBATURE_RULE_2 = 6 [static] |
const real DENSITY_ACCURACY_COMPARISON_FACTOR = 10.0 |
const real DISTR_COEFF_CUTOFF_VALUE = 1e-12 |
const real DISTR_PRODUCT_THRESHOLD = 1e-12 |
pthread_mutex_t global_main_hicu_mutex = PTHREAD_MUTEX_INITIALIZER |
const int HICU_GRID_PLOT_RESOLUTION = 50 |
const real RELATIVE_DENSITY_VARIATION_LIMIT = 0.5 |
const real TARGET_RHO_ERROR_FACTOR = 1e-4 |