Skip to content

Commit 7c2f5e0

Browse files
authored
Merge pull request #11 from libefp2/qchem
changes from qchem devel incorporated
2 parents 6afeff2 + 036ddf5 commit 7c2f5e0

5 files changed

Lines changed: 280 additions & 80 deletions

File tree

src/efp.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,8 @@ efp_prepare(struct efp *efp)
10761076

10771077
efp->indip = (vec_t *)calloc(efp->n_polarizable_pts, sizeof(vec_t));
10781078
efp->indipconj = (vec_t *)calloc(efp->n_polarizable_pts, sizeof(vec_t));
1079+
efp->indip_old = (vec_t *)calloc(efp->n_polarizable_pts, sizeof(vec_t));
1080+
efp->indipconj_old = (vec_t *)calloc(efp->n_polarizable_pts, sizeof(vec_t));
10791081
efp->grad = (six_t *)calloc(efp->n_frag, sizeof(six_t));
10801082
efp->skiplist = (char *)calloc(efp->n_frag * efp->n_frag, 1);
10811083
efp->pair_energies = (struct efp_energy *)calloc(efp->n_frag, sizeof(struct efp_energy));
@@ -1141,6 +1143,20 @@ efp_get_wavefunction_dependent_energy(struct efp *efp, double *energy)
11411143
return efp_compute_pol_energy(efp, energy);
11421144
}
11431145

1146+
EFP_EXPORT enum efp_result
1147+
efp_get_wavefunction_dependent_energy_correction(struct efp *efp, double *energy)
1148+
{
1149+
assert(efp);
1150+
assert(energy);
1151+
1152+
if (!(efp->opts.terms & EFP_TERM_POL) &&
1153+
!(efp->opts.terms & EFP_TERM_AI_POL)) {
1154+
*energy = 0.0;
1155+
return EFP_RESULT_SUCCESS;
1156+
}
1157+
return efp_compute_pol_correction(efp, energy);
1158+
}
1159+
11441160
EFP_EXPORT enum efp_result
11451161
efp_compute(struct efp *efp, int do_gradient)
11461162
{
@@ -1421,6 +1437,26 @@ efp_get_induced_dipole_conj_values(struct efp *efp, double *dip)
14211437
return EFP_RESULT_SUCCESS;
14221438
}
14231439

1440+
EFP_EXPORT enum efp_result
1441+
efp_get_old_induced_dipole_values(struct efp *efp, double *dip)
1442+
{
1443+
assert(efp);
1444+
assert(dip);
1445+
1446+
memcpy(dip, efp->indip_old, efp->n_polarizable_pts * sizeof(vec_t));
1447+
return EFP_RESULT_SUCCESS;
1448+
}
1449+
1450+
EFP_EXPORT enum efp_result
1451+
efp_get_old_induced_dipole_conj_values(struct efp *efp, double *dip)
1452+
{
1453+
assert(efp);
1454+
assert(dip);
1455+
1456+
memcpy(dip, efp->indipconj_old, efp->n_polarizable_pts * sizeof(vec_t));
1457+
return EFP_RESULT_SUCCESS;
1458+
}
1459+
14241460
EFP_EXPORT enum efp_result
14251461
efp_get_lmo_count(struct efp *efp, size_t frag_idx, size_t *n_lmo)
14261462
{
@@ -1489,6 +1525,8 @@ efp_shutdown(struct efp *efp)
14891525
free(efp->ptc_grad);
14901526
free(efp->indip);
14911527
free(efp->indipconj);
1528+
free(efp->indip_old);
1529+
free(efp->indipconj_old);
14921530
free(efp->ai_orbital_energies);
14931531
free(efp->ai_dipole_integrals);
14941532
free(efp->skiplist);

src/efp.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ struct efp_energy {
178178
* EFP/EFP electrostatic energy. */
179179
double electrostatic;
180180
/**
181+
* AI/EFP electrostatic energy. */
182+
double ai_electrostatic;
183+
/**
181184
* Charge penetration energy from overlap-based electrostatic
182185
* damping. Zero if overlap-based damping is turned off. */
183186
double charge_penetration;
@@ -189,6 +192,15 @@ struct efp_energy {
189192
* self-consistently so it can't be separated into EFP/EFP and AI/EFP
190193
* parts. */
191194
double polarization;
195+
/**
196+
* Separate storage for polarization corresponding to the excited/correlated state
197+
* (relevant for excited state QM/EFP calculations).
198+
*/
199+
double exs_polarization;
200+
/**
201+
* Polarization energy storage for pairwise AI/EFP analysis.
202+
* Not used in "normal" code */
203+
double ai_polarization;
192204
/**
193205
* EFP/EFP dispersion energy. */
194206
double dispersion;
@@ -682,6 +694,15 @@ enum efp_result efp_set_dipole_integrals(struct efp *efp, size_t n_core,
682694
enum efp_result efp_get_wavefunction_dependent_energy(struct efp *efp,
683695
double *energy);
684696

697+
/**
698+
* Computes excitation energy correction.
699+
* @param[in] efp The efp structure.
700+
* @param[out] energy Excitation energy correction.
701+
* @return ::EFP_RESULT_SUCCESS on success or error code otherwise.
702+
*/
703+
enum efp_result efp_get_wavefunction_dependent_energy_correction(struct efp *efp,
704+
double *energy);
705+
685706
/**
686707
* Perform the EFP computation.
687708
*
@@ -864,6 +885,24 @@ enum efp_result efp_get_induced_dipole_values(struct efp *efp, double *dip);
864885
enum efp_result efp_get_induced_dipole_conj_values(struct efp *efp,
865886
double *dip);
866887

888+
/**
889+
* Analogues to efp_get_induced_dipole_values but returnes "old" i.e. ground state induced dipoles
890+
* @param efp The efp structure.
891+
* @param dip Array where induced dipoles will be stored. The size of the
892+
* array must be at least [3 * \p n_dip] elements.
893+
* @return ::EFP_RESULT_SUCCESS on success or error code otherwise.
894+
*/
895+
enum efp_result efp_get_old_induced_dipole_values(struct efp *efp, double *dip);
896+
897+
/**
898+
* Analogues to efp_get_induced_dipole_conj_values but returnes "old" i.e. ground state induced dipoles
899+
* @param efp The efp structure.
900+
* @param dip Array where induced dipoles will be stored. The size of the
901+
* array must be at least [3 * \p n_dip] elements.
902+
* @return ::EFP_RESULT_SUCCESS on success or error code otherwise.
903+
*/
904+
enum efp_result efp_get_old_induced_dipole_conj_values(struct efp *efp, double *dip);
905+
867906
/**
868907
* Get the number of LMOs in a fragment.
869908
*

0 commit comments

Comments
 (0)