1 /* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
11 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
12 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
13 * Copyright (c) 2001-2004, The GROMACS development team,
14 * check out http://www.gromacs.org for more information.
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * If you want to redistribute modifications, please consider that
22 * scientific software is very special. Version control is crucial -
23 * bugs must be traceable. We will be happy to consider code for
24 * inclusion in the official distribution, but derived work must not
25 * be called official GROMACS. Details are found in the README & COPYING
26 * files - if they are missing, get the official version at www.gromacs.org.
28 * To help us fund GROMACS development, we humbly ask that you cite
29 * the papers on the package - you can find them in the top README file.
31 * For more info, check our website at http://www.gromacs.org
34 * GROwing Monsters And Cloning Shrimps
50 #include "nonbonded.h"
65 #include "mpelogging.h"
66 #include "gmx_omp_nthreads.h"
80 gmx_grppairener_t *grppener,
82 gmx_bool bDoLongRange,
89 GMX_MPE_LOG(ev_ns_start);
90 if (!fr->ns.nblist_initialized)
92 init_neighbor_list(fp, fr, md->homenr);
98 nsearch = search_neighbours(fp,fr,x,box,top,groups,cr,nrnb,md,
99 lambda,dvdlambda,grppener,
100 bFillGrid,bDoLongRange,
103 fprintf(debug,"nsearch = %d\n",nsearch);
105 /* Check whether we have to do dynamic load balancing */
106 /*if ((nsb->nstDlb > 0) && (mod(step,nsb->nstDlb) == 0))
107 count_nb(cr,nsb,&(top->blocks[ebCGS]),nns,fr->nlr,
108 &(top->idef),opts->ngener);
110 if (fr->ns.dump_nl > 0)
111 dump_nblist(fp,cr,fr,fr->ns.dump_nl);
113 GMX_MPE_LOG(ev_ns_finish);
116 static void reduce_thread_forces(int n,rvec *f,
119 int efpt_ind,real *dvdl,
120 int nthreads,f_thread_t *f_t)
124 /* This reduction can run over any number of threads */
125 #pragma omp parallel for num_threads(gmx_omp_nthreads_get(emntBonded)) private(t) schedule(static)
128 for(t=1; t<nthreads; t++)
130 rvec_inc(f[i],f_t[t].f[i]);
133 for(t=1; t<nthreads; t++)
135 *Vcorr += f_t[t].Vcorr;
136 *dvdl += f_t[t].dvdl[efpt_ind];
137 m_add(vir,f_t[t].vir,vir);
141 void do_force_lowlevel(FILE *fplog, gmx_large_int_t step,
142 t_forcerec *fr, t_inputrec *ir,
143 t_idef *idef, t_commrec *cr,
144 t_nrnb *nrnb, gmx_wallcycle_t wcycle,
147 rvec x[], history_t *hist,
149 gmx_enerdata_t *enerd,
167 gmx_bool bDoEpot,bSepDVDL,bSB;
171 real Vsr,Vlr,Vcorr=0;
175 gmx_enerdata_t ed_lam;
176 double clam_i,vlam_i;
177 real dvdl_dum[efptNR], dvdl, dvdl_nb[efptNR], lam_i[efptNR];
181 double t0=0.0,t1,t2,t3; /* time measurement for coarse load balancing */
184 #define PRINT_SEPDVDL(s,v,dvdlambda) if (bSepDVDL) fprintf(fplog,sepdvdlformat,s,v,dvdlambda);
186 GMX_MPE_LOG(ev_force_start);
187 set_pbc(&pbc,fr->ePBC,box);
189 /* reset free energy components */
190 for (i=0;i<efptNR;i++)
197 for(i=0; (i<DIM); i++)
199 box_size[i]=box[i][i];
202 bSepDVDL=(fr->bSepDVDL && do_per_step(step,ir->nstlog));
205 /* do QMMM first if requested */
208 enerd->term[F_EQM] = calculate_QMMM(cr,x,f,fr,md);
213 fprintf(fplog,"Step %s: non-bonded V and dVdl for node %d:\n",
214 gmx_step_str(step,buf),cr->nodeid);
217 /* Call the short range functions all in one go. */
218 GMX_MPE_LOG(ev_do_fnbf_start);
221 /*#define TAKETIME ((cr->npmenodes) && (fr->timesteps < 12))*/
222 #define TAKETIME FALSE
225 MPI_Barrier(cr->mpi_comm_mygroup);
232 /* foreign lambda component for walls */
233 dvdl = do_walls(ir,fr,box,md,x,f,lambda[efptVDW],
234 enerd->grpp.ener[egLJSR],nrnb);
235 PRINT_SEPDVDL("Walls",0.0,dvdl);
236 enerd->dvdl_lin[efptVDW] += dvdl;
239 /* If doing GB, reset dvda and calculate the Born radii */
240 if (ir->implicit_solvent)
242 wallcycle_sub_start(wcycle, ewcsNONBONDED);
244 for(i=0;i<born->nr;i++)
251 calc_gb_rad(cr,fr,ir,top,atype,x,&(fr->gblist),born,md,nrnb);
254 wallcycle_sub_stop(wcycle, ewcsNONBONDED);
258 if (flags & GMX_FORCE_NONBONDED)
261 if (flags & GMX_FORCE_FORCES)
263 donb_flags |= GMX_DONB_FORCES;
266 wallcycle_sub_start(wcycle, ewcsNONBONDED);
267 do_nonbonded(cr,fr,x,f,md,excl,
269 enerd->grpp.ener[egBHAMSR] :
270 enerd->grpp.ener[egLJSR],
271 enerd->grpp.ener[egCOULSR],
272 enerd->grpp.ener[egGB],box_size,nrnb,
273 lambda,dvdl_nb,-1,-1,donb_flags);
274 wallcycle_sub_stop(wcycle, ewcsNONBONDED);
277 /* If we do foreign lambda and we have soft-core interactions
278 * we have to recalculate the (non-linear) energies contributions.
280 if (fepvals->n_lambda > 0 && (flags & GMX_FORCE_DHDL) && fepvals->sc_alpha != 0)
282 wallcycle_sub_start(wcycle, ewcsNONBONDED);
283 init_enerdata(mtop->groups.grps[egcENER].nr,fepvals->n_lambda,&ed_lam);
285 for(i=0; i<enerd->n_lambda; i++)
287 for (j=0;j<efptNR;j++)
289 lam_i[j] = (i==0 ? lambda[j] : fepvals->all_lambda[j][i-1]);
291 reset_enerdata(&ir->opts,fr,TRUE,&ed_lam,FALSE);
292 do_nonbonded(cr,fr,x,f,md,excl,
294 ed_lam.grpp.ener[egBHAMSR] :
295 ed_lam.grpp.ener[egLJSR],
296 ed_lam.grpp.ener[egCOULSR],
297 enerd->grpp.ener[egGB], box_size,nrnb,
298 lam_i,dvdl_dum,-1,-1,
299 GMX_DONB_FOREIGNLAMBDA);
300 sum_epot(&ir->opts,&ed_lam);
301 enerd->enerpart_lambda[i] += ed_lam.term[F_EPOT];
303 destroy_enerdata(&ed_lam);
304 wallcycle_sub_stop(wcycle, ewcsNONBONDED);
308 /* If we are doing GB, calculate bonded forces and apply corrections
309 * to the solvation forces */
310 /* MRS: Eventually, many need to include free energy contribution here! */
311 if (ir->implicit_solvent)
313 calc_gb_forces(cr,md,born,top,atype,x,f,fr,idef,
314 ir->gb_algorithm,ir->sa_algorithm,nrnb,bBornRadii,&pbc,graph,enerd);
315 wallcycle_sub_stop(wcycle, ewcsBONDED);
326 if (fepvals->sc_alpha!=0)
328 enerd->dvdl_nonlin[efptVDW] += dvdl_nb[efptVDW];
332 enerd->dvdl_lin[efptVDW] += dvdl_nb[efptVDW];
335 if (fepvals->sc_alpha!=0)
337 /* even though coulomb part is linear, we already added it, beacuse we
338 need to go through the vdw calculation anyway */
340 enerd->dvdl_nonlin[efptCOUL] += dvdl_nb[efptCOUL];
344 enerd->dvdl_lin[efptCOUL] += dvdl_nb[efptCOUL];
350 for(i=0; i<enerd->grpp.nener; i++)
354 enerd->grpp.ener[egBHAMSR][i] :
355 enerd->grpp.ener[egLJSR][i])
356 + enerd->grpp.ener[egCOULSR][i] + enerd->grpp.ener[egGB][i];
358 dvdlsum = dvdl_nb[efptVDW] + dvdl_nb[efptCOUL];
359 PRINT_SEPDVDL("VdW and Coulomb SR particle-p.",Vsr,dvdlsum);
363 GMX_MPE_LOG(ev_do_fnbf_finish);
367 pr_rvecs(debug,0,"fshift after SR",fr->fshift,SHIFTS);
370 /* Shift the coordinates. Must be done before bonded forces and PPPM,
371 * but is also necessary for SHAKE and update, therefore it can NOT
372 * go when no bonded forces have to be evaluated.
375 /* Here sometimes we would not need to shift with NBFonly,
376 * but we do so anyhow for consistency of the returned coordinates.
380 shift_self(graph,box,x);
383 inc_nrnb(nrnb,eNR_SHIFTX,2*graph->nnodes);
387 inc_nrnb(nrnb,eNR_SHIFTX,graph->nnodes);
390 /* Check whether we need to do bondeds or correct for exclusions */
392 ((flags & GMX_FORCE_BONDED)
393 || EEL_RF(fr->eeltype) || EEL_FULL(fr->eeltype)))
395 /* Since all atoms are in the rectangular or triclinic unit-cell,
396 * only single box vector shifts (2 in x) are required.
398 set_pbc_dd(&pbc,fr->ePBC,cr->dd,TRUE,box);
402 if (flags & GMX_FORCE_BONDED)
404 GMX_MPE_LOG(ev_calc_bonds_start);
406 wallcycle_sub_start(wcycle, ewcsBONDED);
407 calc_bonds(fplog,cr->ms,
408 idef,x,hist,f,fr,&pbc,graph,enerd,nrnb,lambda,md,fcd,
409 DOMAINDECOMP(cr) ? cr->dd->gatindex : NULL, atype, born,
411 fr->bSepDVDL && do_per_step(step,ir->nstlog),step);
413 /* Check if we have to determine energy differences
414 * at foreign lambda's.
416 if (fepvals->n_lambda > 0 && (flags & GMX_FORCE_DHDL) &&
417 idef->ilsort != ilsortNO_FE)
419 if (idef->ilsort != ilsortFE_SORTED)
421 gmx_incons("The bonded interactions are not sorted for free energy");
423 init_enerdata(mtop->groups.grps[egcENER].nr,fepvals->n_lambda,&ed_lam);
425 for(i=0; i<enerd->n_lambda; i++)
427 reset_enerdata(&ir->opts,fr,TRUE,&ed_lam,FALSE);
428 for (j=0;j<efptNR;j++)
430 lam_i[j] = (i==0 ? lambda[j] : fepvals->all_lambda[j][i-1]);
432 calc_bonds_lambda(fplog,idef,x,fr,&pbc,graph,&ed_lam,nrnb,lam_i,md,
433 fcd,DOMAINDECOMP(cr) ? cr->dd->gatindex : NULL);
434 sum_epot(&ir->opts,&ed_lam);
435 enerd->enerpart_lambda[i] += ed_lam.term[F_EPOT];
437 destroy_enerdata(&ed_lam);
440 GMX_MPE_LOG(ev_calc_bonds_finish);
441 wallcycle_sub_stop(wcycle, ewcsBONDED);
447 if (EEL_FULL(fr->eeltype))
449 bSB = (ir->nwall == 2);
453 svmul(ir->wall_ewald_zfac,boxs[ZZ],boxs[ZZ]);
454 box_size[ZZ] *= ir->wall_ewald_zfac;
457 clear_mat(fr->vir_el_recip);
464 /* With the Verlet scheme exclusion forces are calculated
465 * in the non-bonded kernel.
467 /* The TPI molecule does not have exclusions with the rest
468 * of the system and no intra-molecular PME grid contributions
469 * will be calculated in gmx_pme_calc_energy.
471 if ((ir->cutoff_scheme == ecutsGROUP && fr->n_tpi == 0) ||
472 ir->ewald_geometry != eewg3D ||
473 ir->epsilon_surface != 0)
477 wallcycle_sub_start(wcycle, ewcsEWALD_CORRECTION);
481 gmx_fatal(FARGS,"TPI with PME currently only works in a 3D geometry with tin-foil boundary conditions");
484 nthreads = gmx_omp_nthreads_get(emntBonded);
485 #pragma omp parallel for num_threads(nthreads) schedule(static)
486 for(t=0; t<nthreads; t++)
494 fnv = fr->f_novirsum;
495 vir = &fr->vir_el_recip;
502 vir = &fr->f_t[t].vir;
503 Vcorrt = &fr->f_t[t].Vcorr;
504 dvdlt = &fr->f_t[t].dvdl[efptCOUL];
505 for(i=0; i<fr->natoms_force; i++)
513 ewald_LRcorrection(fplog,
514 fr->excl_load[t],fr->excl_load[t+1],
517 md->nChargePerturbed ? md->chargeB : NULL,
518 ir->cutoff_scheme != ecutsVERLET,
519 excl,x,bSB ? boxs : box,mu_tot,
523 lambda[efptCOUL],dvdlt);
527 reduce_thread_forces(fr->natoms_force,fr->f_novirsum,
529 &Vcorr,efptCOUL,&dvdl,
533 wallcycle_sub_stop(wcycle, ewcsEWALD_CORRECTION);
538 Vcorr += ewald_charge_correction(cr,fr,lambda[efptCOUL],box,
539 &dvdl,fr->vir_el_recip);
542 PRINT_SEPDVDL("Ewald excl./charge/dip. corr.",Vcorr,dvdl);
543 enerd->dvdl_lin[efptCOUL] += dvdl;
553 case eelPMEUSERSWITCH:
555 if (cr->duty & DUTY_PME)
557 assert(fr->n_tpi >= 0);
558 if (fr->n_tpi == 0 || (flags & GMX_FORCE_STATECHANGED))
560 pme_flags = GMX_PME_SPREAD_Q | GMX_PME_SOLVE;
561 if (flags & GMX_FORCE_FORCES)
563 pme_flags |= GMX_PME_CALC_F;
565 if (flags & (GMX_FORCE_VIRIAL | GMX_FORCE_ENERGY))
567 pme_flags |= GMX_PME_CALC_ENER_VIR;
571 /* We don't calculate f, but we do want the potential */
572 pme_flags |= GMX_PME_CALC_POT;
574 wallcycle_start(wcycle,ewcPMEMESH);
575 status = gmx_pme_do(fr->pmedata,
576 md->start,md->homenr - fr->n_tpi,
578 md->chargeA,md->chargeB,
580 DOMAINDECOMP(cr) ? dd_pme_maxshift_x(cr->dd) : 0,
581 DOMAINDECOMP(cr) ? dd_pme_maxshift_y(cr->dd) : 0,
583 fr->vir_el_recip,fr->ewaldcoeff,
584 &Vlr,lambda[efptCOUL],&dvdl,
586 *cycles_pme = wallcycle_stop(wcycle,ewcPMEMESH);
588 /* We should try to do as little computation after
589 * this as possible, because parallel PME synchronizes
590 * the nodes, so we want all load imbalance of the rest
591 * of the force calculation to be before the PME call.
592 * DD load balancing is done on the whole time of
593 * the force call (without PME).
598 /* Determine the PME grid energy of the test molecule
599 * with the PME grid potential of the other charges.
601 gmx_pme_calc_energy(fr->pmedata,fr->n_tpi,
602 x + md->homenr - fr->n_tpi,
603 md->chargeA + md->homenr - fr->n_tpi,
606 PRINT_SEPDVDL("PME mesh",Vlr,dvdl);
610 /* Energies and virial are obtained later from the PME nodes */
611 /* but values have to be zeroed out here */
616 Vlr = do_ewald(fplog,FALSE,ir,x,fr->f_novirsum,
617 md->chargeA,md->chargeB,
618 box_size,cr,md->homenr,
619 fr->vir_el_recip,fr->ewaldcoeff,
620 lambda[efptCOUL],&dvdl,fr->ewald_table);
621 PRINT_SEPDVDL("Ewald long-range",Vlr,dvdl);
625 gmx_fatal(FARGS,"No such electrostatics method implemented %s",
626 eel_names[fr->eeltype]);
630 gmx_fatal(FARGS,"Error %d in long range electrostatics routine %s",
631 status,EELTYPE(fr->eeltype));
633 enerd->dvdl_lin[efptCOUL] += dvdl;
634 enerd->term[F_COUL_RECIP] = Vlr + Vcorr;
637 fprintf(debug,"Vlr = %g, Vcorr = %g, Vlr_corr = %g\n",
638 Vlr,Vcorr,enerd->term[F_COUL_RECIP]);
639 pr_rvecs(debug,0,"vir_el_recip after corr",fr->vir_el_recip,DIM);
640 pr_rvecs(debug,0,"fshift after LR Corrections",fr->fshift,SHIFTS);
645 if (EEL_RF(fr->eeltype))
647 /* With the Verlet scheme exclusion forces are calculated
648 * in the non-bonded kernel.
650 if (ir->cutoff_scheme != ecutsVERLET && fr->eeltype != eelRF_NEC)
653 enerd->term[F_RF_EXCL] =
654 RF_excl_correction(fplog,fr,graph,md,excl,x,f,
655 fr->fshift,&pbc,lambda[efptCOUL],&dvdl);
658 enerd->dvdl_lin[efptCOUL] += dvdl;
659 PRINT_SEPDVDL("RF exclusion correction",
660 enerd->term[F_RF_EXCL],dvdl);
668 print_nrnb(debug,nrnb);
676 MPI_Barrier(cr->mpi_comm_mygroup);
679 if (fr->timesteps == 11)
681 fprintf(stderr,"* PP load balancing info: node %d, step %s, rel wait time=%3.0f%% , load string value: %7.2f\n",
682 cr->nodeid, gmx_step_str(fr->timesteps,buf),
683 100*fr->t_wait/(fr->t_wait+fr->t_fnbf),
684 (fr->t_fnbf+fr->t_wait)/fr->t_fnbf);
692 pr_rvecs(debug,0,"fshift after bondeds",fr->fshift,SHIFTS);
695 GMX_MPE_LOG(ev_force_finish);
699 void init_enerdata(int ngener,int n_lambda,gmx_enerdata_t *enerd)
703 for(i=0; i<F_NRE; i++)
709 for(i=0; i<efptNR; i++) {
710 enerd->dvdl_lin[i] = 0;
711 enerd->dvdl_nonlin[i] = 0;
717 fprintf(debug,"Creating %d sized group matrix for energies\n",n2);
719 enerd->grpp.nener = n2;
720 for(i=0; (i<egNR); i++)
722 snew(enerd->grpp.ener[i],n2);
727 enerd->n_lambda = 1 + n_lambda;
728 snew(enerd->enerpart_lambda,enerd->n_lambda);
736 void destroy_enerdata(gmx_enerdata_t *enerd)
740 for(i=0; (i<egNR); i++)
742 sfree(enerd->grpp.ener[i]);
747 sfree(enerd->enerpart_lambda);
751 static real sum_v(int n,real v[])
763 void sum_epot(t_grpopts *opts,gmx_enerdata_t *enerd)
765 gmx_grppairener_t *grpp;
772 /* Accumulate energies */
773 epot[F_COUL_SR] = sum_v(grpp->nener,grpp->ener[egCOULSR]);
774 epot[F_LJ] = sum_v(grpp->nener,grpp->ener[egLJSR]);
775 epot[F_LJ14] = sum_v(grpp->nener,grpp->ener[egLJ14]);
776 epot[F_COUL14] = sum_v(grpp->nener,grpp->ener[egCOUL14]);
777 epot[F_COUL_LR] = sum_v(grpp->nener,grpp->ener[egCOULLR]);
778 epot[F_LJ_LR] = sum_v(grpp->nener,grpp->ener[egLJLR]);
779 /* We have already added 1-2,1-3, and 1-4 terms to F_GBPOL */
780 epot[F_GBPOL] += sum_v(grpp->nener,grpp->ener[egGB]);
782 /* lattice part of LR doesnt belong to any group
783 * and has been added earlier
785 epot[F_BHAM] = sum_v(grpp->nener,grpp->ener[egBHAMSR]);
786 epot[F_BHAM_LR] = sum_v(grpp->nener,grpp->ener[egBHAMLR]);
789 for(i=0; (i<F_EPOT); i++)
791 if (i != F_DISRESVIOL && i != F_ORIRESDEV)
793 epot[F_EPOT] += epot[i];
798 void sum_dhdl(gmx_enerdata_t *enerd, real *lambda, t_lambda *fepvals)
803 enerd->dvdl_lin[efptVDW] += enerd->term[F_DVDL_VDW]; /* include dispersion correction */
804 enerd->term[F_DVDL] = 0.0;
805 for (i=0;i<efptNR;i++)
807 if (fepvals->separate_dvdl[i])
809 /* could this be done more readably/compactly? */
818 index = F_DVDL_BONDED;
820 case (efptRESTRAINT):
821 index = F_DVDL_RESTRAINT;
830 enerd->term[index] = enerd->dvdl_lin[i] + enerd->dvdl_nonlin[i];
833 fprintf(debug,"dvdl-%s[%2d]: %f: non-linear %f + linear %f\n",
834 efpt_names[i],i,enerd->term[index],enerd->dvdl_nonlin[i],enerd->dvdl_lin[i]);
839 enerd->term[F_DVDL] += enerd->dvdl_lin[i] + enerd->dvdl_nonlin[i];
842 fprintf(debug,"dvd-%sl[%2d]: %f: non-linear %f + linear %f\n",
843 efpt_names[0],i,enerd->term[F_DVDL],enerd->dvdl_nonlin[i],enerd->dvdl_lin[i]);
848 /* Notes on the foreign lambda free energy difference evaluation:
849 * Adding the potential and ekin terms that depend linearly on lambda
850 * as delta lam * dvdl to the energy differences is exact.
851 * For the constraints this is not exact, but we have no other option
852 * without literally changing the lengths and reevaluating the energies at each step.
853 * (try to remedy this post 4.6 - MRS)
854 * For the non-bonded LR term we assume that the soft-core (if present)
855 * no longer affects the energy beyond the short-range cut-off,
856 * which is a very good approximation (except for exotic settings).
857 * (investigate how to overcome this post 4.6 - MRS)
860 for(i=0; i<fepvals->n_lambda; i++)
861 { /* note we are iterating over fepvals here!
862 For the current lam, dlam = 0 automatically,
863 so we don't need to add anything to the
864 enerd->enerpart_lambda[0] */
866 /* we don't need to worry about dvdl contributions to the current lambda, because
867 it's automatically zero */
869 /* first kinetic energy term */
870 dlam = (fepvals->all_lambda[efptMASS][i] - lambda[efptMASS]);
872 enerd->enerpart_lambda[i+1] += enerd->term[F_DKDL]*dlam;
874 for (j=0;j<efptNR;j++)
876 if (j==efptMASS) {continue;} /* no other mass term to worry about */
878 dlam = (fepvals->all_lambda[j][i]-lambda[j]);
879 enerd->enerpart_lambda[i+1] += dlam*enerd->dvdl_lin[j];
882 fprintf(debug,"enerdiff lam %g: (%15s), non-linear %f linear %f*%f\n",
883 fepvals->all_lambda[j][i],efpt_names[j],
884 (enerd->enerpart_lambda[i+1] - enerd->enerpart_lambda[0]),
885 dlam,enerd->dvdl_lin[j]);
891 void reset_enerdata(t_grpopts *opts,
892 t_forcerec *fr,gmx_bool bNS,
893 gmx_enerdata_t *enerd,
899 /* First reset all energy components, except for the long range terms
900 * on the master at non neighbor search steps, since the long range
901 * terms have already been summed at the last neighbor search step.
903 bKeepLR = (fr->bTwinRange && !bNS);
904 for(i=0; (i<egNR); i++) {
905 if (!(bKeepLR && bMaster && (i == egCOULLR || i == egLJLR))) {
906 for(j=0; (j<enerd->grpp.nener); j++)
907 enerd->grpp.ener[i][j] = 0.0;
910 for (i=0;i<efptNR;i++)
912 enerd->dvdl_lin[i] = 0.0;
913 enerd->dvdl_nonlin[i] = 0.0;
916 /* Normal potential energy components */
917 for(i=0; (i<=F_EPOT); i++) {
918 enerd->term[i] = 0.0;
920 /* Initialize the dVdlambda term with the long range contribution */
921 /* Initialize the dvdl term with the long range contribution */
922 enerd->term[F_DVDL] = 0.0;
923 enerd->term[F_DVDL_COUL] = 0.0;
924 enerd->term[F_DVDL_VDW] = 0.0;
925 enerd->term[F_DVDL_BONDED] = 0.0;
926 enerd->term[F_DVDL_RESTRAINT] = 0.0;
927 enerd->term[F_DKDL] = 0.0;
928 if (enerd->n_lambda > 0)
930 for(i=0; i<enerd->n_lambda; i++)
932 enerd->enerpart_lambda[i] = 0.0;