int gmx_lie(int argc,char *argv[]) { const char *desc[] = { "g_lie computes a free energy estimate based on an energy analysis", "from. One needs an energy file with the following components:", "Coul (A-B) LJ-SR (A-B) etc." }; static real lie_lj=0,lie_qq=0,fac_lj=0.181,fac_qq=0.5; static const char *ligand="none"; t_pargs pa[] = { { "-Elj", FALSE, etREAL, {&lie_lj}, "Lennard-Jones interaction between ligand and solvent" }, { "-Eqq", FALSE, etREAL, {&lie_qq}, "Coulomb interaction between ligand and solvent" }, { "-Clj", FALSE, etREAL, {&fac_lj}, "Factor in the LIE equation for Lennard-Jones component of energy" }, { "-Cqq", FALSE, etREAL, {&fac_qq}, "Factor in the LIE equation for Coulomb component of energy" }, { "-ligand", FALSE, etSTR, {&ligand}, "Name of the ligand in the energy file" } }; #define NPA asize(pa) FILE *out; int nre,nframes=0,ct=0; ener_file_t fp; gmx_bool bCont; t_liedata *ld; gmx_enxnm_t *enm=NULL; t_enxframe *fr; real lie; double lieaver=0,lieav2=0; output_env_t oenv; t_filenm fnm[] = { { efEDR, "-f", "ener", ffREAD }, { efXVG, "-o", "lie", ffWRITE } }; #define NFILE asize(fnm) CopyRight(stderr,argv[0]); parse_common_args(&argc,argv,PCA_CAN_VIEW | PCA_CAN_TIME | PCA_BE_NICE, NFILE,fnm,NPA,pa,asize(desc),desc,0,NULL,&oenv); fp = open_enx(ftp2fn(efEDR,NFILE,fnm),"r"); do_enxnms(fp,&nre,&enm); ld = analyze_names(nre,enm,ligand); snew(fr,1); out = xvgropen(ftp2fn(efXVG,NFILE,fnm),"LIE free energy estimate", "Time (ps)","DGbind (kJ/mol)",oenv); do { bCont = do_enx(fp,fr); ct = check_times(fr->t); if (ct == 0) { lie = calc_lie(ld,fr->ener,lie_lj,lie_qq,fac_lj,fac_qq); lieaver += lie; lieav2 += lie*lie; nframes ++; fprintf(out,"%10g %10g\n",fr->t,lie); } } while (bCont); close_enx(fp); ffclose(out); fprintf(stderr,"\n"); if (nframes > 0) printf("DGbind = %.3f (%.3f)\n",lieaver/nframes, sqrt(lieav2/nframes-sqr(lieaver/nframes))); do_view(oenv,ftp2fn(efXVG,NFILE,fnm),"-nxy"); thanx(stderr); return 0; }
int gmx_lie(int argc, char *argv[]) { const char *desc[] = { "[THISMODULE] computes a free energy estimate based on an energy analysis", "from nonbonded energies. One needs an energy file with the following components:", "Coul-(A-B) LJ-SR (A-B) etc.[PAR]", "To utilize [TT]g_lie[tt] correctly, two simulations are required: one with the", "molecule of interest bound to its receptor and one with the molecule in water.", "Both need to utilize [TT]energygrps[tt] such that Coul-SR(A-B), LJ-SR(A-B), etc. terms", "are written to the [REF].edr[ref] file. Values from the molecule-in-water simulation", "are necessary for supplying suitable values for -Elj and -Eqq." }; static real lie_lj = 0, lie_qq = 0, fac_lj = 0.181, fac_qq = 0.5; static const char *ligand = "none"; t_pargs pa[] = { { "-Elj", FALSE, etREAL, {&lie_lj}, "Lennard-Jones interaction between ligand and solvent" }, { "-Eqq", FALSE, etREAL, {&lie_qq}, "Coulomb interaction between ligand and solvent" }, { "-Clj", FALSE, etREAL, {&fac_lj}, "Factor in the LIE equation for Lennard-Jones component of energy" }, { "-Cqq", FALSE, etREAL, {&fac_qq}, "Factor in the LIE equation for Coulomb component of energy" }, { "-ligand", FALSE, etSTR, {&ligand}, "Name of the ligand in the energy file" } }; #define NPA asize(pa) FILE *out; int nre, nframes = 0, ct = 0; ener_file_t fp; t_liedata *ld; gmx_enxnm_t *enm = NULL; t_enxframe *fr; real lie; double lieaver = 0, lieav2 = 0; gmx_output_env_t *oenv; t_filenm fnm[] = { { efEDR, "-f", "ener", ffREAD }, { efXVG, "-o", "lie", ffWRITE } }; #define NFILE asize(fnm) if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME, NFILE, fnm, NPA, pa, asize(desc), desc, 0, NULL, &oenv)) { return 0; } fp = open_enx(ftp2fn(efEDR, NFILE, fnm), "r"); do_enxnms(fp, &nre, &enm); ld = analyze_names(nre, enm, ligand); snew(fr, 1); out = xvgropen(ftp2fn(efXVG, NFILE, fnm), "LIE free energy estimate", "Time (ps)", "DGbind (kJ/mol)", oenv); while (do_enx(fp, fr)) { ct = check_times(fr->t); if (ct == 0) { lie = calc_lie(ld, fr->ener, lie_lj, lie_qq, fac_lj, fac_qq); lieaver += lie; lieav2 += lie*lie; nframes++; fprintf(out, "%10g %10g\n", fr->t, lie); } } close_enx(fp); xvgrclose(out); fprintf(stderr, "\n"); if (nframes > 0) { printf("DGbind = %.3f (%.3f)\n", lieaver/nframes, std::sqrt(lieav2/nframes-sqr(lieaver/nframes))); } do_view(oenv, ftp2fn(efXVG, NFILE, fnm), "-nxy"); return 0; }