2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2004, The GROMACS development team,
6 * check out http://www.gromacs.org for more information.
7 * Copyright (c) 2012,2013, by the GROMACS development team, led by
8 * David van der Spoel, Berk Hess, Erik Lindahl, and including many
9 * others, as listed in the AUTHORS file in the top-level source
10 * directory and at http://www.gromacs.org.
12 * GROMACS is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public License
14 * as published by the Free Software Foundation; either version 2.1
15 * of the License, or (at your option) any later version.
17 * GROMACS is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with GROMACS; if not, see
24 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
25 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 * If you want to redistribute modifications to GROMACS, please
28 * consider that scientific software is very special. Version
29 * control is crucial - bugs must be traceable. We will be happy to
30 * consider code for inclusion in the official distribution, but
31 * derived work must not be called official GROMACS. Details are found
32 * in the README & COPYING files - if they are missing, get the
33 * official version at http://www.gromacs.org.
35 * To help us fund GROMACS development, we humbly ask that you cite
36 * the research papers on the package. Check out http://www.gromacs.org.
46 #include "nonbonded.h"
47 #include "nb_kernel.h"
51 gmx_nb_free_energy_kernel(t_nblist * nlist,
56 nb_kernel_data_t * kernel_data,
63 int i, j, n, ii, is3, ii3, k, nj0, nj1, jnr, j3, ggid;
65 real Fscal, FscalC[NSTATES], FscalV[NSTATES], tx, ty, tz;
66 real Vcoul[NSTATES], Vvdw[NSTATES];
67 real rinv6, r, rt, rtC, rtV;
69 real qq[NSTATES], vctot, krsq;
70 int ntiA, ntiB, tj[NSTATES];
71 real Vvdw6, Vvdw12, vvtot;
72 real ix, iy, iz, fix, fiy, fiz;
73 real dx, dy, dz, rsq, rinv;
74 real c6[NSTATES], c12[NSTATES];
75 real LFC[NSTATES], LFV[NSTATES], DLF[NSTATES];
76 double dvdl_coul, dvdl_vdw;
77 real lfac_coul[NSTATES], dlfac_coul[NSTATES], lfac_vdw[NSTATES], dlfac_vdw[NSTATES];
78 real sigma6[NSTATES], alpha_vdw_eff, alpha_coul_eff, sigma2_def, sigma2_min;
79 real rp, rpm2, rC, rV, rinvC, rpinvC, rinvV, rpinvV;
80 real sigma2[NSTATES], sigma_pow[NSTATES], sigma_powm2[NSTATES], rs, rs2;
81 int do_coultab, do_vdwtab, do_tab, tab_elemsize;
82 int n0, n1C, n1V, nnn;
83 real Y, F, G, H, Fp, Geps, Heps2, epsC, eps2C, epsV, eps2V, VV, FF;
101 real facel, krf, crf;
104 real sigma6_min, sigma6_def, lam_power, sc_power, sc_r_power;
105 real alpha_coul, alpha_vdw, lambda_coul, lambda_vdw, ewc;
111 real rcoulomb, rvdw, sh_invrc6;
112 gmx_bool bExactElecCutoff, bExactVdwCutoff;
113 real rcutoff, rcutoff2, rswitch, d, d2, swV3, swV4, swV5, swF2, swF3, swF4, sw, dsw, rinvcorr;
118 fshift = fr->fshift[0];
119 Vc = kernel_data->energygrp_elec;
120 Vv = kernel_data->energygrp_vdw;
121 tabscale = kernel_data->table_elec_vdw->scale;
122 VFtab = kernel_data->table_elec_vdw->data;
126 jindex = nlist->jindex;
128 icoul = nlist->ielec;
130 shift = nlist->shift;
133 shiftvec = fr->shift_vec[0];
134 chargeA = mdatoms->chargeA;
135 chargeB = mdatoms->chargeB;
139 ewc = fr->ewaldcoeff;
140 Vc = kernel_data->energygrp_elec;
141 typeA = mdatoms->typeA;
142 typeB = mdatoms->typeB;
145 Vv = kernel_data->energygrp_vdw;
146 tabscale = kernel_data->table_elec_vdw->scale;
147 VFtab = kernel_data->table_elec_vdw->data;
148 lambda_coul = kernel_data->lambda[efptCOUL];
149 lambda_vdw = kernel_data->lambda[efptVDW];
150 dvdl = kernel_data->dvdl;
151 alpha_coul = fr->sc_alphacoul;
152 alpha_vdw = fr->sc_alphavdw;
153 lam_power = fr->sc_power;
154 sc_r_power = fr->sc_r_power;
155 sigma6_def = fr->sc_sigma6_def;
156 sigma6_min = fr->sc_sigma6_min;
157 bDoForces = kernel_data->flags & GMX_NONBONDED_DO_FORCE;
159 rcoulomb = fr->rcoulomb;
161 sh_invrc6 = fr->ic->sh_invrc6;
163 if (fr->coulomb_modifier == eintmodPOTSWITCH || fr->vdw_modifier == eintmodPOTSWITCH)
165 rcutoff = (fr->coulomb_modifier == eintmodPOTSWITCH) ? fr->rcoulomb : fr->rvdw;
166 rcutoff2 = rcutoff*rcutoff;
167 rswitch = (fr->coulomb_modifier == eintmodPOTSWITCH) ? fr->rcoulomb_switch : fr->rvdw_switch;
169 swV3 = -10.0/(d*d*d);
170 swV4 = 15.0/(d*d*d*d);
171 swV5 = -6.0/(d*d*d*d*d);
172 swF2 = -30.0/(d*d*d);
173 swF3 = 60.0/(d*d*d*d);
174 swF4 = -30.0/(d*d*d*d*d);
178 /* Stupid compilers dont realize these variables will not be used */
188 bExactElecCutoff = (fr->coulomb_modifier != eintmodNONE) || fr->eeltype == eelRF_ZERO;
189 bExactVdwCutoff = (fr->vdw_modifier != eintmodNONE);
191 /* fix compiler warnings */
200 /* Lambda factor for state A, 1-lambda*/
201 LFC[STATE_A] = 1.0 - lambda_coul;
202 LFV[STATE_A] = 1.0 - lambda_vdw;
204 /* Lambda factor for state B, lambda*/
205 LFC[STATE_B] = lambda_coul;
206 LFV[STATE_B] = lambda_vdw;
208 /*derivative of the lambda factor for state A and B */
212 for (i = 0; i < NSTATES; i++)
214 lfac_coul[i] = (lam_power == 2 ? (1-LFC[i])*(1-LFC[i]) : (1-LFC[i]));
215 dlfac_coul[i] = DLF[i]*lam_power/sc_r_power*(lam_power == 2 ? (1-LFC[i]) : 1);
216 lfac_vdw[i] = (lam_power == 2 ? (1-LFV[i])*(1-LFV[i]) : (1-LFV[i]));
217 dlfac_vdw[i] = DLF[i]*lam_power/sc_r_power*(lam_power == 2 ? (1-LFV[i]) : 1);
220 sigma2_def = pow(sigma6_def, 1.0/3.0);
221 sigma2_min = pow(sigma6_min, 1.0/3.0);
223 /* Ewald (not PME) table is special (icoul==enbcoulFEWALD) */
225 do_coultab = (icoul == GMX_NBKERNEL_ELEC_CUBICSPLINETABLE);
226 do_vdwtab = (ivdw == GMX_NBKERNEL_VDW_CUBICSPLINETABLE);
228 do_tab = do_coultab || do_vdwtab;
230 /* we always use the combined table here */
233 for (n = 0; (n < nri); n++)
237 shY = shiftvec[is3+1];
238 shZ = shiftvec[is3+2];
246 iqA = facel*chargeA[ii];
247 iqB = facel*chargeB[ii];
248 ntiA = 2*ntype*typeA[ii];
249 ntiB = 2*ntype*typeB[ii];
256 for (k = nj0; (k < nj1); k++)
263 rsq = dx*dx+dy*dy+dz*dz;
264 rinv = gmx_invsqrt(rsq);
266 if (sc_r_power == 6.0)
268 rpm2 = rsq*rsq; /* r4 */
269 rp = rpm2*rsq; /* r6 */
271 else if (sc_r_power == 48.0)
273 rp = rsq*rsq*rsq; /* r6 */
274 rp = rp*rp; /* r12 */
275 rp = rp*rp; /* r24 */
276 rp = rp*rp; /* r48 */
277 rpm2 = rp/rsq; /* r46 */
281 rp = pow(r, sc_r_power); /* not currently supported as input, but can handle it */
285 tj[STATE_A] = ntiA+2*typeA[jnr];
286 tj[STATE_B] = ntiB+2*typeB[jnr];
287 qq[STATE_A] = iqA*chargeA[jnr];
288 qq[STATE_B] = iqB*chargeB[jnr];
290 for (i = 0; i < NSTATES; i++)
294 c12[i] = nbfp[tj[i]+1];
295 if ((c6[i] > 0) && (c12[i] > 0))
297 /* c12 is stored scaled with 12.0 and c6 is scaled with 6.0 - correct for this */
298 sigma6[i] = 0.5*c12[i]/c6[i];
299 sigma2[i] = pow(sigma6[i], 1.0/3.0);
300 /* should be able to get rid of this ^^^ internal pow call eventually. Will require agreement on
301 what data to store externally. Can't be fixed without larger scale changes, so not 4.6 */
302 if (sigma6[i] < sigma6_min) /* for disappearing coul and vdw with soft core at the same time */
304 sigma6[i] = sigma6_min;
305 sigma2[i] = sigma2_min;
310 sigma6[i] = sigma6_def;
311 sigma2[i] = sigma2_def;
313 if (sc_r_power == 6.0)
315 sigma_pow[i] = sigma6[i];
316 sigma_powm2[i] = sigma6[i]/sigma2[i];
318 else if (sc_r_power == 48.0)
320 sigma_pow[i] = sigma6[i]*sigma6[i]; /* sigma^12 */
321 sigma_pow[i] = sigma_pow[i]*sigma_pow[i]; /* sigma^24 */
322 sigma_pow[i] = sigma_pow[i]*sigma_pow[i]; /* sigma^48 */
323 sigma_powm2[i] = sigma_pow[i]/sigma2[i];
326 { /* not really supported as input, but in here for testing the general case*/
327 sigma_pow[i] = pow(sigma2[i], sc_r_power/2);
328 sigma_powm2[i] = sigma_pow[i]/(sigma2[i]);
332 /* only use softcore if one of the states has a zero endstate - softcore is for avoiding infinities!*/
333 if ((c12[STATE_A] > 0) && (c12[STATE_B] > 0))
340 alpha_vdw_eff = alpha_vdw;
341 alpha_coul_eff = alpha_coul;
344 for (i = 0; i < NSTATES; i++)
351 /* Only spend time on A or B state if it is non-zero */
352 if ( (qq[i] != 0) || (c6[i] != 0) || (c12[i] != 0) )
355 /* this section has to be inside the loop becaue of the dependence on sigma_pow */
356 rpinvC = 1.0/(alpha_coul_eff*lfac_coul[i]*sigma_pow[i]+rp);
357 rinvC = pow(rpinvC, 1.0/sc_r_power);
360 rpinvV = 1.0/(alpha_vdw_eff*lfac_vdw[i]*sigma_pow[i]+rp);
361 rinvV = pow(rpinvV, 1.0/sc_r_power);
370 n1C = tab_elemsize*n0;
376 n1V = tab_elemsize*n0;
379 /* With Ewald and soft-core we should put the cut-off on r,
380 * not on the soft-cored rC, as the real-space and
381 * reciprocal space contributions should (almost) cancel.
384 !(bExactElecCutoff &&
385 ((icoul != GMX_NBKERNEL_ELEC_EWALD && rC >= rcoulomb) ||
386 (icoul == GMX_NBKERNEL_ELEC_EWALD && r >= rcoulomb))))
390 case GMX_NBKERNEL_ELEC_COULOMB:
391 case GMX_NBKERNEL_ELEC_EWALD:
392 /* simple cutoff (yes, ewald is done all on direct space for free energy) */
393 Vcoul[i] = qq[i]*rinvC;
394 FscalC[i] = Vcoul[i]*rpinvC;
397 case GMX_NBKERNEL_ELEC_REACTIONFIELD:
399 Vcoul[i] = qq[i]*(rinvC+krf*rC*rC-crf);
400 FscalC[i] = qq[i]*(rinvC*rpinvC-2.0*krf);
403 case GMX_NBKERNEL_ELEC_CUBICSPLINETABLE:
404 /* non-Ewald tabulated coulomb */
408 Geps = epsC*VFtab[nnn+2];
409 Heps2 = eps2C*VFtab[nnn+3];
412 FF = Fp+Geps+2.0*Heps2;
414 FscalC[i] = -qq[i]*tabscale*FF*rC*rpinvC;
417 case GMX_NBKERNEL_ELEC_GENERALIZEDBORN:
418 gmx_fatal(FARGS, "Free energy and GB not implemented.\n");
421 case GMX_NBKERNEL_ELEC_NONE:
427 gmx_incons("Invalid icoul in free energy kernel");
431 if (fr->coulomb_modifier == eintmodPOTSWITCH)
434 d = (d > 0.0) ? d : 0.0;
436 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
437 dsw = d2*(swF2+d*(swF3+d*swF4));
440 FscalC[i] = FscalC[i]*sw + Vcoul[i]*dsw;
444 if ((c6[i] != 0 || c12[i] != 0) &&
445 !(bExactVdwCutoff && rV >= rvdw))
449 case GMX_NBKERNEL_VDW_LENNARDJONES:
451 if (sc_r_power == 6.0)
457 rinv6 = pow(rinvV, 6.0);
460 Vvdw12 = c12[i]*rinv6*rinv6;
461 if (fr->vdw_modifier == eintmodPOTSHIFT)
463 Vvdw[i] = ( (Vvdw12-c12[i]*sh_invrc6*sh_invrc6)*(1.0/12.0)
464 -(Vvdw6-c6[i]*sh_invrc6)*(1.0/6.0));
468 Vvdw[i] = Vvdw12*(1.0/12.0)-Vvdw6*(1.0/6.0);
470 FscalV[i] = (Vvdw12-Vvdw6)*rpinvV;
473 case GMX_NBKERNEL_VDW_BUCKINGHAM:
474 gmx_fatal(FARGS, "Buckingham free energy not supported.");
477 case GMX_NBKERNEL_VDW_CUBICSPLINETABLE:
483 Geps = epsV*VFtab[nnn+2];
484 Heps2 = eps2V*VFtab[nnn+3];
487 FF = Fp+Geps+2.0*Heps2;
489 FscalV[i] -= c6[i]*tabscale*FF*rV*rpinvV;
494 Geps = epsV*VFtab[nnn+6];
495 Heps2 = eps2V*VFtab[nnn+7];
498 FF = Fp+Geps+2.0*Heps2;
499 Vvdw[i] += c12[i]*VV;
500 FscalV[i] -= c12[i]*tabscale*FF*rV*rpinvV;
503 case GMX_NBKERNEL_VDW_NONE:
509 gmx_incons("Invalid ivdw in free energy kernel");
513 if (fr->vdw_modifier == eintmodPOTSWITCH)
516 d = (d > 0.0) ? d : 0.0;
518 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
519 dsw = d2*(swF2+d*(swF3+d*swF4));
522 FscalV[i] = FscalV[i]*sw + Vvdw[i]*dsw;
524 FscalV[i] = (rV < rvdw) ? FscalV[i] : 0.0;
525 Vvdw[i] = (rV < rvdw) ? Vvdw[i] : 0.0;
533 if (icoul == GMX_NBKERNEL_ELEC_EWALD &&
534 !(bExactElecCutoff && r >= rcoulomb))
536 /* because we compute the softcore normally,
537 we have to remove the ewald short range portion. Done outside of
538 the states loop because this part doesn't depend on the scaled R */
541 /* Relative accuracy at R_ERF_R_INACC of 3e-10 */
542 #define R_ERF_R_INACC 0.006
544 /* Relative accuracy at R_ERF_R_INACC of 2e-5 */
545 #define R_ERF_R_INACC 0.1
547 if (ewc*r > R_ERF_R_INACC)
549 VV = gmx_erf(ewc*r)*rinv;
550 FF = rinv*rinv*(VV - ewc*M_2_SQRTPI*exp(-ewc*ewc*rsq));
555 FF = ewc*ewc*ewc*M_2_SQRTPI*(2.0/3.0 - 0.4*ewc*ewc*rsq);
558 for (i = 0; i < NSTATES; i++)
560 vctot -= LFC[i]*qq[i]*VV;
561 Fscal -= LFC[i]*qq[i]*FF;
562 dvdl_coul -= (DLF[i]*qq[i])*VV;
566 /* Assemble A and B states */
567 for (i = 0; i < NSTATES; i++)
569 vctot += LFC[i]*Vcoul[i];
570 vvtot += LFV[i]*Vvdw[i];
572 Fscal += LFC[i]*FscalC[i]*rpm2;
573 Fscal += LFV[i]*FscalV[i]*rpm2;
575 dvdl_coul += Vcoul[i]*DLF[i] + LFC[i]*alpha_coul_eff*dlfac_coul[i]*FscalC[i]*sigma_pow[i];
576 dvdl_vdw += Vvdw[i]*DLF[i] + LFV[i]*alpha_vdw_eff*dlfac_vdw[i]*FscalV[i]*sigma_pow[i];
588 f[j3+1] = f[j3+1] - ty;
589 f[j3+2] = f[j3+2] - tz;
595 f[ii3] = f[ii3] + fix;
596 f[ii3+1] = f[ii3+1] + fiy;
597 f[ii3+2] = f[ii3+2] + fiz;
598 fshift[is3] = fshift[is3] + fix;
599 fshift[is3+1] = fshift[is3+1] + fiy;
600 fshift[is3+2] = fshift[is3+2] + fiz;
603 Vc[ggid] = Vc[ggid] + vctot;
604 Vv[ggid] = Vv[ggid] + vvtot;
607 dvdl[efptCOUL] += dvdl_coul;
608 dvdl[efptVDW] += dvdl_vdw;
610 /* Estimate flops, average for free energy stuff:
611 * 12 flops per outer iteration
612 * 150 flops per inner iteration
614 inc_nrnb(nrnb, eNR_NBKERNEL_FREE_ENERGY, nlist->nri*12 + nlist->jindex[n]*150);
618 nb_free_energy_evaluate_single(real r2, real sc_r_power, real alpha_coul, real alpha_vdw,
619 real tabscale, real *vftab,
620 real qqA, real c6A, real c12A, real qqB, real c6B, real c12B,
621 real LFC[2], real LFV[2], real DLF[2],
622 real lfac_coul[2], real lfac_vdw[2], real dlfac_coul[2], real dlfac_vdw[2],
623 real sigma6_def, real sigma6_min, real sigma2_def, real sigma2_min,
624 real *velectot, real *vvdwtot, real *dvdl)
626 real r, rp, rpm2, rtab, eps, eps2, Y, F, Geps, Heps2, Fp, VV, FF, fscal;
627 real qq[2], c6[2], c12[2], sigma6[2], sigma2[2], sigma_pow[2], sigma_powm2[2];
628 real alpha_coul_eff, alpha_vdw_eff, dvdl_coul, dvdl_vdw;
629 real rpinv, r_coul, r_vdw, velecsum, vvdwsum;
630 real fscal_vdw[2], fscal_elec[2];
631 real velec[2], vvdw[2];
641 if (sc_r_power == 6.0)
643 rpm2 = r2*r2; /* r4 */
644 rp = rpm2*r2; /* r6 */
646 else if (sc_r_power == 48.0)
648 rp = r2*r2*r2; /* r6 */
649 rp = rp*rp; /* r12 */
650 rp = rp*rp; /* r24 */
651 rp = rp*rp; /* r48 */
652 rpm2 = rp/r2; /* r46 */
656 rp = pow(r2, 0.5*sc_r_power); /* not currently supported as input, but can handle it */
660 /* Loop over state A(0) and B(1) */
661 for (i = 0; i < 2; i++)
663 if ((c6[i] > 0) && (c12[i] > 0))
665 /* The c6 & c12 coefficients now contain the constants 6.0 and 12.0, respectively.
666 * Correct for this by multiplying with (1/12.0)/(1/6.0)=6.0/12.0=0.5.
668 sigma6[i] = 0.5*c12[i]/c6[i];
669 sigma2[i] = pow(0.5*c12[i]/c6[i], 1.0/3.0);
670 /* should be able to get rid of this ^^^ internal pow call eventually. Will require agreement on
671 what data to store externally. Can't be fixed without larger scale changes, so not 4.6 */
672 if (sigma6[i] < sigma6_min) /* for disappearing coul and vdw with soft core at the same time */
674 sigma6[i] = sigma6_min;
675 sigma2[i] = sigma2_min;
680 sigma6[i] = sigma6_def;
681 sigma2[i] = sigma2_def;
683 if (sc_r_power == 6.0)
685 sigma_pow[i] = sigma6[i];
686 sigma_powm2[i] = sigma6[i]/sigma2[i];
688 else if (sc_r_power == 48.0)
690 sigma_pow[i] = sigma6[i]*sigma6[i]; /* sigma^12 */
691 sigma_pow[i] = sigma_pow[i]*sigma_pow[i]; /* sigma^24 */
692 sigma_pow[i] = sigma_pow[i]*sigma_pow[i]; /* sigma^48 */
693 sigma_powm2[i] = sigma_pow[i]/sigma2[i];
696 { /* not really supported as input, but in here for testing the general case*/
697 sigma_pow[i] = pow(sigma2[i], sc_r_power/2);
698 sigma_powm2[i] = sigma_pow[i]/(sigma2[i]);
702 /* only use softcore if one of the states has a zero endstate - softcore is for avoiding infinities!*/
703 if ((c12[0] > 0) && (c12[1] > 0))
710 alpha_vdw_eff = alpha_vdw;
711 alpha_coul_eff = alpha_coul;
714 /* Loop over A and B states again */
715 for (i = 0; i < 2; i++)
722 /* Only spend time on A or B state if it is non-zero */
723 if ( (qq[i] != 0) || (c6[i] != 0) || (c12[i] != 0) )
726 rpinv = 1.0/(alpha_coul_eff*lfac_coul[i]*sigma_pow[i]+rp);
727 r_coul = pow(rpinv, -1.0/sc_r_power);
729 /* Electrostatics table lookup data */
730 rtab = r_coul*tabscale;
738 Geps = eps*vftab[ntab+2];
739 Heps2 = eps2*vftab[ntab+3];
742 FF = Fp+Geps+2.0*Heps2;
744 fscal_elec[i] = -qq[i]*FF*r_coul*rpinv*tabscale;
747 rpinv = 1.0/(alpha_vdw_eff*lfac_vdw[i]*sigma_pow[i]+rp);
748 r_vdw = pow(rpinv, -1.0/sc_r_power);
749 /* Vdw table lookup data */
750 rtab = r_vdw*tabscale;
758 Geps = eps*vftab[ntab+6];
759 Heps2 = eps2*vftab[ntab+7];
762 FF = Fp+Geps+2.0*Heps2;
764 fscal_vdw[i] = -c6[i]*FF;
769 Geps = eps*vftab[ntab+10];
770 Heps2 = eps2*vftab[ntab+11];
773 FF = Fp+Geps+2.0*Heps2;
774 vvdw[i] += c12[i]*VV;
775 fscal_vdw[i] -= c12[i]*FF;
776 fscal_vdw[i] *= r_vdw*rpinv*tabscale;
779 /* Now we have velec[i], vvdw[i], and fscal[i] for both states */
780 /* Assemble A and B states */
786 for (i = 0; i < 2; i++)
788 velecsum += LFC[i]*velec[i];
789 vvdwsum += LFV[i]*vvdw[i];
791 fscal += (LFC[i]*fscal_elec[i]+LFV[i]*fscal_vdw[i])*rpm2;
793 dvdl_coul += velec[i]*DLF[i] + LFC[i]*alpha_coul_eff*dlfac_coul[i]*fscal_elec[i]*sigma_pow[i];
794 dvdl_vdw += vvdw[i]*DLF[i] + LFV[i]*alpha_vdw_eff*dlfac_vdw[i]*fscal_vdw[i]*sigma_pow[i];
797 dvdl[efptCOUL] += dvdl_coul;
798 dvdl[efptVDW] += dvdl_vdw;
800 *velectot = velecsum;