|
| 1 | +#ifndef EFP2_H_INCLUDED |
| 2 | +#define EFP2_H_INCLUDED |
| 3 | + |
| 4 | +#include <vector> |
| 5 | + |
| 6 | +class EFP2_impl; |
| 7 | +class InputSection; |
| 8 | + |
| 9 | +class EFP2 { |
| 10 | +public: |
| 11 | + /* Initialize EFP2 instance using user's input. */ |
| 12 | + void init(InputSection &); |
| 13 | + |
| 14 | + /* Returns true if the current EFP2 instance was initialized. */ |
| 15 | + bool initialized(); |
| 16 | + |
| 17 | + /* Returns if_multipole_field value. */ |
| 18 | + bool get_if_multipole_field(); |
| 19 | + |
| 20 | + /* Returns updated if_multipole_field value. */ |
| 21 | + void update_multipole_field(); |
| 22 | + |
| 23 | + /* Returns if_pol_field value. */ |
| 24 | + bool get_if_pol_field(); |
| 25 | + |
| 26 | + /* Returns updated if_pol_field value. */ |
| 27 | + void update_pol_field(); |
| 28 | + |
| 29 | + /* Reorient EFP fragments according to Q-Chem's orientation of |
| 30 | + * ab initio subsystem. */ |
| 31 | + void reorient_geometry(); |
| 32 | + |
| 33 | + /* Print geometry of EFP subsystem. */ |
| 34 | + void print_geometry(); |
| 35 | + |
| 36 | + /* Setup all necessary stuff for AI/EFP dispersion computation |
| 37 | + * if enabled */ |
| 38 | + void setup_aiefp_dispersion(); |
| 39 | + |
| 40 | + /* Compute all EFP and the rest of QM/EFP interactions after |
| 41 | + * the QM SCF has converged. |
| 42 | + * \p do_grad - specifies whether to compute the gradient. |
| 43 | + * If \p do_grad is not zero than the gradient will also be |
| 44 | + * computed. */ |
| 45 | + void compute(int do_grad); |
| 46 | + |
| 47 | + /* Update quantum mechanical Hamiltonian with the contributions |
| 48 | + * from EFP multipoles and atoms using AOints. |
| 49 | + * \p h - a Hamiltonian matrix. |
| 50 | + * \p code - Q-Chem's ShlPrs code. */ |
| 51 | + void update_mult_ints(double *h, INTEGER code); |
| 52 | + |
| 53 | + /* Update quantum mechanical Hamiltonian with the contributions |
| 54 | + * from EFP induced diples using AOints. |
| 55 | + * \p h - a Hamiltonian matrix. |
| 56 | + * \p code - Q-Chem's ShlPrs code. */ |
| 57 | + void update_pol_ints(double *h, INTEGER code); |
| 58 | + |
| 59 | + /* Update quantum mechanical Hamiltonian with the contributions |
| 60 | + * from EFPs using AOints. |
| 61 | + * \p h - a Hamiltonian matrix. |
| 62 | + * \p code - Q-Chem's ShlPrs code. */ |
| 63 | + // void update_wf(double *h, INTEGER code); |
| 64 | + |
| 65 | + /* Update quantum mechanical Hamiltonian with the contributions |
| 66 | + * from EFPs using libqints. |
| 67 | + * \p h - a Hamiltonian matrix. |
| 68 | + * \p code - Q-Chem's ShlPrs code. */ |
| 69 | + void update_wf_qints(double *h, INTEGER code); |
| 70 | + |
| 71 | + /* Update the positions of quantum nuclei for libefp. */ |
| 72 | + void update_qm_atoms(); |
| 73 | + |
| 74 | + /* Returns the wavefunction dependent energy. |
| 75 | + * \p w - is a density matrix. |
| 76 | + * \p n - is a total number of elements in array \p w. */ |
| 77 | + double get_wf_dependent_energy(double *w, double n); |
| 78 | + |
| 79 | + /* Returns the total EFP energy. */ |
| 80 | + double get_total_energy(); |
| 81 | + |
| 82 | + /* Returns EFP correction to the energy of the excited state. |
| 83 | + * \p w - is the density matrix of the excited state WF. |
| 84 | + * \p n - is the total number of elements in array \p w. |
| 85 | + * \p Ecis - excitation energy */ |
| 86 | + double get_excited_state_energy_correction(double *w, size_t n, double Ecis); |
| 87 | + |
| 88 | + /* Returns gradient on quantum nuclei from EFP electrostatics. |
| 89 | + * Upon return the \p a vector will contain 3*N elements of |
| 90 | + * gradient, where N is the number of QM atoms. */ |
| 91 | + void get_qm_gradient(std::vector<double> &a); |
| 92 | + |
| 93 | + /* Returns current EFP gradient. |
| 94 | + * The vector \p a will contain 6*N gradient values for |
| 95 | + * fragment translation and rotation. N is the total number of |
| 96 | + * EFP fragments. */ |
| 97 | + void get_gradient(std::vector<double> &a); |
| 98 | + |
| 99 | + /* computes pairwise energies between QM region and EFP fragments. |
| 100 | + * \p Escf - reference AI energy (HF or excitation energy) |
| 101 | + * \p if_excited = 1/0 a switch to distinguish between the ground state (0) or excited state (1). */ |
| 102 | + void get_pairwise_energy(double Estate, int if_excited); |
| 103 | + |
| 104 | + /* Print EFP energy terms to stdout. */ |
| 105 | + void print_energy(); |
| 106 | + |
| 107 | + /* Print pairwise energy decomposition to stdout. |
| 108 | + * \p if_excited = 1/0 a switch to distinguish between the ground state (0) or excited state (1). */ |
| 109 | + void print_pairwise_energy(int if_excited); |
| 110 | + |
| 111 | + /* Returns a EFP2 singleton instance. */ |
| 112 | + static EFP2& instance() { |
| 113 | + static EFP2 instance; |
| 114 | + return instance; |
| 115 | + } |
| 116 | + |
| 117 | +private: |
| 118 | + EFP2(); |
| 119 | + EFP2(const EFP2 &); |
| 120 | + ~EFP2(); |
| 121 | + |
| 122 | + EFP2_impl *impl_; |
| 123 | +}; |
| 124 | + |
| 125 | +#endif /* EFP2_H_INCLUDED */ |
0 commit comments