ergo
|
Configuration Interaction (CI) code. More...
#include <cstdlib>
#include <cstdio>
#include <memory.h>
#include <assert.h>
#include <vector>
#include "ci.h"
#include "output.h"
#include "utilities.h"
#include "integrals_2el_explicit.h"
#include "densfromf_full.h"
#include "simple_lanczos.h"
#include "operator_matrix.h"
#include "dipole_moment.h"
#include "../matrix/mat_gblas.h"
Classes | |
struct | four_idx_AO_struct |
struct | four_idx_SO_struct |
struct | two_idx_SO_struct |
struct | SO_struct |
struct | SlaterDet_struct |
struct | SlaterDet_pair_struct |
struct | contrib_debug_struct |
struct | pair_status_struct |
struct | MatVecMul |
struct | pqrs_struct |
Functions | |
static ergo_real | get_vector_norm (int n, const ergo_real *v) |
static void | normalize_vector (int n, ergo_real *v) |
void | get_1el_energy_and_gradient (int nSOs, int nEl, int nSlaterDets, const SlaterDet_struct *SlaterDetList, int nSlaterDetPairs, const SlaterDet_pair_struct *SlaterDet_pair_list, const int *pairCountList, int noOfTrialVectors, ergo_real *energy_list, ergo_real **coeffListList, const two_idx_SO_struct *h_SO, ergo_real **resultGradient_list) |
void | get_1el_contribs_to_mult_or_dmat (int nSOs, int nEl, int nSlaterDets, const SlaterDet_struct *SlaterDetList, const SlaterDet_pair_struct *SlaterDetPair, const two_idx_SO_struct *h_SO, const ergo_real *sourceVector, ergo_real *resultVector, two_idx_SO_struct *resultdmat) |
void | get_1el_contribs (int nSOs, int nEl, int nSlaterDets, const SlaterDet_struct *SlaterDetList, int nSlaterDetPairs, const SlaterDet_pair_struct *SlaterDet_pair_list, const int *pairCountList, const two_idx_SO_struct *h_SO, ergo_real *resultMatrix) |
void | get_2el_energy_and_gradient (int nSOs, int nEl, int nSlaterDets, const SlaterDet_struct *SlaterDetList, int nSlaterDetPairs, const SlaterDet_pair_struct *SlaterDet_pair_list, const int *pairCountList, int noOfTrialVectors, ergo_real *energy_list, ergo_real **coeffListList, const four_idx_SO_struct *g_SO, ergo_real **resultGradient_list) |
void | get_2el_contribs_to_mult_or_dmat (int nSOs, int nEl, int nSlaterDets, const SlaterDet_struct *SlaterDetList, const SlaterDet_pair_struct *SlaterDetPair, const four_idx_SO_struct *g_SO, const ergo_real *sourceVector, ergo_real *resultVector, four_idx_SO_struct *result_dmat_2el) |
void | get_2el_contribs (int nSOs, int nEl, int nSlaterDets, const SlaterDet_struct *SlaterDetList, int nSlaterDetPairs, const SlaterDet_pair_struct *SlaterDet_pair_list, const int *pairCountList, const four_idx_SO_struct *g_SO, ergo_real *resultMatrix) |
int | get_1e_density_matrix (int nSOs, int nEl, two_idx_SO_struct *D, int nSlaterDets, const SlaterDet_struct *SlaterDetList, const ergo_real *coeffList) |
int | get_2e_density_matrix (int nSOs, int nEl, four_idx_SO_struct *d, int nSlaterDets, const SlaterDet_struct *SlaterDetList, const ergo_real *coeffList) |
ergo_real | get_CI_energy (int nSOs, int nEl, const four_idx_SO_struct *g_SO, const two_idx_SO_struct *h_SO, int nSlaterDets, const SlaterDet_struct *SlaterDetList, const ergo_real *coeffList, ergo_real nuclearEnergy) |
void | get_CI_energy_and_gradient (int nSOs, int nEl, const four_idx_SO_struct *g_SO, const two_idx_SO_struct *h_SO, int nSlaterDets, const SlaterDet_struct *SlaterDetList, int nSlaterDetPairs, const SlaterDet_pair_struct *SlaterDet_pair_list, const int *pairCountList, int noOfTrialVectors, ergo_real *energyList, ergo_real **coeffListList, ergo_real **gradientList, ergo_real nuclearEnergy) |
void | mult_by_CI_matrix (int nSOs, int nEl, const four_idx_SO_struct *g_SO, const two_idx_SO_struct *h_SO, int nSlaterDets, const SlaterDet_struct *SlaterDetList, int nSlaterDetPairs, const SlaterDet_pair_struct *SlaterDet_pair_list, const int *pairCountList, const ergo_real *sourceVector, ergo_real *resultVector, ergo_real shift) |
void | get_CI_matrix (int nSOs, int nEl, const four_idx_SO_struct *g_SO, const two_idx_SO_struct *h_SO, int nSlaterDets, const SlaterDet_struct *SlaterDetList, int nSlaterDetPairs, const SlaterDet_pair_struct *SlaterDet_pair_list, const int *pairCountList, ergo_real *resultMatrix) |
int | get_combinations (SlaterDet_struct *SlaterDetList, int nEl, int nSOs) |
int | get_FCI_Slater_dets_alpha_beta (SlaterDet_struct *SlaterDetList, int nEl_a, int nEl_b, int nSOs) |
int | get_FCI_Slater_dets_all (SlaterDet_struct *SlaterDetList, int nElTot, int nSOs) |
static ergo_real | rand_m1_to_1 () |
void | get_relevant_SlaterDet_pairs_recursive_do_mult_or_dmat (SlaterDet_struct **groupList, int nEl, int level, int groupIdx1, int groupIdx2, int ia, int ib, int aDiffCount, int bDiffCount, pair_status_struct *status, int nSOs, int nSlaterDets, const SlaterDet_struct *SlaterDetList, const four_idx_SO_struct *g_SO, const two_idx_SO_struct *h_SO, const ergo_real *sourceVector, ergo_real *resultVector, two_idx_SO_struct *result_dmat_1el, four_idx_SO_struct *result_dmat_2el) |
void | mult_by_CI_matrix_direct (int nSOs, int nEl, const four_idx_SO_struct *g_SO, const two_idx_SO_struct *h_SO, int nSlaterDets, const SlaterDet_struct *SlaterDetList, SlaterDet_struct **groupList, const ergo_real *sourceVector, ergo_real *resultVector, ergo_real shift) |
static ergo_real | get_SlaterDet_energy (int nSOs, int nEl, const four_idx_SO_struct *g_SO, const two_idx_SO_struct *h_SO, const SlaterDet_struct *SlaterDet) |
int | get_relevant_SlaterDet_pairs_recursive_2 (SlaterDet_struct **groupList, int nEl, SlaterDet_pair_struct *resultList, int level, int groupIdx1, int groupIdx2, int ia, int ib, int aDiffCount, int bDiffCount, pair_status_struct *status) |
int | get_relevant_SlaterDet_pairs_recursive (int nSlaterDets, SlaterDet_struct *SlaterDetList, SlaterDet_struct **groupList, int nEl, SlaterDet_pair_struct *resultList, int level, int groupIdx1, int groupIdx2) |
int | get_relevant_SlaterDet_pairs (int nSlaterDets, SlaterDet_struct *SlaterDetList, SlaterDet_struct **groupList, int nEl, SlaterDet_pair_struct *resultList) |
ergo_real | get_eigs (int n, ergo_real *M, ergo_real *bestVector, ergo_real *eigValListResult) |
int | get_Lowdin_orbitals (int n, const ergo_real *S, ergo_real *MOs) |
int | do_power_method (int n, ergo_real *A, ergo_real *v) |
int | do_CI (const BasisInfoStruct &basisInfo, const IntegralInfo &integralInfo, const CI::Options &options, const Molecule &molecule, const ergo_real *S, const ergo_real *h_AO, const ergo_real *F_a, const ergo_real *F_b, int n_el_a, int n_el_b, ergo_real nuclearEnergy, ergo_real HF_energy) |
Variables | |
const int | MAX_AOS = 30 |
const int | MAX_SOS = 2 * MAX_AOS |
const int | MAX_ELECTRONS = 40 |
const int | SPIN_A = 1 |
const int | SPIN_B = 2 |
Configuration Interaction (CI) code.
int do_CI | ( | const BasisInfoStruct & | basisInfo, |
const IntegralInfo & | integralInfo, | ||
const CI::Options & | options, | ||
const Molecule & | molecule, | ||
const ergo_real * | S, | ||
const ergo_real * | h_AO, | ||
const ergo_real * | F_a, | ||
const ergo_real * | F_b, | ||
int | n_el_a, | ||
int | n_el_b, | ||
ergo_real | nuclearEnergy, | ||
ergo_real | HF_energy | ||
) |
References SO_struct::coeffs, SlaterDet_struct::count, do_2e_integral(), simple_lanczos::do_lanczos_method(), do_output(), CI::Options::energy_diff_limit, MatVecMul::g_SO, get_dipole_moment_fullmat(), get_F_orbs(), get_FCI_Slater_dets_alpha_beta(), get_Lowdin_orbitals(), get_relevant_SlaterDet_pairs_recursive_do_mult_or_dmat(), get_SlaterDet_energy(), MatVecMul::groupList, MatVecMul::h_SO, LOG_AREA_CI, LOG_CAT_ERROR, LOG_CAT_INFO, MAX_AOS, MAX_ELECTRONS, CI::Options::max_no_of_iterations, MatVecMul::nEl, BasisInfoStruct::noOfBasisFuncs, normalize_vector(), MatVecMul::nSlaterDets, MatVecMul::nSOs, output_current_memory_usage(), rand_m1_to_1(), CI::Options::shift, MatVecMul::shift, MatVecMul::SlaterDetList, SlaterDet_struct::SO_list, SO_struct::spin, SPIN_A, SPIN_B, SlaterDet_struct::startIndex, CI::Options::use_energy_diff_limit, CI::Options::use_lowdin_orbitals, CI::Options::use_random_orbitals, CI::Options::use_random_starting_guess, four_idx_AO_struct::x, four_idx_SO_struct::x, and two_idx_SO_struct::x.
Referenced by es_run().
References A, do_output(), get_vector_norm(), LOG_AREA_CI, LOG_CAT_INFO, and normalize_vector().
int get_1e_density_matrix | ( | int | nSOs, |
int | nEl, | ||
two_idx_SO_struct * | D, | ||
int | nSlaterDets, | ||
const SlaterDet_struct * | SlaterDetList, | ||
const ergo_real * | coeffList | ||
) |
References MAX_ELECTRONS, mat::sign(), SlaterDet_struct::SO_list, template_blas_fabs(), and two_idx_SO_struct::x.
Referenced by get_CI_energy().
void get_1el_contribs | ( | int | nSOs, |
int | nEl, | ||
int | nSlaterDets, | ||
const SlaterDet_struct * | SlaterDetList, | ||
int | nSlaterDetPairs, | ||
const SlaterDet_pair_struct * | SlaterDet_pair_list, | ||
const int * | pairCountList, | ||
const two_idx_SO_struct * | h_SO, | ||
ergo_real * | resultMatrix | ||
) |
void get_1el_contribs_to_mult_or_dmat | ( | int | nSOs, |
int | nEl, | ||
int | nSlaterDets, | ||
const SlaterDet_struct * | SlaterDetList, | ||
const SlaterDet_pair_struct * | SlaterDetPair, | ||
const two_idx_SO_struct * | h_SO, | ||
const ergo_real * | sourceVector, | ||
ergo_real * | resultVector, | ||
two_idx_SO_struct * | resultdmat | ||
) |
References SlaterDet_pair_struct::a, SlaterDet_pair_struct::b, MAX_ELECTRONS, SlaterDet_pair_struct::nDiff, SlaterDet_struct::SO_list, SlaterDet_pair_struct::SOs_a, SlaterDet_pair_struct::SOs_b, and two_idx_SO_struct::x.
Referenced by get_relevant_SlaterDet_pairs_recursive_do_mult_or_dmat(), get_SlaterDet_energy(), and mult_by_CI_matrix().
void get_1el_energy_and_gradient | ( | int | nSOs, |
int | nEl, | ||
int | nSlaterDets, | ||
const SlaterDet_struct * | SlaterDetList, | ||
int | nSlaterDetPairs, | ||
const SlaterDet_pair_struct * | SlaterDet_pair_list, | ||
const int * | pairCountList, | ||
int | noOfTrialVectors, | ||
ergo_real * | energy_list, | ||
ergo_real ** | coeffListList, | ||
const two_idx_SO_struct * | h_SO, | ||
ergo_real ** | resultGradient_list | ||
) |
int get_2e_density_matrix | ( | int | nSOs, |
int | nEl, | ||
four_idx_SO_struct * | d, | ||
int | nSlaterDets, | ||
const SlaterDet_struct * | SlaterDetList, | ||
const ergo_real * | coeffList | ||
) |
References MAX_ELECTRONS, mat::sign(), SlaterDet_struct::SO_list, template_blas_fabs(), and four_idx_SO_struct::x.
Referenced by get_CI_energy().
void get_2el_contribs | ( | int | nSOs, |
int | nEl, | ||
int | nSlaterDets, | ||
const SlaterDet_struct * | SlaterDetList, | ||
int | nSlaterDetPairs, | ||
const SlaterDet_pair_struct * | SlaterDet_pair_list, | ||
const int * | pairCountList, | ||
const four_idx_SO_struct * | g_SO, | ||
ergo_real * | resultMatrix | ||
) |
void get_2el_contribs_to_mult_or_dmat | ( | int | nSOs, |
int | nEl, | ||
int | nSlaterDets, | ||
const SlaterDet_struct * | SlaterDetList, | ||
const SlaterDet_pair_struct * | SlaterDetPair, | ||
const four_idx_SO_struct * | g_SO, | ||
const ergo_real * | sourceVector, | ||
ergo_real * | resultVector, | ||
four_idx_SO_struct * | result_dmat_2el | ||
) |
References SlaterDet_pair_struct::a, SlaterDet_pair_struct::b, SlaterDet_pair_struct::nDiff, SlaterDet_struct::SO_list, SlaterDet_pair_struct::SOs_a, SlaterDet_pair_struct::SOs_a_pos, SlaterDet_pair_struct::SOs_b, SlaterDet_pair_struct::SOs_b_pos, and four_idx_SO_struct::x.
Referenced by get_relevant_SlaterDet_pairs_recursive_do_mult_or_dmat(), get_SlaterDet_energy(), and mult_by_CI_matrix().
void get_2el_energy_and_gradient | ( | int | nSOs, |
int | nEl, | ||
int | nSlaterDets, | ||
const SlaterDet_struct * | SlaterDetList, | ||
int | nSlaterDetPairs, | ||
const SlaterDet_pair_struct * | SlaterDet_pair_list, | ||
const int * | pairCountList, | ||
int | noOfTrialVectors, | ||
ergo_real * | energy_list, | ||
ergo_real ** | coeffListList, | ||
const four_idx_SO_struct * | g_SO, | ||
ergo_real ** | resultGradient_list | ||
) |
ergo_real get_CI_energy | ( | int | nSOs, |
int | nEl, | ||
const four_idx_SO_struct * | g_SO, | ||
const two_idx_SO_struct * | h_SO, | ||
int | nSlaterDets, | ||
const SlaterDet_struct * | SlaterDetList, | ||
const ergo_real * | coeffList, | ||
ergo_real | nuclearEnergy | ||
) |
References get_1e_density_matrix(), get_2e_density_matrix(), four_idx_SO_struct::x, and two_idx_SO_struct::x.
void get_CI_energy_and_gradient | ( | int | nSOs, |
int | nEl, | ||
const four_idx_SO_struct * | g_SO, | ||
const two_idx_SO_struct * | h_SO, | ||
int | nSlaterDets, | ||
const SlaterDet_struct * | SlaterDetList, | ||
int | nSlaterDetPairs, | ||
const SlaterDet_pair_struct * | SlaterDet_pair_list, | ||
const int * | pairCountList, | ||
int | noOfTrialVectors, | ||
ergo_real * | energyList, | ||
ergo_real ** | coeffListList, | ||
ergo_real ** | gradientList, | ||
ergo_real | nuclearEnergy | ||
) |
References do_output(), get_1el_energy_and_gradient(), get_2el_energy_and_gradient(), LOG_AREA_CI, and LOG_CAT_INFO.
void get_CI_matrix | ( | int | nSOs, |
int | nEl, | ||
const four_idx_SO_struct * | g_SO, | ||
const two_idx_SO_struct * | h_SO, | ||
int | nSlaterDets, | ||
const SlaterDet_struct * | SlaterDetList, | ||
int | nSlaterDetPairs, | ||
const SlaterDet_pair_struct * | SlaterDet_pair_list, | ||
const int * | pairCountList, | ||
ergo_real * | resultMatrix | ||
) |
References get_1el_contribs(), and get_2el_contribs().
int get_combinations | ( | SlaterDet_struct * | SlaterDetList, |
int | nEl, | ||
int | nSOs | ||
) |
References MAX_SOS.
Referenced by get_FCI_Slater_dets_all(), and get_FCI_Slater_dets_alpha_beta().
References A, do_output(), LOG_AREA_CI, LOG_CAT_ERROR, and mat::syev().
int get_FCI_Slater_dets_all | ( | SlaterDet_struct * | SlaterDetList, |
int | nElTot, | ||
int | nSOs | ||
) |
References get_combinations().
int get_FCI_Slater_dets_alpha_beta | ( | SlaterDet_struct * | SlaterDetList, |
int | nEl_a, | ||
int | nEl_b, | ||
int | nSOs | ||
) |
References SlaterDet_struct::count, do_output(), get_combinations(), LOG_AREA_CI, LOG_CAT_INFO, and SlaterDet_struct::startIndex.
Referenced by do_CI().
References A, do_output(), LOG_AREA_CI, LOG_CAT_ERROR, mat::syev(), and template_blas_sqrt().
Referenced by do_CI().
int get_relevant_SlaterDet_pairs | ( | int | nSlaterDets, |
SlaterDet_struct * | SlaterDetList, | ||
SlaterDet_struct ** | groupList, | ||
int | nEl, | ||
SlaterDet_pair_struct * | resultList | ||
) |
References get_relevant_SlaterDet_pairs_recursive_2().
int get_relevant_SlaterDet_pairs_recursive | ( | int | nSlaterDets, |
SlaterDet_struct * | SlaterDetList, | ||
SlaterDet_struct ** | groupList, | ||
int | nEl, | ||
SlaterDet_pair_struct * | resultList, | ||
int | level, | ||
int | groupIdx1, | ||
int | groupIdx2 | ||
) |
References SlaterDet_pair_struct::a, SlaterDet_pair_struct::b, SlaterDet_struct::count, MAX_SOS, SlaterDet_pair_struct::nDiff, SlaterDet_struct::SO_list, SlaterDet_pair_struct::SOs_a, SlaterDet_pair_struct::SOs_a_pos, SlaterDet_pair_struct::SOs_b, SlaterDet_pair_struct::SOs_b_pos, and SlaterDet_struct::startIndex.
int get_relevant_SlaterDet_pairs_recursive_2 | ( | SlaterDet_struct ** | groupList, |
int | nEl, | ||
SlaterDet_pair_struct * | resultList, | ||
int | level, | ||
int | groupIdx1, | ||
int | groupIdx2, | ||
int | ia, | ||
int | ib, | ||
int | aDiffCount, | ||
int | bDiffCount, | ||
pair_status_struct * | status | ||
) |
References SlaterDet_pair_struct::a, pair_status_struct::aDiffList, pair_status_struct::aDiffPosList, SlaterDet_pair_struct::b, pair_status_struct::bDiffList, pair_status_struct::bDiffPosList, SlaterDet_struct::count, SlaterDet_pair_struct::nDiff, SlaterDet_struct::SO_list, SlaterDet_pair_struct::SOs_a, SlaterDet_pair_struct::SOs_a_pos, SlaterDet_pair_struct::SOs_b, SlaterDet_pair_struct::SOs_b_pos, and SlaterDet_struct::startIndex.
Referenced by get_relevant_SlaterDet_pairs().
void get_relevant_SlaterDet_pairs_recursive_do_mult_or_dmat | ( | SlaterDet_struct ** | groupList, |
int | nEl, | ||
int | level, | ||
int | groupIdx1, | ||
int | groupIdx2, | ||
int | ia, | ||
int | ib, | ||
int | aDiffCount, | ||
int | bDiffCount, | ||
pair_status_struct * | status, | ||
int | nSOs, | ||
int | nSlaterDets, | ||
const SlaterDet_struct * | SlaterDetList, | ||
const four_idx_SO_struct * | g_SO, | ||
const two_idx_SO_struct * | h_SO, | ||
const ergo_real * | sourceVector, | ||
ergo_real * | resultVector, | ||
two_idx_SO_struct * | result_dmat_1el, | ||
four_idx_SO_struct * | result_dmat_2el | ||
) |
References SlaterDet_pair_struct::a, pair_status_struct::aDiffList, pair_status_struct::aDiffPosList, SlaterDet_pair_struct::b, pair_status_struct::bDiffList, pair_status_struct::bDiffPosList, SlaterDet_struct::count, get_1el_contribs_to_mult_or_dmat(), get_2el_contribs_to_mult_or_dmat(), SlaterDet_pair_struct::nDiff, SlaterDet_struct::SO_list, SlaterDet_pair_struct::SOs_a, SlaterDet_pair_struct::SOs_a_pos, SlaterDet_pair_struct::SOs_b, SlaterDet_pair_struct::SOs_b_pos, and SlaterDet_struct::startIndex.
Referenced by do_CI(), and mult_by_CI_matrix_direct().
|
static |
References SlaterDet_pair_struct::a, SlaterDet_pair_struct::b, get_1el_contribs_to_mult_or_dmat(), get_2el_contribs_to_mult_or_dmat(), and SlaterDet_pair_struct::nDiff.
Referenced by do_CI().
References template_blas_sqrt().
Referenced by do_power_method(), and normalize_vector().
void mult_by_CI_matrix | ( | int | nSOs, |
int | nEl, | ||
const four_idx_SO_struct * | g_SO, | ||
const two_idx_SO_struct * | h_SO, | ||
int | nSlaterDets, | ||
const SlaterDet_struct * | SlaterDetList, | ||
int | nSlaterDetPairs, | ||
const SlaterDet_pair_struct * | SlaterDet_pair_list, | ||
const int * | pairCountList, | ||
const ergo_real * | sourceVector, | ||
ergo_real * | resultVector, | ||
ergo_real | shift | ||
) |
References get_1el_contribs_to_mult_or_dmat(), and get_2el_contribs_to_mult_or_dmat().
void mult_by_CI_matrix_direct | ( | int | nSOs, |
int | nEl, | ||
const four_idx_SO_struct * | g_SO, | ||
const two_idx_SO_struct * | h_SO, | ||
int | nSlaterDets, | ||
const SlaterDet_struct * | SlaterDetList, | ||
SlaterDet_struct ** | groupList, | ||
const ergo_real * | sourceVector, | ||
ergo_real * | resultVector, | ||
ergo_real | shift | ||
) |
References get_relevant_SlaterDet_pairs_recursive_do_mult_or_dmat().
Referenced by MatVecMul::do_mat_vec_mul().
|
static |
References get_vector_norm().
Referenced by do_CI(), and do_power_method().
const int MAX_AOS = 30 |
Referenced by do_CI().
const int MAX_ELECTRONS = 40 |
const int MAX_SOS = 2 * MAX_AOS |
Referenced by get_combinations(), and get_relevant_SlaterDet_pairs_recursive().
const int SPIN_A = 1 |
Referenced by do_CI().
const int SPIN_B = 2 |
Referenced by do_CI().