Skip to content

Commit 45dd092

Browse files
committed
match with qchem 1
1 parent c7377d7 commit 45dd092

8 files changed

Lines changed: 88 additions & 2453 deletions

File tree

EFP2.C

Lines changed: 0 additions & 2320 deletions
This file was deleted.

EFP2.h

Lines changed: 0 additions & 125 deletions
This file was deleted.

setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/zsh
22

3-
export TORCH_SWITCH=ON
3+
export TORCH_SWITCH=OFF
44

55
export LIBEFP_DIR="./"
66
export INSTALLATION_DIR="$LIBEFP_DIR"

src/efp.c

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1729,7 +1729,7 @@ efp_compute(struct efp *efp, int do_gradient)
17291729
efp_balance_work(efp, compute_two_body_range, NULL);
17301730
}
17311731
else { // high-symmetry crystals
1732-
if ((res = compute_two_body_crystal(efp))) {
1732+
if ((res = compute_two_body_crystal(efp))){
17331733
efp_log("compute_two_body_crystal() failure");
17341734
return res;
17351735
}
@@ -1739,11 +1739,11 @@ efp_compute(struct efp *efp, int do_gradient)
17391739
efp_log("efp_compute_pol() failure");
17401740
return res;
17411741
}
1742-
if ((res = efp_compute_ai_elec(efp))) {
1742+
if ((res = efp_compute_ai_elec(efp))){
17431743
efp_log("efp_compute_ai_elec() failure");
17441744
return res;
17451745
}
1746-
if ((res = efp_compute_ai_disp(efp))) {
1746+
if ((res = efp_compute_ai_disp(efp))){
17471747
efp_log("efp_compute_ai_disp() failure");
17481748
return res;
17491749
}
@@ -1928,7 +1928,8 @@ efp_get_multipole_values(struct efp *efp, double *mult)
19281928
for (size_t j = 0; j < frag->n_multipole_pts; j++) {
19291929
struct multipole_pt *pt = frag->multipole_pts + j;
19301930

1931-
*mult++ = pt->monopole;
1931+
// monopole and nuclear charges are added together as of 2025: LVS
1932+
*mult++ = pt->monopole + pt->znuc;
19321933

19331934
*mult++ = pt->dipole.x;
19341935
*mult++ = pt->dipole.y;
@@ -1943,6 +1944,24 @@ efp_get_multipole_values(struct efp *efp, double *mult)
19431944
return EFP_RESULT_SUCCESS;
19441945
}
19451946

1947+
EFP_EXPORT enum efp_result
1948+
efp_get_mono_values(struct efp *efp, double *monopoles)
1949+
{
1950+
assert(efp);
1951+
assert(monopoles);
1952+
1953+
for (size_t i = 0; i < efp->n_frag; i++) {
1954+
struct frag *frag = efp->frags + i;
1955+
1956+
for (size_t j = 0; j < frag->n_multipole_pts; j++) {
1957+
struct multipole_pt *pt = frag->multipole_pts + j;
1958+
1959+
*monopoles++ = pt->monopole;
1960+
}
1961+
}
1962+
return EFP_RESULT_SUCCESS;
1963+
}
1964+
19461965
EFP_EXPORT enum efp_result
19471966
efp_get_dipole_values(struct efp *efp, double *dipoles)
19481967
{
@@ -2659,6 +2678,28 @@ save_ai_field_pol_pt(struct efp *efp, struct efp_pol_pt *pol_pt, size_t frag_idx
26592678
return EFP_RESULT_SUCCESS;
26602679
}
26612680

2681+
EFP_EXPORT enum efp_result
2682+
save_ai_field(struct efp *efp, double *field) {
2683+
assert(efp);
2684+
assert(field);
2685+
2686+
size_t k = 0;
2687+
for (size_t i = 0; i < efp->n_frag; i++) {
2688+
struct frag *frag = efp->frags + i;
2689+
2690+
for (size_t j = 0; j < frag->n_polarizable_pts; j++) {
2691+
struct polarizable_pt *pt = frag->polarizable_pts + j;
2692+
2693+
pt->elec_field_wf.x = -field[k];
2694+
pt->elec_field_wf.y = -field[k+1];
2695+
pt->elec_field_wf.z = -field[k+2];
2696+
k = k+3;
2697+
2698+
//print_pol_pt(efp,i,j);
2699+
}
2700+
}
2701+
return EFP_RESULT_SUCCESS;
2702+
}
26622703

26632704
EFP_EXPORT void
26642705
efp_torque_to_derivative(const double *euler, const double *torque,
@@ -2688,7 +2729,7 @@ efp_banner(void)
26882729
static const char banner[] =
26892730
"LIBEFP ver. " LIBEFP_VERSION_STRING "\n"
26902731
"Copyright (c) 2012-2017 Ilya Kaliman\n"
2691-
" 2018-2022 Lyudmila Slipchenko\n"
2732+
" 2018-2025 Lyudmila Slipchenko\n"
26922733
"\n"
26932734
"Journal References:\n"
26942735
" - Kaliman and Slipchenko, JCC 2013.\n"

src/efp.h

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ struct efp_opts {
177177
enum efp_elec_damp elec_damp;
178178
/** Polarization damping type (see #efp_pol_damp). */
179179
enum efp_pol_damp pol_damp;
180+
/** Polarization damping value (see #efp_pol_damp_tt_value). */
181+
double pol_damp_tt_value;
180182
/** Driver used to find polarization induced dipoles. */
181183
enum efp_pol_driver pol_driver;
182184
/** Enable periodic boundary conditions if nonzero. */
@@ -994,14 +996,27 @@ enum efp_result efp_get_multipole_coordinates(struct efp *efp, double *xyz);
994996
*/
995997
enum efp_result efp_get_multipole_values(struct efp *efp, double *mult);
996998

999+
/**
1000+
*
1001+
* @param efp The efp structure.
1002+
* @param[out] monopoles Array with all efp monopoles.
1003+
*
1004+
* The size of the \p monopoles array must be at least [\p n_mult] elements
1005+
* where \p n_mult is the value returned by the ::efp_get_multipole_count function.
1006+
* Only monopoles (no nuclear charges) are returned by this funciton.
1007+
*
1008+
* \return ::EFP_RESULT_SUCCESS on success or error code otherwise.
1009+
*/
1010+
enum efp_result efp_get_mono_values(struct efp *efp, double *monopoles);
1011+
9971012
/**
9981013
* Get electrostatics dipoles from EFP fragments.
9991014
*
10001015
* \param[in] efp The efp structure.
10011016
*
10021017
* \param[out] dipoles Array with all efp dipoles.
10031018
*
1004-
* The size of the \p mult array must be at least [3 * \p n_mult] elements
1019+
* The size of the \p dipoles array must be at least [3 * \p n_mult] elements
10051020
* where \p n_mult is the value returned by the ::efp_get_multipole_count function.
10061021
*
10071022
* \return ::EFP_RESULT_SUCCESS on success or error code otherwise.
@@ -1402,6 +1417,14 @@ efp_get_frag_pol_pt(struct efp *efp, size_t frag_idx, size_t pt_idx,
14021417
enum efp_result
14031418
save_ai_field_pol_pt(struct efp *efp, struct efp_pol_pt *pol_pt, size_t frag_idx, size_t pt_idx);
14041419

1420+
/**
1421+
* Saves ab initio field into polarizable points
1422+
* @param efp
1423+
* @param field pointer to the ab initio field
1424+
* @return
1425+
*/
1426+
enum efp_result save_ai_field(struct efp *efp, double *field);
1427+
14051428
/**
14061429
* Get electric field for a point on a fragment.
14071430
*

src/parse.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1565,7 +1565,8 @@ parse_file(struct efp *efp, struct stream *stream)
15651565
efp->lib[efp->n_lib - 1] = frag;
15661566

15671567
/* default value */
1568-
frag->pol_damp = 0.6;
1568+
//frag->pol_damp = 0.6; //commented out for ticket 3416
1569+
frag->pol_damp = efp->opts.pol_damp_tt_value;
15691570

15701571
efp_stream_next_line(stream);
15711572
efp_stream_next_line(stream);

src/pol.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,7 @@ efp_compute_pol_energy(struct efp *efp, double *energy)
959959

960960
assert(energy);
961961

962+
printf("\nin efp_compute_pol_energy\n");
962963
// counter to know when to zero out induced dipoles and static field
963964
// need to be explored further
964965
static int counter = 0;
@@ -1290,6 +1291,8 @@ efp_compute_pol(struct efp *efp)
12901291
!(efp->opts.terms & EFP_TERM_AI_POL))
12911292
return EFP_RESULT_SUCCESS;
12921293

1294+
printf("\nin efp_compute_pol\n");
1295+
12931296
// this is standard non-symmetric case
12941297
if (! efp->opts.symmetry) {
12951298
if ((res = efp_compute_pol_energy(efp, &efp->energy.polarization)))

tests/tt.in

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
run_type grad
2+
coord xyzabc
3+
terms elec pol
4+
elec_damp screen
5+
fraglib_path ../fraglib
6+
print 2
7+
8+
fragment h2o_l
9+
0.0 0.0 0.0 1.0 2.0 3.0
10+
11+
fragment nh3_l
12+
5.0 0.0 0.0 5.0 2.0 8.0

0 commit comments

Comments
 (0)