From cd03ec72a1461fdf5bca9f3ef3522176a5646944 Mon Sep 17 00:00:00 2001 From: Rossen Apostolov Date: Wed, 12 Feb 2014 14:14:42 +0100 Subject: [PATCH] Rename ffopen and ffclose to gmx_ff*. There are name clashes with e.g. PathScale compiler. Fixes #1250. Change-Id: I3e5e85d9335f2695515483d59d440276823624f0 --- cmake/legacy_and_external.supp | 4 +- src/contrib/do_multiprot.c | 20 ++++----- src/contrib/do_shift.c | 10 ++--- src/contrib/ehanal.c | 16 +++---- src/contrib/ehdata.c | 8 ++-- src/contrib/ehole.c | 4 +- src/contrib/gen_table.c | 16 +++---- src/contrib/gmx_sdf.c | 8 ++-- src/contrib/hexamer.c | 4 +- src/contrib/hrefify.c | 4 +- src/contrib/mkice.c | 4 +- src/contrib/pmetest.c | 2 +- src/contrib/test.c | 2 +- src/gromacs/essentialdynamics/edsam.c | 6 +-- src/gromacs/fileio/filenm.h | 4 +- src/gromacs/fileio/futil.cpp | 8 ++-- src/gromacs/fileio/futil.h | 12 +++--- src/gromacs/fileio/gmxfio.c | 8 ++-- src/gromacs/fileio/strdb.c | 10 ++--- src/gromacs/gmxana/anadih.c | 12 +++--- src/gromacs/gmxana/autocorr.c | 10 ++--- src/gromacs/gmxana/cmat.c | 4 +- src/gromacs/gmxana/gmx_anadock.c | 10 ++--- src/gromacs/gmxana/gmx_anaeig.c | 18 ++++---- src/gromacs/gmxana/gmx_analyze.c | 16 +++---- src/gromacs/gmxana/gmx_angle.c | 8 ++-- src/gromacs/gmxana/gmx_bar.c | 2 +- src/gromacs/gmxana/gmx_bundle.c | 20 ++++----- src/gromacs/gmxana/gmx_chi.c | 36 ++++++++-------- src/gromacs/gmxana/gmx_cluster.c | 16 +++---- src/gromacs/gmxana/gmx_clustsize.c | 24 +++++------ src/gromacs/gmxana/gmx_confrms.c | 12 +++--- src/gromacs/gmxana/gmx_covar.c | 20 ++++----- src/gromacs/gmxana/gmx_current.c | 10 ++--- src/gromacs/gmxana/gmx_density.c | 8 ++-- src/gromacs/gmxana/gmx_densmap.c | 10 ++--- src/gromacs/gmxana/gmx_densorder.cpp | 20 ++++----- src/gromacs/gmxana/gmx_dielectric.c | 6 +-- src/gromacs/gmxana/gmx_dipoles.cpp | 28 ++++++------- src/gromacs/gmxana/gmx_disre.c | 16 +++---- src/gromacs/gmxana/gmx_do_dssp.c | 22 +++++----- src/gromacs/gmxana/gmx_dyecoupl.c | 12 +++--- src/gromacs/gmxana/gmx_editconf.c | 8 ++-- src/gromacs/gmxana/gmx_enemat.c | 8 ++-- src/gromacs/gmxana/gmx_energy.c | 28 ++++++------- src/gromacs/gmxana/gmx_genion.c | 18 ++++---- src/gromacs/gmxana/gmx_genpr.c | 6 +-- src/gromacs/gmxana/gmx_gyrate.c | 4 +- src/gromacs/gmxana/gmx_h2order.c | 4 +- src/gromacs/gmxana/gmx_hbond.c | 28 ++++++------- src/gromacs/gmxana/gmx_helix.c | 6 +-- src/gromacs/gmxana/gmx_helixorient.c | 40 +++++++++--------- src/gromacs/gmxana/gmx_hydorder.c | 18 ++++---- src/gromacs/gmxana/gmx_kinetics.c | 16 +++---- src/gromacs/gmxana/gmx_lie.c | 4 +- src/gromacs/gmxana/gmx_make_edi.c | 4 +- src/gromacs/gmxana/gmx_mdmat.c | 6 +-- src/gromacs/gmxana/gmx_mindist.c | 12 +++--- src/gromacs/gmxana/gmx_mk_angndx.c | 4 +- src/gromacs/gmxana/gmx_morph.c | 4 +- src/gromacs/gmxana/gmx_msd.c | 4 +- src/gromacs/gmxana/gmx_nmeig.c | 10 ++--- src/gromacs/gmxana/gmx_order.c | 14 +++---- src/gromacs/gmxana/gmx_polystat.c | 10 ++--- src/gromacs/gmxana/gmx_potential.c | 8 ++-- src/gromacs/gmxana/gmx_principal.c | 18 ++++---- src/gromacs/gmxana/gmx_rama.c | 4 +- src/gromacs/gmxana/gmx_rdf.c | 8 ++-- src/gromacs/gmxana/gmx_rms.c | 16 +++---- src/gromacs/gmxana/gmx_rmsdist.c | 6 +-- src/gromacs/gmxana/gmx_rmsf.c | 14 +++---- src/gromacs/gmxana/gmx_rotmat.c | 4 +- src/gromacs/gmxana/gmx_saltbr.c | 6 +-- src/gromacs/gmxana/gmx_sas.c | 14 +++---- src/gromacs/gmxana/gmx_sham.c | 56 ++++++++++++------------- src/gromacs/gmxana/gmx_sigeps.c | 4 +- src/gromacs/gmxana/gmx_sorient.c | 12 +++--- src/gromacs/gmxana/gmx_spatial.c | 6 +-- src/gromacs/gmxana/gmx_spol.c | 4 +- src/gromacs/gmxana/gmx_tcaf.c | 10 ++--- src/gromacs/gmxana/gmx_traj.c | 20 ++++----- src/gromacs/gmxana/gmx_trjconv.c | 8 ++-- src/gromacs/gmxana/gmx_trjorder.c | 4 +- src/gromacs/gmxana/gmx_tune_pme.c | 6 +-- src/gromacs/gmxana/gmx_vanhove.c | 8 ++-- src/gromacs/gmxana/gmx_wham.cpp | 30 ++++++------- src/gromacs/gmxana/gmx_xpm2ps.c | 8 ++-- src/gromacs/gmxana/powerspect.c | 10 ++--- src/gromacs/gmxana/pp2shift.c | 6 +-- src/gromacs/gmxlib/atomprop.c | 2 +- src/gromacs/gmxlib/copyrite.cpp | 2 +- src/gromacs/gmxlib/readinp.c | 6 +-- src/gromacs/gmxlib/sfactor.c | 2 +- src/gromacs/gmxpreprocess/fflibutil.cpp | 4 +- src/gromacs/gmxpreprocess/gen_vsite.c | 4 +- src/gromacs/gmxpreprocess/h_db.c | 2 +- src/gromacs/gmxpreprocess/nm2type.c | 2 +- src/gromacs/gmxpreprocess/pdb2gmx.c | 2 +- src/gromacs/gmxpreprocess/pdb2top.cpp | 6 +-- src/gromacs/gmxpreprocess/resall.c | 4 +- src/gromacs/gmxpreprocess/solvate.cpp | 14 +++---- src/gromacs/gmxpreprocess/ter_db.c | 2 +- src/gromacs/gmxpreprocess/tomorse.c | 2 +- src/gromacs/gmxpreprocess/x2top.c | 2 +- src/gromacs/gmxpreprocess/xlate.c | 2 +- src/gromacs/mdlib/pme.c | 8 ++-- src/gromacs/mdlib/tables.c | 2 +- src/gromacs/pulling/pull_rotation.c | 2 +- src/gromacs/utility/file.cpp | 4 +- src/programs/mdrun/membed.c | 14 +++---- src/programs/view/fgrid.cpp | 4 +- 111 files changed, 564 insertions(+), 564 deletions(-) diff --git a/cmake/legacy_and_external.supp b/cmake/legacy_and_external.supp index 8df7e76bae..81277a930d 100644 --- a/cmake/legacy_and_external.supp +++ b/cmake/legacy_and_external.supp @@ -73,12 +73,12 @@ fun:bTimeSet } { - ffclose/tMPI_Thread_mutex_init_once + gmx_ffclose/tMPI_Thread_mutex_init_once Memcheck:Leak ... fun:tMPI_Thread_mutex_init_once fun:tMPI_Thread_mutex_lock - fun:ffclose + fun:gmx_ffclose } { diff --git a/src/contrib/do_multiprot.c b/src/contrib/do_multiprot.c index edaca60f71..66dc816b64 100644 --- a/src/contrib/do_multiprot.c +++ b/src/contrib/do_multiprot.c @@ -75,7 +75,7 @@ static void process_multiprot_output(const char *fn, real *rmsd, int *nres, rvec (*rmsd)=-1; (*nres)=0; - mpoutput=ffopen (fn,"r"); + mpoutput=gmx_ffopen (fn,"r"); if (bCountres) { do { @@ -138,7 +138,7 @@ static void process_multiprot_output(const char *fn, real *rmsd, int *nres, rvec (*nres) = atoi(string); } } - ffclose(mpoutput); + gmx_ffclose(mpoutput); } int main(int argc,char *argv[]) @@ -289,7 +289,7 @@ int main(int argc,char *argv[]) } } else { - ffclose(tmpf); + gmx_ffclose(tmpf); } if (ftp != efPDB) { @@ -348,7 +348,7 @@ int main(int argc,char *argv[]) useatoms.nres=max(useatoms.nres,useatoms.atom[i].resind+1); } useatoms.nr=nout; - out=ffopen(TrjoutFile,filemode); + out=gmx_ffopen(TrjoutFile,filemode); break; } if (outftp == efG87) @@ -369,9 +369,9 @@ int main(int argc,char *argv[]) do { t = output_env_conv_time(oenv,fr.time); gmx_rmpbc(gpbc,natoms,fr.box,fr.x); - tapein=ffopen(pdbfile,"w"); + tapein=gmx_ffopen(pdbfile,"w"); write_pdbfile_indexed(tapein,NULL,atoms,fr.x,ePBC,fr.box,' ',-1,gnx,index,NULL,TRUE); - ffclose(tapein); + gmx_ffclose(tapein); system(multiprot); remove(pdbfile); process_multiprot_output(fn, &rmsd, &nres2,rotangles,translation,bCountres,countres); @@ -433,17 +433,17 @@ int main(int argc,char *argv[]) for (i=0;i 0) fprintf(out,"%s\n",buf);*/ fflush(out); - ffclose(in); + gmx_ffclose(in); } int main(int argc,char *argv[]) @@ -158,10 +158,10 @@ int main(int argc,char *argv[]) do { if (t >= nt) { rm_pbc(&(top->idef),top->atoms.nr,box,x,x_s); - fp=ffopen(pdbfile,"w"); + fp=gmx_ffopen(pdbfile,"w"); write_pdbfile_indexed(fp,"Generated by do_shift", atoms,x_s,box,0,-1,gnx,index); - ffclose(fp); + gmx_ffclose(fp); if ((tot=popen(total,"w")) == NULL) perror("opening pipe to total"); @@ -182,7 +182,7 @@ int main(int argc,char *argv[]) } } while(read_next_x(status,&t,natoms,x,box)); close_trj(status); - ffclose(out); + gmx_ffclose(out); gmx_thanx(stderr); diff --git a/src/contrib/ehanal.c b/src/contrib/ehanal.c index 2f98fb3d5a..e781f6331d 100644 --- a/src/contrib/ehanal.c +++ b/src/contrib/ehanal.c @@ -119,7 +119,7 @@ void dump_histo(t_histo *h,char *fn,char *title,char *xaxis,char *yaxis, gmx_fatal(FARGS,"Wrong value for enorm (%d)",enorm); } } - ffclose(fp); + gmx_ffclose(fp); } /******************************************************************* @@ -351,10 +351,10 @@ void dump_ana_struct(char *rmax,char *nion,char *gyr_com,char *gyr_origin, sqrt(anal->d2_origin[i][YY]/nsim), sqrt(anal->d2_origin[i][ZZ]/nsim)); } - ffclose(hp); - ffclose(gp); - ffclose(fp); - ffclose(kp); + gmx_ffclose(hp); + gmx_ffclose(gp); + gmx_ffclose(fp); + gmx_ffclose(kp); } void dump_as_pdb(char *pdb,t_ana_struct *anal) @@ -363,7 +363,7 @@ void dump_as_pdb(char *pdb,t_ana_struct *anal) int i,j; real t; - kp = ffopen(pdb,"w"); + kp = gmx_ffopen(pdb,"w"); for(i=0; (instruct); i++) { t = 1000*anal->t[i]; fprintf(kp,"MODEL %d time %g fs\n",i+1,t); @@ -377,7 +377,7 @@ void dump_as_pdb(char *pdb,t_ana_struct *anal) } fprintf(kp,"ENDMDL\n"); } - ffclose(kp); + gmx_ffclose(kp); } char *enms[eNR] = { @@ -425,6 +425,6 @@ void dump_ana_ener(t_ana_ener *ae,int nsim,real dt,char *edump, fprintf(fp," %8.3f\n",ae->e[i][eELECTRON]/(ELECTRONVOLT*total->nion[i])); } fprintf(fp,"&\n"); - ffclose(fp); + gmx_ffclose(fp); } diff --git a/src/contrib/ehdata.c b/src/contrib/ehdata.c index 3ed98f87e9..0f9bec9cc1 100644 --- a/src/contrib/ehdata.c +++ b/src/contrib/ehdata.c @@ -83,7 +83,7 @@ static t_p2Ddata *read_p2Ddata(char *fn) double e,p,o; fprintf(stdout,"Going to read %s\n",fn); - fp = ffopen(fn,"r"); + fp = gmx_ffopen(fn,"r"); /* Allocate memory and set constants */ snew(p2Ddata,1); @@ -121,7 +121,7 @@ static t_p2Ddata *read_p2Ddata(char *fn) } fprintf(stderr,"\n"); - ffclose(fp); + gmx_ffclose(fp); return p2Ddata; } @@ -134,7 +134,7 @@ static t_pq_inel *read_pq(char *fn) double e,p,o,t; fprintf(stdout,"Going to read %s\n",fn); - fp = ffopen(fn,"r"); + fp = gmx_ffopen(fn,"r"); /* Allocate memory and set constants */ snew(pq,1); @@ -178,7 +178,7 @@ static t_pq_inel *read_pq(char *fn) } fprintf(stderr,"\n"); - ffclose(fp); + gmx_ffclose(fp); return pq; } diff --git a/src/contrib/ehole.c b/src/contrib/ehole.c index c6bd330127..740546cbce 100644 --- a/src/contrib/ehole.c +++ b/src/contrib/ehole.c @@ -527,7 +527,7 @@ void do_sims(int NFILE,t_filenm fnm[],t_eh_params *ehp) helec = init_histo(500,0,500); snew(ae,1); - logfp = ffopen(ftp2fn(efLOG,NFILE,fnm),"w"); + logfp = gmx_ffopen(ftp2fn(efLOG,NFILE,fnm),"w"); print_header(logfp,ehp); for(i=0; (insim); i++) { @@ -538,7 +538,7 @@ void do_sims(int NFILE,t_filenm fnm[],t_eh_params *ehp) fprintf(stderr,"\rSim: %d/%d",i+1,ehp->nsim); } fprintf(stderr,"\n"); - ffclose(logfp); + gmx_ffclose(logfp); sfree(rptr); sfree(pdbbuf); diff --git a/src/contrib/gen_table.c b/src/contrib/gen_table.c index 7c6508c2ae..a0942f7cb8 100644 --- a/src/contrib/gen_table.c +++ b/src/contrib/gen_table.c @@ -453,7 +453,7 @@ static void do_guillot2001a(const char *file,int eel,int pts_nm,double rc,double ((strcmp(atype[j],"OW") == 0) && (strcmp(atype[k],"HW") == 0)) || ((strcmp(atype[j],"OW") == 0) && (strcmp(atype[k],"OW") == 0))) { - fp = ffopen(buf,"w"); + fp = gmx_ffopen(buf,"w"); imax = 3*pts_nm; for(i=0; (i<=imax); i++) { @@ -473,7 +473,7 @@ static void do_guillot2001a(const char *file,int eel,int pts_nm,double rc,double r,vc,fc,vd,fd,vr,fr); } - ffclose(fp); + gmx_ffclose(fp); /* Guillot eqn 4 and 5 */ } else if (((strcmp(atype[j],"HWd") == 0) && (strcmp(atype[k],"HW") == 0)) || @@ -481,7 +481,7 @@ static void do_guillot2001a(const char *file,int eel,int pts_nm,double rc,double ((strcmp(atype[j],"OWd") == 0) && (strcmp(atype[k],"HW") == 0)) || ((strcmp(atype[j],"OWd") == 0) && (strcmp(atype[k],"OW") == 0))) { - fp = ffopen(buf,"w"); + fp = gmx_ffopen(buf,"w"); imax = 3*pts_nm; for(i=0; (i<=imax); i++) { @@ -501,14 +501,14 @@ static void do_guillot2001a(const char *file,int eel,int pts_nm,double rc,double r,vc,fc,vd,fd,vr,fr); } - ffclose(fp); + gmx_ffclose(fp); /* Guillot2001a eqn 3 */ } else if (((strcmp(atype[j],"HWd") == 0) && (strcmp(atype[k],"HWd") == 0)) || ((strcmp(atype[j],"OWd") == 0) && (strcmp(atype[k],"HWd") == 0)) || ((strcmp(atype[j],"OWd") == 0) && (strcmp(atype[k],"OWd") == 0))) { - fp = ffopen(buf,"w"); + fp = gmx_ffopen(buf,"w"); imax = 3*pts_nm; for(i=0; (i<=imax); i++) { @@ -528,7 +528,7 @@ static void do_guillot2001a(const char *file,int eel,int pts_nm,double rc,double r,vc,fc,vd,fd,vr,fr); } - ffclose(fp); + gmx_ffclose(fp); } else gmx_fatal(FARGS,"Invalid atom type: %s %s", atype[j], atype[k]); @@ -795,7 +795,7 @@ int main(int argc,char *argv[]) fn = opt2fn("-o",NFILE,fnm); if ((m != mGuillot2001a)) - fp = ffopen(fn,"w"); + fp = gmx_ffopen(fn,"w"); switch (m) { case mGuillot2001a: do_guillot2001a(fn,eel,pts_nm,rc,rtol,xi,xir); @@ -840,7 +840,7 @@ int main(int argc,char *argv[]) gmx_fatal(FARGS,"Model %s not supported yet",model[0]); } if ((m != mGuillot2001a)) - ffclose(fp); + gmx_ffclose(fp); gmx_thanx(stdout); diff --git a/src/contrib/gmx_sdf.c b/src/contrib/gmx_sdf.c index 7e39126de2..656f973aa6 100644 --- a/src/contrib/gmx_sdf.c +++ b/src/contrib/gmx_sdf.c @@ -552,7 +552,7 @@ structure if needed */ /* write the reference strcture*/ if ( bRef ) { - fp=ffopen(fnREF,"w"); + fp=gmx_ffopen(fnREF,"w"); fprintf(fp,"%s\n",title); fprintf(fp," %d\n",isize[G_REFMOL]); @@ -565,7 +565,7 @@ structure if needed */ -1*x_refmol[i][XX],-1*x_refmol[i][YY],-1*x_refmol[i][ZZ]); /* Inserted -1* on the line above three times */ fprintf(fp," 10.00000 10.00000 10.00000\n"); - ffclose(fp); + gmx_ffclose(fp); fprintf(stderr,"\nWrote reference structure. (%d Atoms)\n",isize[G_REFMOL]); } @@ -582,7 +582,7 @@ structure if needed */ /* normalize the SDF and write output */ /* see http://www.csc.fi/gopenmol/index.phtml for documentation */ - fp=ffopen(fnSDF,"wb"); + fp=gmx_ffopen(fnSDF,"wb"); /* rank */ @@ -630,7 +630,7 @@ structure if needed */ fprintf(stderr,"\nMin: %f Max: %f\n",min_sdf,max_sdf); - ffclose(fp); + gmx_ffclose(fp); /* Give back the mem */ diff --git a/src/contrib/hexamer.c b/src/contrib/hexamer.c index 0fc4c7e60a..07fd6d58bb 100644 --- a/src/contrib/hexamer.c +++ b/src/contrib/hexamer.c @@ -199,14 +199,14 @@ int main(int argc, char *argv[]) if (bCenter) prep_x(atoms.nr,xin,rDist,rAngleZ,rAngleX); - fp = ffopen(outfile,"w"); + fp = gmx_ffopen(outfile,"w"); for(i=0; (i<(bTrimer ? 3 : 6)); i++) { rotate_x(atoms.nr,xin,i*(bTrimer ? 120.0 : 60.0),xout,TRUE, bAlternate && ((i % 2) != 0),alterz*(((i % 2) == 0) ? 0 : 1)); sprintf(buf,"Rotated %d degrees",i*(bTrimer ? 120 : 60)); write_pdbfile(fp,buf,&atoms,xout,box,'A'+i,1+i); } - ffclose(fp); + gmx_ffclose(fp); gmx_thanx(stderr); diff --git a/src/contrib/hrefify.c b/src/contrib/hrefify.c index 6e3c4d25df..cec40f4f89 100644 --- a/src/contrib/hrefify.c +++ b/src/contrib/hrefify.c @@ -184,7 +184,7 @@ int main(int argc, char *argv[]) else fprintf(stderr,"Adding '%s' to href's\n",link_text); - fp=ffopen(out,"w"); + fp=gmx_ffopen(out,"w"); n_repl=0; i_str=-1; @@ -216,7 +216,7 @@ int main(int argc, char *argv[]) fprintf(fp,"%s\n",line); } - ffclose(fp); + gmx_ffclose(fp); fprintf(stderr,"Added %d HTML references\n",n_repl); diff --git a/src/contrib/mkice.c b/src/contrib/mkice.c index c92ee5402d..e89f8415f5 100644 --- a/src/contrib/mkice.c +++ b/src/contrib/mkice.c @@ -635,7 +635,7 @@ int main(int argc,char *argv[]) fn = ftp2fn(efSTO,NFILE,fnm); if (fn2ftp(fn) == efPDB) { - fp = ffopen(fn,"w"); + fp = gmx_ffopen(fn,"w"); if (bDiamond) fprintf(fp,"HEADER This is a *diamond*\n"); else @@ -645,7 +645,7 @@ int main(int argc,char *argv[]) nx,ny,nz,odist,hdist); bromacs(quote,255); write_pdbfile(fp,quote,pdba,xx,boxje,' ',-1); - ffclose(fp); + gmx_ffclose(fp); } else { bromacs(quote,255); diff --git a/src/contrib/pmetest.c b/src/contrib/pmetest.c index e48471522c..63d6ef14ff 100644 --- a/src/contrib/pmetest.c +++ b/src/contrib/pmetest.c @@ -453,7 +453,7 @@ int main(int argc,char *argv[]) /* Finish I/O, close files */ if (MASTER(cr)) { close_trx(status); - ffclose(fp); + gmx_ffclose(fp); } } diff --git a/src/contrib/test.c b/src/contrib/test.c index ddd50ee71f..a4c1c7acab 100644 --- a/src/contrib/test.c +++ b/src/contrib/test.c @@ -135,7 +135,7 @@ int main(int argc,char *argv[]) oldx = x; } - ffclose(fp); + gmx_ffclose(fp); do_view(ftp2fn(efXVG,NFILE,fnm),NULL); diff --git a/src/gromacs/essentialdynamics/edsam.c b/src/gromacs/essentialdynamics/edsam.c index f862b6db92..e2af0de609 100644 --- a/src/gromacs/essentialdynamics/edsam.c +++ b/src/gromacs/essentialdynamics/edsam.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -470,7 +470,7 @@ static void dump_edi(t_edpar *edpars, t_commrec *cr, int nr_edi) sprintf(fn, "EDdump_node%d_edi%d", cr->nodeid, nr_edi); - out = ffopen(fn, "w"); + out = gmx_ffopen(fn, "w"); fprintf(out, "#NINI\n %d\n#FITMAS\n %d\n#ANALYSIS_MAS\n %d\n", edpars->nini, edpars->fitmas, edpars->pcamas); @@ -502,7 +502,7 @@ static void dump_edi(t_edpar *edpars, t_commrec *cr, int nr_edi) fprintf(out, "buf->do_edsam =%p\n", (void*)edpars->buf->do_edsam ); fprintf(out, "buf->do_radcon =%p\n", (void*)edpars->buf->do_radcon ); - ffclose(out); + gmx_ffclose(out); } diff --git a/src/gromacs/fileio/filenm.h b/src/gromacs/fileio/filenm.h index 438966537b..74274628cf 100644 --- a/src/gromacs/fileio/filenm.h +++ b/src/gromacs/fileio/filenm.h @@ -138,7 +138,7 @@ int opt2fns(char **fns[], const char *opt, int nfile, /* Return the filenames belonging to cmd-line option opt, or NULL when * no such option. */ -#define opt2FILE(opt, nfile, fnm, mode) ffopen(opt2fn(opt, nfile, fnm), mode) +#define opt2FILE(opt, nfile, fnm, mode) gmx_ffopen(opt2fn(opt, nfile, fnm), mode) /* Return a file pointer from the filename (see above) */ int fn2ftp(const char *fn); @@ -151,7 +151,7 @@ int ftp2fns(char **fns[], int ftp, int nfile, const t_filenm fnm[]); /* Return the number of files for the first option with type ftp and the files in **fns[] (will be allocated), or NULL when none found. */ -#define ftp2FILE(ftp, nfile, fnm, mode) ffopen(ftp2fn(ftp, nfile, fnm), mode) +#define ftp2FILE(ftp, nfile, fnm, mode) gmx_ffopen(ftp2fn(ftp, nfile, fnm), mode) /* Return a file pointer from the filename (see above) */ gmx_bool ftp2bSet(int ftp, int nfile, const t_filenm fnm[]); diff --git a/src/gromacs/fileio/futil.cpp b/src/gromacs/fileio/futil.cpp index a450b56cf7..0f89c574ea 100644 --- a/src/gromacs/fileio/futil.cpp +++ b/src/gromacs/fileio/futil.cpp @@ -119,8 +119,8 @@ void push_ps(FILE *fp) #define pclose fah_fclose #define SKIP_FFOPS 1 #else -#ifdef ffclose -#undef ffclose +#ifdef gmx_ffclose +#undef gmx_ffclose #endif #if (!defined(HAVE_PIPES) && !defined(__native_client__)) static FILE *popen(const char *nm, const char *mode) @@ -139,7 +139,7 @@ static int pclose(FILE *fp) #endif /* !defined(HAVE_PIPES) && !defined(__native_client__) */ #endif /* GMX_FAHCORE */ -int ffclose(FILE *fp) +int gmx_ffclose(FILE *fp) { #ifdef SKIP_FFOPS return fclose(fp); @@ -461,7 +461,7 @@ gmx_bool make_backup(const char * name) #endif } -FILE *ffopen(const char *file, const char *mode) +FILE *gmx_ffopen(const char *file, const char *mode) { #ifdef SKIP_FFOPS return fopen(file, mode); diff --git a/src/gromacs/fileio/futil.h b/src/gromacs/fileio/futil.h index 9e7ae9f2be..7d214e04db 100644 --- a/src/gromacs/fileio/futil.h +++ b/src/gromacs/fileio/futil.h @@ -2,8 +2,8 @@ * This file is part of the GROMACS molecular simulation package. * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. - * Copyright (c) 2001-2004, The GROMACS development team, - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2001-2004, The GROMACS development team. + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -101,20 +101,20 @@ gmx_bool gmx_eof(FILE *fp); /* Return TRUE on end-of-file, FALSE otherwise */ gmx_bool is_pipe(FILE *fp); -/* Check whether the file (opened by ffopen) is a pipe */ +/* Check whether the file (opened by gmx_ffopen) is a pipe */ /* Make a backup of file if necessary. Return false if there was a problem. */ gmx_bool make_backup(const char * file); -FILE *ffopen(const char *file, const char *mode); +FILE *gmx_ffopen(const char *file, const char *mode); /* Return a valid file pointer when successful, exits otherwise * If the file is in compressed format, open a pipe which uncompresses - * the file! Therefore, files must be closed with ffclose (see below) + * the file! Therefore, files must be closed with gmx_ffclose (see below) */ -int ffclose(FILE *fp); +int gmx_ffclose(FILE *fp); /* Close files or pipes */ diff --git a/src/gromacs/fileio/gmxfio.c b/src/gromacs/fileio/gmxfio.c index 0c8931847e..3325a3605b 100644 --- a/src/gromacs/fileio/gmxfio.c +++ b/src/gromacs/fileio/gmxfio.c @@ -518,7 +518,7 @@ t_fileio *gmx_fio_open(const char *fn, const char *mode) gmx_incons("gmx_fio_open may not be used to open TNG files"); } /* Open the file */ - fio->fp = ffopen(fn, newmode); + fio->fp = gmx_ffopen(fn, newmode); /* determine the XDR direction */ if (newmode[0] == 'w' || newmode[0] == 'a') @@ -536,7 +536,7 @@ t_fileio *gmx_fio_open(const char *fn, const char *mode) else { /* If it is not, open it as a regular file */ - fio->fp = ffopen(fn, newmode); + fio->fp = gmx_ffopen(fn, newmode); } /* for appending seek to end of file to make sure ftell gives correct position @@ -586,7 +586,7 @@ static int gmx_fio_close_locked(t_fileio *fio) /* Don't close stdin and stdout! */ if (!fio->bStdio && fio->fp != NULL) { - rc = ffclose(fio->fp); /* fclose returns 0 if happy */ + rc = gmx_ffclose(fio->fp); /* fclose returns 0 if happy */ } fio->bOpen = FALSE; @@ -627,7 +627,7 @@ int gmx_fio_fp_close(t_fileio *fio) gmx_fio_lock(fio); if (!in_ftpset(fio->iFTP, asize(ftpXDR), ftpXDR) && !fio->bStdio) { - rc = ffclose(fio->fp); /* fclose returns 0 if happy */ + rc = gmx_ffclose(fio->fp); /* fclose returns 0 if happy */ fio->fp = NULL; } gmx_fio_unlock(fio); diff --git a/src/gromacs/fileio/strdb.c b/src/gromacs/fileio/strdb.c index 41ad46533c..b577c42457 100644 --- a/src/gromacs/fileio/strdb.c +++ b/src/gromacs/fileio/strdb.c @@ -132,7 +132,7 @@ int get_strings(const char *db, char ***strings) if (fscanf(in, "%d", &nstr) != 1) { gmx_warning("File %s is empty", db); - ffclose(in); + gmx_ffclose(in); return 0; } snew(ptr, nstr); @@ -147,7 +147,7 @@ int get_strings(const char *db, char ***strings) #endif ptr[i] = strdup(buf); } - ffclose(in); + gmx_ffclose(in); *strings = ptr; @@ -181,7 +181,7 @@ int fget_lines(FILE *in, char ***strings) if (pret == NULL || sscanf(buf, "%d", &nstr) != 1) { gmx_warning("File is empty"); - ffclose(in); + gmx_ffclose(in); return 0; } @@ -204,7 +204,7 @@ int get_lines(const char *db, char ***strings) in = libopen(db); nstr = fget_lines(in, strings); - ffclose(in); + gmx_ffclose(in); return nstr; } @@ -230,7 +230,7 @@ int get_file(const char *db, char ***strings) i++; } nstr = i; - ffclose(in); + gmx_ffclose(in); srenew(ptr, nstr); *strings = ptr; diff --git a/src/gromacs/gmxana/anadih.c b/src/gromacs/gmxana/anadih.c index 2d43009309..8ae35c8ee1 100644 --- a/src/gromacs/gmxana/anadih.c +++ b/src/gromacs/gmxana/anadih.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -69,7 +69,7 @@ void print_one(const output_env_t oenv, const char *base, const char *name, { fprintf(fp, "%10g %10g\n", time[k], data[k]); } - ffclose(fp); + gmx_ffclose(fp); } static int calc_RBbin(real phi, int gmx_unused multiplicity, real gmx_unused core_frac) @@ -299,7 +299,7 @@ void low_ana_dih_trans(gmx_bool bTrans, const char *fn_trans, { fprintf(fp, "%10.3f %10d\n", time[j], tr_f[j]); } - ffclose(fp); + gmx_ffclose(fp); } /* Compute histogram from # transitions per dihedral */ @@ -329,7 +329,7 @@ void low_ana_dih_trans(gmx_bool bTrans, const char *fn_trans, fprintf(fp, "%10.3f %10d\n", ttime/i, tr_f[i]); } } - ffclose(fp); + gmx_ffclose(fp); } sfree(tr_f); @@ -583,7 +583,7 @@ void get_chi_product_traj (real **dih, int nframes, int nlist, } } fprintf(fp, "&\n"); - ffclose(fp); + gmx_ffclose(fp); } /* and finally print out occupancies to a single file */ @@ -610,7 +610,7 @@ void get_chi_product_traj (real **dih, int nframes, int nlist, } sfree(chi_prtrj); - ffclose(fpall); + gmx_ffclose(fpall); fprintf(stderr, "\n"); } diff --git a/src/gromacs/gmxana/autocorr.c b/src/gromacs/gmxana/autocorr.c index f98a670e20..3b43b518ea 100644 --- a/src/gromacs/gmxana/autocorr.c +++ b/src/gromacs/gmxana/autocorr.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -340,12 +340,12 @@ void dump_tmp(char *s, int n, real c[]) FILE *fp; int i; - fp = ffopen(s, "w"); + fp = gmx_ffopen(s, "w"); for (i = 0; (i < n); i++) { fprintf(fp, "%10d %10g\n", i, c[i]); } - ffclose(fp); + gmx_ffclose(fp); } real print_and_integrate(FILE *fp, int n, real dt, real c[], real *fit, int nskip) @@ -950,7 +950,7 @@ void low_do_autocorr(const char *fn, const output_env_t oenv, const char *title, } if (debug) { - ffclose(gp); + gmx_ffclose(gp); } if (nitem > 1) { @@ -963,7 +963,7 @@ void low_do_autocorr(const char *fn, const output_env_t oenv, const char *title, } if (fp) { - ffclose(fp); + gmx_ffclose(fp); } sfree(fit); } diff --git a/src/gromacs/gmxana/cmat.c b/src/gromacs/gmxana/cmat.c index c0029e27d5..e8374fd547 100644 --- a/src/gromacs/gmxana/cmat.c +++ b/src/gromacs/gmxana/cmat.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -232,7 +232,7 @@ void low_rmsd_dist(const char *fn, real maxrms, int nn, real **mat, { fprintf(fp, "%10g %10d\n", i/fac, histo[i]); } - ffclose(fp); + gmx_ffclose(fp); sfree(histo); } diff --git a/src/gromacs/gmxana/gmx_anadock.c b/src/gromacs/gmxana/gmx_anadock.c index 58331c274b..806e754d33 100644 --- a/src/gromacs/gmxana/gmx_anadock.c +++ b/src/gromacs/gmxana/gmx_anadock.c @@ -75,7 +75,7 @@ static t_pdbfile *read_pdbf(const char *fn) init_t_atoms(&(pdbf->atoms), natoms, FALSE); snew(pdbf->x, natoms); read_stx_conf(fn, buf, &pdbf->atoms, pdbf->x, NULL, &pdbf->ePBC, pdbf->box); - fp = ffopen(fn, "r"); + fp = gmx_ffopen(fn, "r"); do { ptr = fgets2(buf, 255, fp); @@ -96,7 +96,7 @@ static t_pdbfile *read_pdbf(const char *fn) } } while (ptr != NULL); - ffclose(fp); + gmx_ffclose(fp); return pdbf; } @@ -195,7 +195,7 @@ static void analyse_em_all(int npdb, t_pdbfile *pdbf[], const char *edocked, { fprintf(fp, "%12lf\n", bFreeSort ? pdbf[i]->efree : pdbf[i]->edocked); } - ffclose(fp); + gmx_ffclose(fp); } } @@ -380,7 +380,7 @@ int gmx_anadock(int argc, char *argv[]) return 0; } - fp = ffopen(opt2fn("-g", NFILE, fnm), "w"); + fp = gmx_ffopen(opt2fn("-g", NFILE, fnm), "w"); please_cite(stdout, "Hetenyi2002b"); please_cite(fp, "Hetenyi2002b"); @@ -392,7 +392,7 @@ int gmx_anadock(int argc, char *argv[]) cluster_em_all(fp, npdbf, pdbf, bFree, bRMS, cutoff); gmx_thanx(fp); - ffclose(fp); + gmx_ffclose(fp); return 0; } diff --git a/src/gromacs/gmxana/gmx_anaeig.c b/src/gromacs/gmxana/gmx_anaeig.c index 412030408e..eef2ef1b99 100644 --- a/src/gromacs/gmxana/gmx_anaeig.c +++ b/src/gromacs/gmxana/gmx_anaeig.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -154,7 +154,7 @@ static void write_xvgr_graphs(const char *file, int ngraphs, int nsetspergraph, int g, s, i; real min, max, xsp, ysp; - out = ffopen(file, "w"); + out = gmx_ffopen(file, "w"); if (output_env_get_xvg_format(oenv) == exvgXMGRACE) { fprintf(out, "@ autoscale onread none\n"); @@ -272,7 +272,7 @@ static void write_xvgr_graphs(const char *file, int ngraphs, int nsetspergraph, } } } - ffclose(out); + gmx_ffclose(out); } static void @@ -446,10 +446,10 @@ static void inprod_matrix(const char *matfile, int natoms, rlo.r = 1; rlo.g = 1; rlo.b = 1; rhi.r = 0; rhi.g = 0; rhi.b = 0; nlevels = 41; - out = ffopen(matfile, "w"); + out = gmx_ffopen(matfile, "w"); write_xpm(out, 0, "Eigenvector inner-products", "in.prod.", "run 1", "run 2", nx, ny, t_x, t_y, mat, 0.0, max, rlo, rhi, &nlevels); - ffclose(out); + gmx_ffclose(out); } static void overlap(const char *outfile, int natoms, @@ -489,7 +489,7 @@ static void overlap(const char *outfile, int natoms, fprintf(out, "%5d %5.3f\n", eignr2[x]+1, overlap/noutvec); } - ffclose(out); + gmx_ffclose(out); } static void project(const char *trajfile, t_topology *top, int ePBC, matrix topbox, @@ -675,7 +675,7 @@ static void project(const char *trajfile, t_topology *top, int ePBC, matrix topb } fprintf(xvgrout, "%10.5f %10.5f\n", inprod[0][i], inprod[noutvec-1][i]); } - ffclose(xvgrout); + gmx_ffclose(xvgrout); } if (threedplotfile) @@ -748,7 +748,7 @@ static void project(const char *trajfile, t_topology *top, int ePBC, matrix topb strcpy(pdbform, get_pdbformat()); strcat(pdbform, "%8.4f%8.4f\n"); - out = ffopen(threedplotfile, "w"); + out = gmx_ffopen(threedplotfile, "w"); fprintf(out, "HEADER %s\n", str); if (b4D) { @@ -771,7 +771,7 @@ static void project(const char *trajfile, t_topology *top, int ePBC, matrix topb j++; } fprintf(out, "TER\n"); - ffclose(out); + gmx_ffclose(out); } else { diff --git a/src/gromacs/gmxana/gmx_analyze.c b/src/gromacs/gmxana/gmx_analyze.c index 6551ef98c4..379574cc4f 100644 --- a/src/gromacs/gmxana/gmx_analyze.c +++ b/src/gromacs/gmxana/gmx_analyze.c @@ -153,7 +153,7 @@ static void plot_coscont(const char *ccfile, int n, int nset, real **val, } fprintf(stdout, "\n"); - ffclose(fp); + gmx_ffclose(fp); } static void regression_analysis(int n, gmx_bool bXYdy, @@ -293,7 +293,7 @@ void histogram(const char *distfile, real binwidth, int n, int nset, real **val, fprintf(fp, "&\n"); } } - ffclose(fp); + gmx_ffclose(fp); } static int real_comp(const void *a, const void *b) @@ -322,7 +322,7 @@ static void average(const char *avfile, int avbar_opt, double av, var, err; real *tmp = NULL; - fp = ffopen(avfile, "w"); + fp = gmx_ffopen(avfile, "w"); if ((avbar_opt == avbarERROR) && (nset == 1)) { avbar_opt = avbarNONE; @@ -383,7 +383,7 @@ static void average(const char *avfile, int avbar_opt, } fprintf(fp, "\n"); } - ffclose(fp); + gmx_ffclose(fp); if (avbar_opt == avbar90) { @@ -685,7 +685,7 @@ static void estimate_error(const char *eefile, int nb_min, int resol, int n, sfree(fitsig); sfree(ybs); sfree(tbs); - ffclose(fp); + gmx_ffclose(fp); } static void luzar_correl(int nn, real *time, int nset, real **val, real temp, @@ -1265,7 +1265,7 @@ int gmx_analyze(int argc, char *argv[]) if (fitfile != NULL) { - out_fit = ffopen(fitfile, "w"); + out_fit = gmx_ffopen(fitfile, "w"); if (bXYdy && nset >= 2) { do_fit(out_fit, 0, TRUE, n, t, val, npargs, ppa, oenv); @@ -1277,7 +1277,7 @@ int gmx_analyze(int argc, char *argv[]) do_fit(out_fit, s, FALSE, n, t, val, npargs, ppa, oenv); } } - ffclose(out_fit); + gmx_ffclose(out_fit); } printf(" std. dev. relative deviation of\n"); @@ -1355,7 +1355,7 @@ int gmx_analyze(int argc, char *argv[]) fprintf(out, "&\n"); } } - ffclose(out); + gmx_ffclose(out); fprintf(stderr, "\r%d, time=%g\n", j-1, (j-1)*dt); } if (ccfile) diff --git a/src/gromacs/gmxana/gmx_angle.c b/src/gromacs/gmxana/gmx_angle.c index e4ef6bbf4d..8d4d9111c6 100644 --- a/src/gromacs/gmxana/gmx_angle.c +++ b/src/gromacs/gmxana/gmx_angle.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -306,7 +306,7 @@ int gmx_g_angle(int argc, char *argv[]) } fprintf(out, "\n"); } - ffclose(out); + gmx_ffclose(out); } if (opt2bSet("-or", NFILE, fnm)) { @@ -324,7 +324,7 @@ int gmx_g_angle(int argc, char *argv[]) fprintf(out, "%10.5f %10.3f\n", time[i], trans_frac[i]); tfrac += trans_frac[i]; } - ffclose(out); + gmx_ffclose(out); tfrac /= nframes; fprintf(stderr, "Average trans fraction: %g\n", tfrac); @@ -463,7 +463,7 @@ int gmx_g_angle(int argc, char *argv[]) fprintf(out, "%10g %10f\n", 180.0, angstat[0]*norm_fac); } - ffclose(out); + gmx_ffclose(out); do_view(oenv, opt2fn("-od", NFILE, fnm), "-nxy"); if (bAver) diff --git a/src/gromacs/gmxana/gmx_bar.c b/src/gromacs/gmxana/gmx_bar.c index 59691a05dc..8db26c9c8a 100644 --- a/src/gromacs/gmxana/gmx_bar.c +++ b/src/gromacs/gmxana/gmx_bar.c @@ -3938,7 +3938,7 @@ int gmx_bar(int argc, char *argv[]) { lambda_vec_print_short(results[nresults-1].b->native_lambda, buf); fprintf(fpi, xvg2format, buf, dg_tot); - ffclose(fpi); + gmx_ffclose(fpi); } do_view(oenv, opt2fn_null("-o", NFILE, fnm), "-xydy"); diff --git a/src/gromacs/gmxana/gmx_bundle.c b/src/gromacs/gmxana/gmx_bundle.c index b6ad8fd08c..7ce5dc0edc 100644 --- a/src/gromacs/gmxana/gmx_bundle.c +++ b/src/gromacs/gmxana/gmx_bundle.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -427,17 +427,17 @@ int gmx_bundle(int argc, char *argv[]) { close_trx(fpdb); } - ffclose(flen); - ffclose(fdist); - ffclose(fz); - ffclose(ftilt); - ffclose(ftiltr); - ffclose(ftiltl); + gmx_ffclose(flen); + gmx_ffclose(fdist); + gmx_ffclose(fz); + gmx_ffclose(ftilt); + gmx_ffclose(ftiltr); + gmx_ffclose(ftiltl); if (bKink) { - ffclose(fkink); - ffclose(fkinkr); - ffclose(fkinkl); + gmx_ffclose(fkink); + gmx_ffclose(fkinkr); + gmx_ffclose(fkinkl); } return 0; diff --git a/src/gromacs/gmxana/gmx_chi.c b/src/gromacs/gmxana/gmx_chi.c index b26b6aef53..62c14cbe6c 100644 --- a/src/gromacs/gmxana/gmx_chi.c +++ b/src/gromacs/gmxana/gmx_chi.c @@ -487,7 +487,7 @@ static void histogramming(FILE *log, int nbin, gmx_residuetype_t rt, rt_size = gmx_residuetype_get_size(rt); if (bSSHisto) { - fp = ffopen(ssdump, "r"); + fp = gmx_ffopen(ssdump, "r"); if (1 != fscanf(fp, "%d", &nres)) { gmx_fatal(FARGS, "Error reading from file %s", ssdump); @@ -499,7 +499,7 @@ static void histogramming(FILE *log, int nbin, gmx_residuetype_t rt, gmx_fatal(FARGS, "Error reading from file %s", ssdump); } - ffclose(fp); + gmx_ffclose(fp); /* Four dimensional array... Very cool */ snew(his_aa_ss, 3); for (i = 0; (i < 3); i++) @@ -708,7 +708,7 @@ static void histogramming(FILE *log, int nbin, gmx_residuetype_t rt, } fprintf(fp, "\n"); } - ffclose(fp); + gmx_ffclose(fp); for (i = 0; (i < NJC); i++) { sfree(leg[i]); @@ -778,7 +778,7 @@ static void histogramming(FILE *log, int nbin, gmx_residuetype_t rt, for (k = 0; (k < 3); k++) { sprintf(sshisfile, "%s-%s.xvg", hisfile, sss[k]); - ssfp[k] = ffopen(sshisfile, "w"); + ssfp[k] = gmx_ffopen(sshisfile, "w"); } } for (j = 0; (j < nbin); j++) @@ -802,13 +802,13 @@ static void histogramming(FILE *log, int nbin, gmx_residuetype_t rt, } } fprintf(fp, "&\n"); - ffclose(fp); + gmx_ffclose(fp); if (bSSHisto) { for (k = 0; (k < 3); k++) { fprintf(ssfp[k], "&\n"); - ffclose(ssfp[k]); + gmx_ffclose(ssfp[k]); } } } @@ -904,7 +904,7 @@ static void do_rama(int nf, int nlist, t_dlist dlist[], real **dih, if (bViol) { sprintf(fn, "violPhiPsi%s.xvg", dlist[i].name); - gp = ffopen(fn, "w"); + gp = gmx_ffopen(fn, "w"); } Phi = dlist[i].j0[edPhi]; Psi = dlist[i].j0[edPsi]; @@ -926,13 +926,13 @@ static void do_rama(int nf, int nlist, t_dlist dlist[], real **dih, } if (bViol) { - ffclose(gp); + gmx_ffclose(gp); } - ffclose(fp); + gmx_ffclose(fp); if (bOm) { sprintf(fn, "ramomega%s.xpm", dlist[i].name); - fp = ffopen(fn, "w"); + fp = gmx_ffopen(fn, "w"); lo = hi = 0; for (j = 0; (j < NMAT); j++) { @@ -965,7 +965,7 @@ static void do_rama(int nf, int nlist, t_dlist dlist[], real **dih, nlevels = 20; write_xpm3(fp, 0, "Omega/Ramachandran Plot", "Deg", "Phi", "Psi", NMAT, NMAT, axis, axis, mat, lo, 180.0, hi, rlo, rmid, rhi, &nlevels); - ffclose(fp); + gmx_ffclose(fp); for (j = 0; (j < NMAT); j++) { sfree(mat[j]); @@ -985,7 +985,7 @@ static void do_rama(int nf, int nlist, t_dlist dlist[], real **dih, { fprintf(fp, "%10g %10g\n", RAD2DEG*dih[Xi1][j], RAD2DEG*dih[Xi2][j]); } - ffclose(fp); + gmx_ffclose(fp); } else { @@ -1046,7 +1046,7 @@ static void print_transitions(const char *fn, int maxchi, int nlist, /* fprintf(fp,"%12s\n",dlist[i].name); this confuses xmgrace */ fprintf(fp, "\n"); } - ffclose(fp); + gmx_ffclose(fp); } static void order_params(FILE *log, @@ -1125,7 +1125,7 @@ static void order_params(FILE *log, fprintf(fp, "\n"); /* fprintf(fp,"%12s\n",dlist[i].name); this confuses xmgrace */ } - ffclose(fp); + gmx_ffclose(fp); if (NULL != pdbfn) { @@ -1155,7 +1155,7 @@ static void order_params(FILE *log, } } - fp = ffopen(pdbfn, "w"); + fp = gmx_ffopen(pdbfn, "w"); fprintf(fp, "REMARK generated by g_chi\n"); fprintf(fp, "REMARK " "B-factor field contains negative of dihedral order parameters\n"); @@ -1176,7 +1176,7 @@ static void order_params(FILE *log, fprintf(fp, buf, "ATOM ", atoms->nr+1+i, "CA", "LEG", ' ', atoms->nres+1, ' ', x0, y0, z0+(1.2*i), 0.0, -0.1*i); } - ffclose(fp); + gmx_ffclose(fp); } fprintf(log, "Dihedrals with S2 > 0.8\n"); @@ -1392,7 +1392,7 @@ int gmx_chi(int argc, char *argv[]) sscanf(maxchistr[0], "%d", &maxchi); bChi = (maxchi > 0); - log = ffopen(ftp2fn(efLOG, NFILE, fnm), "w"); + log = gmx_ffopen(ftp2fn(efLOG, NFILE, fnm), "w"); if (bRamOmega) { @@ -1537,7 +1537,7 @@ int gmx_chi(int argc, char *argv[]) traj_t_ns = 0.001 * (time[nf-1]-time[0]); pr_dlist(log, nlist, dlist, traj_t_ns, edPrintST, bPhi, bPsi, bChi, bOmega, maxchi); pr_dlist(log, nlist, dlist, traj_t_ns, edPrintRO, bPhi, bPsi, bChi, bOmega, maxchi); - ffclose(log); + gmx_ffclose(log); /* transitions to xvg */ if (bDo_rt) { diff --git a/src/gromacs/gmxana/gmx_cluster.c b/src/gromacs/gmxana/gmx_cluster.c index 7f178abc0c..565f06c9b3 100644 --- a/src/gromacs/gmxana/gmx_cluster.c +++ b/src/gromacs/gmxana/gmx_cluster.c @@ -980,13 +980,13 @@ static void ana_trans(t_clusters *clust, int nf, "max %d between two specific clusters\n", ntranst, maxtrans); if (transfn) { - fp = ffopen(transfn, "w"); + fp = gmx_ffopen(transfn, "w"); i = min(maxtrans+1, 80); write_xpm(fp, 0, "Cluster Transitions", "# transitions", "from cluster", "to cluster", clust->ncl, clust->ncl, axis, axis, trans, 0, maxtrans, rlo, rhi, &i); - ffclose(fp); + gmx_ffclose(fp); } if (ntransfn) { @@ -996,7 +996,7 @@ static void ana_trans(t_clusters *clust, int nf, { fprintf(fp, "%5d %5d\n", i+1, ntrans[i]); } - ffclose(fp); + gmx_ffclose(fp); } sfree(ntrans); for (i = 0; i < clust->ncl; i++) @@ -1102,7 +1102,7 @@ static void analyze_clusters(int nf, t_clusters *clust, real **rmsd, { fprintf(fp, "%8g %8d\n", time[i], clust->cl[i]); } - ffclose(fp); + gmx_ffclose(fp); } if (sizefn) { @@ -1865,7 +1865,7 @@ int gmx_cluster(int argc, char *argv[]) { fprintf(fp, "%10d %10g\n", i, eigenvalues[i]); } - ffclose(fp); + gmx_ffclose(fp); break; case m_monte_carlo: orig = init_mat(rms->nn, FALSE); @@ -1921,7 +1921,7 @@ int gmx_cluster(int argc, char *argv[]) bAverage, write_ncl, write_nst, rmsmin, bFit, log, rlo_bot, rhi_bot, oenv); } - ffclose(log); + gmx_ffclose(log); if (bBinary && !bAnalyze) { @@ -1966,7 +1966,7 @@ int gmx_cluster(int argc, char *argv[]) } } fprintf(stderr, "\n"); - ffclose(fp); + gmx_ffclose(fp); if (NULL != orig) { fp = opt2FILE("-om", NFILE, fnm, "w"); @@ -1975,7 +1975,7 @@ int gmx_cluster(int argc, char *argv[]) write_xpm(fp, 0, title, "RMSD (nm)", buf, buf, nf, nf, time, time, orig->mat, 0.0, orig->maxrms, rlo_top, rhi_top, &nlevels); - ffclose(fp); + gmx_ffclose(fp); done_mat(&orig); sfree(orig); } diff --git a/src/gromacs/gmxana/gmx_clustsize.c b/src/gromacs/gmxana/gmx_clustsize.c index 72ac220a18..d55fcfae5c 100644 --- a/src/gromacs/gmxana/gmx_clustsize.c +++ b/src/gromacs/gmxana/gmx_clustsize.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2007, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -339,16 +339,16 @@ static void clust_size(const char *ndx, const char *trx, const char *xpm, } while (read_next_frame(oenv, status, &fr)); close_trx(status); - ffclose(fp); - ffclose(gp); - ffclose(hp); - ffclose(tp); + gmx_ffclose(fp); + gmx_ffclose(gp); + gmx_ffclose(hp); + gmx_ffclose(tp); gmx_mtop_atomlookup_destroy(alook); if (max_clust_ind >= 0) { - fp = ffopen(mcn, "w"); + fp = gmx_ffopen(mcn, "w"); fprintf(fp, "[ max_clust ]\n"); for (i = 0; (i < nindex); i++) { @@ -367,7 +367,7 @@ static void clust_size(const char *ndx, const char *trx, const char *xpm, } } } - ffclose(fp); + gmx_ffclose(fp); } /* Print the real distribution cluster-size/numer, averaged over the trajectory. */ @@ -385,7 +385,7 @@ static void clust_size(const char *ndx, const char *trx, const char *xpm, nhisto += (int)((j+1)*nelem/n_x); } fprintf(fp, "%5d %8.3f\n", j+1, 0.0); - ffclose(fp); + gmx_ffclose(fp); fprintf(stderr, "Total number of atoms in clusters = %d\n", nhisto); @@ -407,11 +407,11 @@ static void clust_size(const char *ndx, const char *trx, const char *xpm, } fprintf(stderr, "cmid: %g, cmax: %g, max_size: %d\n", cmid, cmax, max_size); cmid = 1; - fp = ffopen(xpm, "w"); + fp = gmx_ffopen(xpm, "w"); write_xpm3(fp, 0, "Cluster size distribution", "# clusters", timebuf, "Size", n_x, max_size, t_x, t_y, cs_dist, 0, cmid, cmax, rlo, rmid, rhi, &nlevels); - ffclose(fp); + gmx_ffclose(fp); cmid = 100.0; cmax = 0.0; for (i = 0; (i < n_x); i++) @@ -427,11 +427,11 @@ static void clust_size(const char *ndx, const char *trx, const char *xpm, } } fprintf(stderr, "cmid: %g, cmax: %g, max_size: %d\n", cmid, cmax, max_size); - fp = ffopen(xpmw, "w"); + fp = gmx_ffopen(xpmw, "w"); write_xpm3(fp, 0, "Weighted cluster size distribution", "Fraction", timebuf, "Size", n_x, max_size, t_x, t_y, cs_dist, 0, cmid, cmax, rlo, rmid, rhi, &nlevels); - ffclose(fp); + gmx_ffclose(fp); sfree(clust_index); sfree(clust_size); diff --git a/src/gromacs/gmxana/gmx_confrms.c b/src/gromacs/gmxana/gmx_confrms.c index d242b8edb5..40e4e722d5 100644 --- a/src/gromacs/gmxana/gmx_confrms.c +++ b/src/gromacs/gmxana/gmx_confrms.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -609,7 +609,7 @@ int gmx_confrms(int argc, char *argv[]) find_matching_names(&isize1, index1, atoms1, &isize2, index2, atoms2); if (matchndxfile) { - fp = ffopen(matchndxfile, "w"); + fp = gmx_ffopen(matchndxfile, "w"); fprintf(fp, "; Matching atoms between %s from %s and %s from %s\n", groupnames1, conf1file, groupnames2, conf2file); fprintf(fp, "[ Match_%s_%s ]\n", conf1file, groupnames1); @@ -798,26 +798,26 @@ int gmx_confrms(int argc, char *argv[]) /* atoms2->resinfo[atoms2->atom[index2[i]].resind].chain = 'B'; */ } } - fp = ffopen(outfile, "w"); + fp = gmx_ffopen(outfile, "w"); if (!bOne) { write_pdbfile(fp, title1, atoms1, x1, ePBC1, box1, ' ', 1, NULL, TRUE); } write_pdbfile(fp, title2, atoms2, x2, ePBC2, box2, ' ', bOne ? -1 : 2, NULL, TRUE); - ffclose(fp); + gmx_ffclose(fp); break; case efGRO: if (bBfac) { fprintf(stderr, "WARNING: cannot write B-factor values to gro file\n"); } - fp = ffopen(outfile, "w"); + fp = gmx_ffopen(outfile, "w"); if (!bOne) { write_hconf_p(fp, title1, atoms1, 3, x1, v1, box1); } write_hconf_p(fp, title2, atoms2, 3, x2, v2, box2); - ffclose(fp); + gmx_ffclose(fp); break; default: if (bBfac) diff --git a/src/gromacs/gmxana/gmx_covar.c b/src/gromacs/gmxana/gmx_covar.c index c3d2c81874..dfeb48ee2a 100644 --- a/src/gromacs/gmxana/gmx_covar.c +++ b/src/gromacs/gmxana/gmx_covar.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -422,7 +422,7 @@ int gmx_covar(int argc, char *argv[]) if (asciifile) { - out = ffopen(asciifile, "w"); + out = gmx_ffopen(asciifile, "w"); for (j = 0; j < ndim; j++) { for (i = 0; i < ndim; i += 3) @@ -431,7 +431,7 @@ int gmx_covar(int argc, char *argv[]) mat[ndim*j+i], mat[ndim*j+i+1], mat[ndim*j+i+2]); } } - ffclose(out); + gmx_ffclose(out); } if (xpmfile) @@ -462,12 +462,12 @@ int gmx_covar(int argc, char *argv[]) rlo.r = 0; rlo.g = 0; rlo.b = 1; rmi.r = 1; rmi.g = 1; rmi.b = 1; rhi.r = 1; rhi.g = 0; rhi.b = 0; - out = ffopen(xpmfile, "w"); + out = gmx_ffopen(xpmfile, "w"); nlevels = 80; write_xpm3(out, 0, "Covariance", bM ? "u nm^2" : "nm^2", "dim", "dim", ndim, ndim, axis, axis, mat2, min, 0.0, max, rlo, rmi, rhi, &nlevels); - ffclose(out); + gmx_ffclose(out); sfree(axis); sfree(mat2); } @@ -509,12 +509,12 @@ int gmx_covar(int argc, char *argv[]) rlo.r = 0; rlo.g = 0; rlo.b = 1; rmi.r = 1; rmi.g = 1; rmi.b = 1; rhi.r = 1; rhi.g = 0; rhi.b = 0; - out = ffopen(xpmafile, "w"); + out = gmx_ffopen(xpmafile, "w"); nlevels = 80; write_xpm3(out, 0, "Covariance", bM ? "u nm^2" : "nm^2", "atom", "atom", ndim/DIM, ndim/DIM, axis, axis, mat2, min, 0.0, max, rlo, rmi, rhi, &nlevels); - ffclose(out); + gmx_ffclose(out); sfree(axis); for (i = 0; i < ndim/DIM; i++) { @@ -559,7 +559,7 @@ int gmx_covar(int argc, char *argv[]) { fprintf (out, "%10d %g\n", (int)i+1, eigenvalues[ndim-1-i]); } - ffclose(out); + gmx_ffclose(out); if (end == -1) { @@ -597,7 +597,7 @@ int gmx_covar(int argc, char *argv[]) write_eigenvectors(eigvecfile, natoms, mat, TRUE, 1, end, WriteXref, x, bDiffMass1, xproj, bM, eigenvalues); - out = ffopen(logfile, "w"); + out = gmx_ffopen(logfile, "w"); time(&now); gmx_ctime_r(&now, timebuf, STRLEN); @@ -648,7 +648,7 @@ int gmx_covar(int argc, char *argv[]) fprintf(out, "Wrote average structure to %s and %s\n", averfile, eigvecfile); fprintf(out, "Wrote eigenvectors %d to %d to %s\n", 1, end, eigvecfile); - ffclose(out); + gmx_ffclose(out); fprintf(stderr, "Wrote the log to %s\n", logfile); diff --git a/src/gromacs/gmxana/gmx_current.c b/src/gromacs/gmxana/gmx_current.c index 66825b4a3d..bd053807a9 100644 --- a/src/gromacs/gmxana/gmx_current.c +++ b/src/gromacs/gmxana/gmx_current.c @@ -991,16 +991,16 @@ int gmx_current(int argc, char *argv[]) temp, trust, bfit, efit, bvit, evit, status, isize, nmols, nshift, index0, indexm, mass2, qmol, eps_rf, oenv); - ffclose(fmj); - ffclose(fmd); - ffclose(fmjdsp); + gmx_ffclose(fmj); + gmx_ffclose(fmd); + gmx_ffclose(fmjdsp); if (bACF) { - ffclose(outf); + gmx_ffclose(outf); } if (bINT) { - ffclose(mcor); + gmx_ffclose(mcor); } return 0; diff --git a/src/gromacs/gmxana/gmx_density.c b/src/gromacs/gmxana/gmx_density.c index f3891fcceb..33fac9beb0 100644 --- a/src/gromacs/gmxana/gmx_density.c +++ b/src/gromacs/gmxana/gmx_density.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -88,7 +88,7 @@ int get_electrons(t_electron **eltab, const char *fn) int nr; /* number of atomstypes to read */ int i; - if (!(in = ffopen(fn, "r"))) + if (!(in = gmx_ffopen(fn, "r"))) { gmx_fatal(FARGS, "Couldn't open %s. Exiting.\n", fn); } @@ -118,7 +118,7 @@ int get_electrons(t_electron **eltab, const char *fn) (*eltab)[i].nr_el = tempnr; (*eltab)[i].atomname = strdup(tempname); } - ffclose(in); + gmx_ffclose(in); /* sort the list */ fprintf(stderr, "Sorting list..\n"); @@ -431,7 +431,7 @@ void plot_density(double *slDensity[], const char *afile, int nslices, fprintf(den, "\n"); } - ffclose(den); + gmx_ffclose(den); } int gmx_density(int argc, char *argv[]) diff --git a/src/gromacs/gmxana/gmx_densmap.c b/src/gromacs/gmxana/gmx_densmap.c index b58dea0c99..0206280fa3 100644 --- a/src/gromacs/gmxana/gmx_densmap.c +++ b/src/gromacs/gmxana/gmx_densmap.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -499,7 +499,7 @@ int gmx_densmap(int argc, char *argv[]) } if (ftp2bSet(efDAT, NFILE, fnm)) { - fp = ffopen(ftp2fn(efDAT, NFILE, fnm), "w"); + fp = gmx_ffopen(ftp2fn(efDAT, NFILE, fnm), "w"); /*optional text form output: first row is tickz; first col is tickx */ fprintf(fp, "0\t"); for (j = 0; j < n2; ++j) @@ -517,15 +517,15 @@ int gmx_densmap(int argc, char *argv[]) } fprintf(fp, "\n"); } - ffclose(fp); + gmx_ffclose(fp); } else { - fp = ffopen(ftp2fn(efXPM, NFILE, fnm), "w"); + fp = gmx_ffopen(ftp2fn(efXPM, NFILE, fnm), "w"); write_xpm(fp, MAT_SPATIAL_X | MAT_SPATIAL_Y, buf, unit, bRadial ? "axial (nm)" : label[c1], bRadial ? "r (nm)" : label[c2], n1, n2, tickx, tickz, grid, dmin, maxgrid, rlo, rhi, &nlev); - ffclose(fp); + gmx_ffclose(fp); } do_view(oenv, opt2fn("-o", NFILE, fnm), NULL); diff --git a/src/gromacs/gmxana/gmx_densorder.cpp b/src/gromacs/gmxana/gmx_densorder.cpp index 37ea9a3013..2f32968c9e 100644 --- a/src/gromacs/gmxana/gmx_densorder.cpp +++ b/src/gromacs/gmxana/gmx_densorder.cpp @@ -302,7 +302,7 @@ static void outputfield(const char *fldfn, real ****Densmap, dim[2] = yslices; dim[3] = zslices; - fldH = ffopen(fldfn, "w"); + fldH = gmx_ffopen(fldfn, "w"); fwrite(dim, sizeof(int), 4, fldH); for (n = 0; n < tdim; n++) { @@ -320,7 +320,7 @@ static void outputfield(const char *fldfn, real ****Densmap, } totdens /= (xslices*yslices*zslices*tdim); fprintf(stderr, "Total density [kg/m^3] %8f", totdens); - ffclose(fldH); + gmx_ffclose(fldH); } static void filterdensmap(real ****Densmap, int xslices, int yslices, int zslices, int tblocks, int ftsize) @@ -562,8 +562,8 @@ static void writesurftoxpms(t_interf ***surf1, t_interf ***surf2, int tblocks, i yticks[j] += bw; } - xpmfile1 = ffopen(outfiles[0], "w"); - xpmfile2 = ffopen(outfiles[1], "w"); + xpmfile1 = gmx_ffopen(outfiles[0], "w"); + xpmfile2 = gmx_ffopen(outfiles[1], "w"); max1 = max2 = 0.0; min1 = min2 = zbins*bwz; @@ -602,8 +602,8 @@ static void writesurftoxpms(t_interf ***surf1, t_interf ***surf2, int tblocks, i write_xpm(xpmfile2, 3, numbuf, "Height", "x[nm]", "y[nm]", xbins, ybins, xticks, yticks, profile2, min2, max2, lo, hi, &maplevels); } - ffclose(xpmfile1); - ffclose(xpmfile2); + gmx_ffclose(xpmfile1); + gmx_ffclose(xpmfile2); sfree(profile1); @@ -617,8 +617,8 @@ static void writeraw(t_interf ***int1, t_interf ***int2, int tblocks, int xbins, FILE *raw1, *raw2; int i, j, n; - raw1 = ffopen(fnms[0], "w"); - raw2 = ffopen(fnms[1], "w"); + raw1 = gmx_ffopen(fnms[0], "w"); + raw2 = gmx_ffopen(fnms[1], "w"); try { gmx::BinaryInformationSettings settings; @@ -644,8 +644,8 @@ static void writeraw(t_interf ***int1, t_interf ***int2, int tblocks, int xbins, } } - ffclose(raw1); - ffclose(raw2); + gmx_ffclose(raw1); + gmx_ffclose(raw2); } diff --git a/src/gromacs/gmxana/gmx_dielectric.c b/src/gromacs/gmxana/gmx_dielectric.c index 37714d3e27..2a8fd80605 100644 --- a/src/gromacs/gmxana/gmx_dielectric.c +++ b/src/gromacs/gmxana/gmx_dielectric.c @@ -132,7 +132,7 @@ real numerical_deriv(int nx, real x[], real y[], real fity[], real combined[], r } } - tmpfp = ffopen("integral_smth.xvg", "w"); + tmpfp = gmx_ffopen("integral_smth.xvg", "w"); integralSmth = print_and_integrate(tmpfp, nx, x[1]-x[0], combined, NULL, 1); printf("SMOOTH integral = %10.5e\n", integralSmth); @@ -224,8 +224,8 @@ void do_four(const char *fn, const char *cn, int nx, real x[], real dy[], } printf("MAXEPS = %10.5e at frequency %10.5e GHz (tauD = %8.1f ps)\n", maxeps, numax, 1000/(2*M_PI*numax)); - ffclose(fp); - ffclose(cp); + gmx_ffclose(fp); + gmx_ffclose(cp); sfree(tmp); } diff --git a/src/gromacs/gmxana/gmx_dipoles.cpp b/src/gromacs/gmxana/gmx_dipoles.cpp index 14d32a48a3..dc0c0982fb 100644 --- a/src/gromacs/gmxana/gmx_dipoles.cpp +++ b/src/gromacs/gmxana/gmx_dipoles.cpp @@ -320,13 +320,13 @@ static void print_cmap(const char *cmap, t_gkrbin *gb, int *nlevels) } /*2.0*j/(gb->ny-1.0)-1.0;*/ } - out = ffopen(cmap, "w"); + out = gmx_ffopen(cmap, "w"); write_xpm(out, 0, "Dipole Orientation Distribution", "Fraction", "r (nm)", gb->bPhi ? "Phi" : "Alpha", gb->nx, gb->ny, xaxis, yaxis, gb->cmap, 0, hi, rlo, rhi, nlevels); - ffclose(out); + gmx_ffclose(out); sfree(xaxis); sfree(yaxis); } @@ -405,7 +405,7 @@ static void print_gkrbin(const char *fn, t_gkrbin *gb, /* Swap x0 and x1 */ x0 = x1; } - ffclose(fp); + gmx_ffclose(fp); } gmx_bool read_mu_from_enx(ener_file_t fmu, int Vol, ivec iMu, rvec mu, real *vol, @@ -687,7 +687,7 @@ static void dump_slab_dipoles(const char *fn, int idim, int nslice, slab_dipole[i][ZZ]/nframes, mutot); } - ffclose(fp); + gmx_ffclose(fp); do_view(oenv, fn, "-autoscale xy -nxy"); } @@ -943,11 +943,11 @@ static void do_dip(t_topology *top, int ePBC, real volume, snew(dipsp, gnx_tot); /* we need a dummy file for gnuplot */ - dip3d = (FILE *)ffopen("dummy.dat", "w"); + dip3d = (FILE *)gmx_ffopen("dummy.dat", "w"); fprintf(dip3d, "%f %f %f", 0.0, 0.0, 0.0); - ffclose(dip3d); + gmx_ffclose(dip3d); - dip3d = (FILE *)ffopen(fndip3d, "w"); + dip3d = (FILE *)gmx_ffopen(fndip3d, "w"); try { gmx::BinaryInformationSettings settings; @@ -1337,18 +1337,18 @@ static void do_dip(t_topology *top, int ePBC, real volume, close_trj(status); } - ffclose(outmtot); - ffclose(outaver); - ffclose(outeps); + gmx_ffclose(outmtot); + gmx_ffclose(outaver); + gmx_ffclose(outeps); if (fnadip) { - ffclose(adip); + gmx_ffclose(adip); } if (cosaver) { - ffclose(caver); + gmx_ffclose(caver); } if (dip3d) @@ -1358,7 +1358,7 @@ static void do_dip(t_topology *top, int ePBC, real volume, fprintf(dip3d, "set zrange [0.0:%4.2f]\n\n", box[ZZ][ZZ]); fprintf(dip3d, "splot 'dummy.dat' using 1:2:3 w vec\n"); fprintf(dip3d, "pause -1 'Hit return to continue'\n"); - ffclose(dip3d); + gmx_ffclose(dip3d); } if (bSlab) @@ -1457,7 +1457,7 @@ static void do_dip(t_topology *top, int ePBC, real volume, fprintf(outdd, "%10g %10f\n", (i*mu_max)/ndipbin, dipole_bin[i]/(double)teller); } - ffclose(outdd); + gmx_ffclose(outdd); sfree(dipole_bin); } if (bGkr) diff --git a/src/gromacs/gmxana/gmx_disre.c b/src/gromacs/gmxana/gmx_disre.c index 6f05124b44..09c1533bc7 100644 --- a/src/gromacs/gmxana/gmx_disre.c +++ b/src/gromacs/gmxana/gmx_disre.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -639,10 +639,10 @@ static void dump_disre_matrix(const char *fn, t_dr_result *dr, int ndr, hi = max_dr; } printf("Highest level in the matrix will be %g\n", hi); - fp = ffopen(fn, "w"); + fp = gmx_ffopen(fn, "w"); write_xpm(fp, 0, "Distance Violations", " (nm)", "Residue", "Residue", n_res, n_res, t_res, t_res, matrix, 0, hi, rlo, rhi, &nlevels); - ffclose(fp); + gmx_ffclose(fp); } int gmx_disre(int argc, char *argv[]) @@ -929,13 +929,13 @@ int gmx_disre(int argc, char *argv[]) } dump_disre_matrix(opt2fn_null("-x", NFILE, fnm), &dr, fcd.disres.nres, j, &top->idef, &mtop, max_dr, nlevels, bThird); - ffclose(out); - ffclose(aver); - ffclose(numv); - ffclose(maxxv); + gmx_ffclose(out); + gmx_ffclose(aver); + gmx_ffclose(numv); + gmx_ffclose(maxxv); if (isize > 0) { - ffclose(xvg); + gmx_ffclose(xvg); do_view(oenv, opt2fn("-dr", NFILE, fnm), "-nxy"); } do_view(oenv, opt2fn("-dn", NFILE, fnm), "-nxy"); diff --git a/src/gromacs/gmxana/gmx_do_dssp.c b/src/gromacs/gmxana/gmx_do_dssp.c index 3b34c71baf..77e1433480 100644 --- a/src/gromacs/gmxana/gmx_do_dssp.c +++ b/src/gromacs/gmxana/gmx_do_dssp.c @@ -74,7 +74,7 @@ static int strip_dssp(char *dsspfile, int nres, real iaccf, iaccb; t_xpmelmt c; - tapeout = ffopen(dsspfile, "r"); + tapeout = gmx_ffopen(dsspfile, "r"); /* Skip header */ do @@ -179,7 +179,7 @@ static int strip_dssp(char *dsspfile, int nres, { fprintf(fTArea, "%10g %10g %10g\n", t, 0.01*iaccb, 0.01*iaccf); } - ffclose(tapeout); + gmx_ffclose(tapeout); /* Return the number of lines found in the dssp file (i.e. number * of redidues plus chain separator lines). @@ -328,12 +328,12 @@ void write_sas_mat(const char *fn, real **accr, int nframe, int nres, t_matrix * hi = max(hi, accr[i][j]); } } - fp = ffopen(fn, "w"); + fp = gmx_ffopen(fn, "w"); nlev = hi-lo+1; write_xpm(fp, 0, "Solvent Accessible Surface", "Surface (A^2)", "Time", "Residue Index", nframe, nres, mat->axis_x, mat->axis_y, accr, lo, hi, rlo, rhi, &nlev); - ffclose(fp); + gmx_ffclose(fp); } } @@ -427,7 +427,7 @@ void analyse_ss(const char *outfile, t_matrix *mat, const char *ss_string, } fprintf(fp, "\n"); - ffclose(fp); + gmx_ffclose(fp); sfree(leg); sfree(count); } @@ -656,9 +656,9 @@ int gmx_do_dssp(int argc, char *argv[]) } } gmx_rmpbc(gpbc, natoms, box, x); - tapein = ffopen(pdbfile, "w"); + tapein = gmx_ffopen(pdbfile, "w"); write_pdbfile_indexed(tapein, NULL, atoms, x, ePBC, box, ' ', -1, gnx, index, NULL, TRUE); - ffclose(tapein); + gmx_ffclose(tapein); #ifdef GMX_NO_SYSTEM printf("Warning-- No calls to system(3) supported on this platform."); @@ -691,7 +691,7 @@ int gmx_do_dssp(int argc, char *argv[]) close_trj(status); if (fTArea) { - ffclose(fTArea); + gmx_ffclose(fTArea); } gmx_rmpbc_done(gpbc); @@ -700,7 +700,7 @@ int gmx_do_dssp(int argc, char *argv[]) ss = opt2FILE("-o", NFILE, fnm, "w"); mat.flags = 0; write_xpm_m(ss, mat); - ffclose(ss); + gmx_ffclose(ss); if (opt2bSet("-ssdump", NFILE, fnm)) { @@ -716,7 +716,7 @@ int gmx_do_dssp(int argc, char *argv[]) ss_str[i] = '\0'; fprintf(ss, "%s\n", ss_str); } - ffclose(ss); + gmx_ffclose(ss); sfree(ss_str); } analyse_ss(fnSCount, &mat, ss_string, oenv); @@ -740,7 +740,7 @@ int gmx_do_dssp(int argc, char *argv[]) { fprintf(acc, "%5d %10g %10g\n", i+1, av_area[i], norm_av_area[i]); } - ffclose(acc); + gmx_ffclose(acc); } } diff --git a/src/gromacs/gmxana/gmx_dyecoupl.c b/src/gromacs/gmxana/gmx_dyecoupl.c index cce60f90cd..9577dc895a 100644 --- a/src/gromacs/gmxana/gmx_dyecoupl.c +++ b/src/gromacs/gmxana/gmx_dyecoupl.c @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -354,17 +354,17 @@ int gmx_dyecoupl(int argc, char *argv[]) if (bRKout) { - ffclose(rkfp); + gmx_ffclose(rkfp); } if (bDatout) { - ffclose(datfp); + gmx_ffclose(datfp); } if (bInstEffout) { - ffclose(iefp); + gmx_ffclose(iefp); } @@ -415,7 +415,7 @@ int gmx_dyecoupl(int argc, char *argv[]) fprintf(rhfp, "%12.7f %12.7f\n", (i + 0.5) * rincr + rmin, rhist[i]); } - ffclose(rhfp); + gmx_ffclose(rhfp); } if (bKhistout) @@ -452,7 +452,7 @@ int gmx_dyecoupl(int argc, char *argv[]) fprintf(khfp, "%12.7f %12.7f\n", (i + 0.5) * kincr + kmin, khist[i]); } - ffclose(khfp); + gmx_ffclose(khfp); } printf("\nAverages:\n"); diff --git a/src/gromacs/gmxana/gmx_editconf.c b/src/gromacs/gmxana/gmx_editconf.c index 48f0f07a3f..a28cb57450 100644 --- a/src/gromacs/gmxana/gmx_editconf.c +++ b/src/gromacs/gmxana/gmx_editconf.c @@ -1273,9 +1273,9 @@ int gmx_editconf(int argc, char *argv[]) if (outftp == efPDB) { - out = ffopen(outfile, "w"); + out = gmx_ffopen(outfile, "w"); write_pdbfile_indexed(out, title, &atoms, x, ePBC, box, ' ', 1, isize, index, conect, TRUE); - ffclose(out); + gmx_ffclose(out); } else { @@ -1291,7 +1291,7 @@ int gmx_editconf(int argc, char *argv[]) if ((outftp == efPDB) || (outftp == efPQR)) { - out = ffopen(outfile, "w"); + out = gmx_ffopen(outfile, "w"); if (bMead) { set_pdb_wide_format(TRUE); @@ -1331,7 +1331,7 @@ int gmx_editconf(int argc, char *argv[]) visualize_box(out, bLegend ? atoms.nr+12 : atoms.nr, bLegend ? atoms.nres = 12 : atoms.nres, box, visbox); } - ffclose(out); + gmx_ffclose(out); } else { diff --git a/src/gromacs/gmxana/gmx_enemat.c b/src/gromacs/gmxana/gmx_enemat.c index 6ca3a0fea4..d2ff0eb970 100644 --- a/src/gromacs/gmxana/gmx_enemat.c +++ b/src/gromacs/gmxana/gmx_enemat.c @@ -470,7 +470,7 @@ int gmx_enemat(int argc, char *argv[]) sprintf(fn, "%s%s", egrp_nm[m], ftp2fn(efXPM, NFILE, fnm)); sprintf(label, "%s Interaction Energies", egrp_nm[m]); - out = ffopen(fn, "w"); + out = gmx_ffopen(fn, "w"); if (emin >= emid) { write_xpm(out, 0, label, "Energy (kJ/mol)", @@ -492,7 +492,7 @@ int gmx_enemat(int argc, char *argv[]) ngroups, ngroups, groupnr, groupnr, emat[m], emin, emid, emax, rlo, rmid, rhi, &nlevels); } - ffclose(out); + gmx_ffclose(out); } } } @@ -566,7 +566,7 @@ int gmx_enemat(int argc, char *argv[]) } fprintf(out, "\n"); } - ffclose(out); + gmx_ffclose(out); } else { @@ -584,7 +584,7 @@ int gmx_enemat(int argc, char *argv[]) write_matrix(out,ngroups,1,ngroups,groupnr,emat,label,emin,emax,nlevels); n++; } - ffclose(out); + gmx_ffclose(out); */ } close_enx(in); diff --git a/src/gromacs/gmxana/gmx_energy.c b/src/gromacs/gmxana/gmx_energy.c index 6ea86f1080..f1ca2c16ed 100644 --- a/src/gromacs/gmxana/gmx_energy.c +++ b/src/gromacs/gmxana/gmx_energy.c @@ -560,7 +560,7 @@ static void analyse_disre(const char *voutfn, int nframes, fprintf(vout, "%10d %10.5e\n", j, mypow(violaver[j]/nframes, minthird)); } #endif - ffclose(vout); + gmx_ffclose(vout); fprintf(stdout, "\nSum of violations averaged over simulation: %g nm\n", sumt); @@ -629,8 +629,8 @@ static void einstein_visco(const char *fn, const char *fni, int nsets, } fprintf(fp1, "\n"); } - ffclose(fp0); - ffclose(fp1); + gmx_ffclose(fp0); + gmx_ffclose(fp1); } typedef struct { @@ -1414,7 +1414,7 @@ static void analyse_ener(gmx_bool bCorr, const char *corrfn, intBulk += 0.5*(eneset[11][i-1] + eneset[11][i])*factor; fprintf(fp, "%10g %10g %10g\n", (i*Dt), integral, intBulk); } - ffclose(fp); + gmx_ffclose(fp); } else if (bCorr) { @@ -1571,7 +1571,7 @@ static void fec(const char *ene2fn, const char *runavgfn, } if (fp) { - ffclose(fp); + gmx_ffclose(fp); } sfree(fr); } @@ -2697,21 +2697,21 @@ int gmx_energy(int argc, char *argv[]) close_enx(fp); if (out) { - ffclose(out); + gmx_ffclose(out); } if (bDRAll) { - ffclose(fp_pairs); + gmx_ffclose(fp_pairs); } if (bORT) { - ffclose(fort); + gmx_ffclose(fort); } if (bODT) { - ffclose(fodt); + gmx_ffclose(fodt); } if (bORA) { @@ -2726,7 +2726,7 @@ int gmx_energy(int argc, char *argv[]) { fprintf(out, "%5d %g\n", or_label[i], orient[i]/norfr); } - ffclose(out); + gmx_ffclose(out); } if (bODA) { @@ -2741,7 +2741,7 @@ int gmx_energy(int argc, char *argv[]) { fprintf(out, "%5d %g\n", or_label[i], orient[i]/norfr-oobs[i]); } - ffclose(out); + gmx_ffclose(out); } if (bODR) { @@ -2756,11 +2756,11 @@ int gmx_energy(int argc, char *argv[]) { fprintf(out, "%5d %g\n", or_label[i], sqrt(odrms[i]/norfr)); } - ffclose(out); + gmx_ffclose(out); } if (bOTEN) { - ffclose(foten); + gmx_ffclose(foten); } if (bDisRe) @@ -2772,7 +2772,7 @@ int gmx_energy(int argc, char *argv[]) { if (fp_dhdl) { - ffclose(fp_dhdl); + gmx_ffclose(fp_dhdl); printf("\n\nWrote %d lambda values with %d samples as ", dh_lambdas, dh_samples); if (dh_hists > 0) diff --git a/src/gromacs/gmxana/gmx_genion.c b/src/gromacs/gmxana/gmx_genion.c index 8526f25472..e6f7011bcf 100644 --- a/src/gromacs/gmxana/gmx_genion.c +++ b/src/gromacs/gmxana/gmx_genion.c @@ -243,8 +243,8 @@ static void update_topol(const char *topinout, int p_num, int n_num, gmx_bool bMolecules; printf("\nProcessing topology\n"); - fpin = ffopen(topinout, "r"); - fpout = ffopen(TEMP_FILENM, "w"); + fpin = gmx_ffopen(topinout, "r"); + fpout = gmx_ffopen(TEMP_FILENM, "w"); line = 0; bMolecules = FALSE; @@ -296,16 +296,16 @@ static void update_topol(const char *topinout, int p_num, int n_num, nmol_line++; } } - ffclose(fpin); + gmx_ffclose(fpin); if (sol_line == -1) { - ffclose(fpout); + gmx_ffclose(fpout); gmx_fatal(FARGS, "No line with moleculetype '%s' found the [ molecules ] section of file '%s'", grpname, topinout); } if (nsol_last < p_num+n_num) { - ffclose(fpout); + gmx_ffclose(fpout); gmx_fatal(FARGS, "The last entry for moleculetype '%s' in the [ molecules ] section of file '%s' has less solvent molecules (%d) than were replaced (%d)", grpname, topinout, nsol_last, p_num+n_num); } @@ -336,10 +336,10 @@ static void update_topol(const char *topinout, int p_num, int n_num, } } } - ffclose(fpout); - /* use ffopen to generate backup of topinout */ - fpout = ffopen(topinout, "w"); - ffclose(fpout); + gmx_ffclose(fpout); + /* use gmx_ffopen to generate backup of topinout */ + fpout = gmx_ffopen(topinout, "w"); + gmx_ffclose(fpout); rename(TEMP_FILENM, topinout); #undef TEMP_FILENM } diff --git a/src/gromacs/gmxana/gmx_genpr.c b/src/gromacs/gmxana/gmx_genpr.c index 81aafc9df8..bb56226e0b 100644 --- a/src/gromacs/gmxana/gmx_genpr.c +++ b/src/gromacs/gmxana/gmx_genpr.c @@ -183,7 +183,7 @@ int gmx_genpr(int argc, char *argv[]) fprintf(out, "%d\n", i+1); } } - ffclose(out); + gmx_ffclose(out); } else if ((bDisre || bConstr) && x) { @@ -236,7 +236,7 @@ int gmx_genpr(int argc, char *argv[]) } } } - ffclose(out); + gmx_ffclose(out); } else { @@ -252,7 +252,7 @@ int gmx_genpr(int argc, char *argv[]) fprintf(out, "%4d %4d %10g %10g %10g\n", ind_grp[i]+1, 1, fc[XX], fc[YY], fc[ZZ]); } - ffclose(out); + gmx_ffclose(out); } if (xfn) { diff --git a/src/gromacs/gmxana/gmx_gyrate.c b/src/gromacs/gmxana/gmx_gyrate.c index ed062dffaf..dca936d1c0 100644 --- a/src/gromacs/gmxana/gmx_gyrate.c +++ b/src/gromacs/gmxana/gmx_gyrate.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -379,7 +379,7 @@ int gmx_gyrate(int argc, char *argv[]) gmx_rmpbc_done(gpbc); } - ffclose(out); + gmx_ffclose(out); if (bACF) { diff --git a/src/gromacs/gmxana/gmx_h2order.c b/src/gromacs/gmxana/gmx_h2order.c index 4a186c5644..17a0bf5abc 100644 --- a/src/gromacs/gmxana/gmx_h2order.c +++ b/src/gromacs/gmxana/gmx_h2order.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -257,7 +257,7 @@ void h2order_plot(rvec dipole[], real order[], const char *afile, factor*dipole[slice][ZZ], order[slice]); } - ffclose(ord); + gmx_ffclose(ord); } int gmx_h2order(int argc, char *argv[]) diff --git a/src/gromacs/gmxana/gmx_hbond.c b/src/gromacs/gmxana/gmx_hbond.c index 90cc05ab44..03b904c54e 100644 --- a/src/gromacs/gmxana/gmx_hbond.c +++ b/src/gromacs/gmxana/gmx_hbond.c @@ -2229,7 +2229,7 @@ static void do_hblife(const char *fn, t_hbdata *hb, gmx_bool bMerge, gmx_bool bC integral += x1; } integral *= dt; - ffclose(fp); + gmx_ffclose(fp); printf("%s lifetime = %.2f ps\n", bContact ? "Contact" : "HB", integral); printf("Note that the lifetime obtained in this manner is close to useless\n"); printf("Use the -ac option instead and check the Forward lifetime\n"); @@ -2253,7 +2253,7 @@ static void dump_ac(t_hbdata *hb, gmx_bool oneHB, int nDump) { return; } - fp = ffopen("debug-ac.xvg", "w"); + fp = gmx_ffopen("debug-ac.xvg", "w"); for (j = 0; (j < nframes); j++) { fprintf(fp, "%10.3f", hb->time[j]); @@ -2293,7 +2293,7 @@ static void dump_ac(t_hbdata *hb, gmx_bool oneHB, int nDump) } fprintf(fp, "\n"); } - ffclose(fp); + gmx_ffclose(fp); } static real calc_dg(real tau, real temp) @@ -3415,7 +3415,7 @@ static void do_hbac(const char *fn, t_hbdata *hb, fprintf(fp, "%10g %10g %10g %10g %10g\n", hb->time[j]-hb->time[0], ct[j], cct[j], ght[j], kt[j]); } - ffclose(fp); + gmx_ffclose(fp); analyse_corr(nn, hb->time, ct, ght, kt, NULL, NULL, NULL, fit_start, temp, smooth_tail_start, oenv); @@ -3521,7 +3521,7 @@ static void dump_hbmap(t_hbdata *hb, fp = opt2FILE("-hbn", nfile, fnm, "w"); if (opt2bSet("-g", nfile, fnm)) { - fplog = ffopen(opt2fn("-g", nfile, fnm), "w"); + fplog = gmx_ffopen(opt2fn("-g", nfile, fnm), "w"); fprintf(fplog, "# %10s %12s %12s\n", "Donor", "Hydrogen", "Acceptor"); } else @@ -3614,10 +3614,10 @@ static void dump_hbmap(t_hbdata *hb, } } } - ffclose(fp); + gmx_ffclose(fp); if (fplog) { - ffclose(fplog); + gmx_ffclose(fplog); } } @@ -4595,7 +4595,7 @@ int gmx_hbond(int argc, char *argv[]) close_trj(status); if (fpnhb) { - ffclose(fpnhb); + gmx_ffclose(fpnhb); } /* Compute maximum possible number of different hbonds */ @@ -4661,7 +4661,7 @@ int gmx_hbond(int argc, char *argv[]) aver_nhb += hb->nhb[i]; aver_dist += hb->ndist[i]; } - ffclose(fp); + gmx_ffclose(fp); aver_nhb /= nframes; aver_dist /= nframes; /* Print HB distance distribution */ @@ -4684,7 +4684,7 @@ int gmx_hbond(int argc, char *argv[]) { fprintf(fp, "%10g %10g\n", (i+0.5)*rbin, rdist[i]/(rbin*(real)sum)); } - ffclose(fp); + gmx_ffclose(fp); } /* Print HB angle distribution */ @@ -4705,7 +4705,7 @@ int gmx_hbond(int argc, char *argv[]) { fprintf(fp, "%10g %10g\n", (i+0.5)*abin, adist[i]/(abin*(real)sum)); } - ffclose(fp); + gmx_ffclose(fp); } /* Print HB in alpha-helix */ @@ -4723,7 +4723,7 @@ int gmx_hbond(int argc, char *argv[]) } fprintf(fp, "\n"); } - ffclose(fp); + gmx_ffclose(fp); } if (!bNN) { @@ -4834,7 +4834,7 @@ int gmx_hbond(int argc, char *argv[]) } fp = opt2FILE("-hbm", NFILE, fnm, "w"); write_xpm_m(fp, mat); - ffclose(fp); + gmx_ffclose(fp); for (x = 0; x < mat.nx; x++) { sfree(mat.matrix[x]); @@ -4919,7 +4919,7 @@ int gmx_hbond(int argc, char *argv[]) } fprintf(fp, "\n"); } - ffclose(fp); + gmx_ffclose(fp); } return 0; diff --git a/src/gromacs/gmxana/gmx_helix.c b/src/gromacs/gmxana/gmx_helix.c index e3d8bfcec6..a16875c31d 100644 --- a/src/gromacs/gmxana/gmx_helix.c +++ b/src/gromacs/gmxana/gmx_helix.c @@ -205,7 +205,7 @@ int gmx_helix(int argc, char *argv[]) { sprintf(buf, "%s.out", xf[i].filenm); remove(buf); - xf[i].fp2 = ffopen(buf, "w"); + xf[i].fp2 = gmx_ffopen(buf, "w"); } } @@ -293,10 +293,10 @@ int gmx_helix(int argc, char *argv[]) for (i = 0; (i < efhNR); i++) { - ffclose(xf[i].fp); + gmx_ffclose(xf[i].fp); if (xf[i].bfp2) { - ffclose(xf[i].fp2); + gmx_ffclose(xf[i].fp2); } do_view(oenv, xf[i].filenm, "-nxy"); } diff --git a/src/gromacs/gmxana/gmx_helixorient.c b/src/gromacs/gmxana/gmx_helixorient.c index 29a44bb1a9..15334083a1 100644 --- a/src/gromacs/gmxana/gmx_helixorient.c +++ b/src/gromacs/gmxana/gmx_helixorient.c @@ -223,16 +223,16 @@ int gmx_helixorient(int argc, char *argv[]) natoms = read_first_x(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &t, &x, box); - fpaxis = ffopen(opt2fn("-oaxis", NFILE, fnm), "w"); - fpcenter = ffopen(opt2fn("-ocenter", NFILE, fnm), "w"); - fprise = ffopen(opt2fn("-orise", NFILE, fnm), "w"); - fpradius = ffopen(opt2fn("-oradius", NFILE, fnm), "w"); - fptwist = ffopen(opt2fn("-otwist", NFILE, fnm), "w"); - fpbending = ffopen(opt2fn("-obending", NFILE, fnm), "w"); + fpaxis = gmx_ffopen(opt2fn("-oaxis", NFILE, fnm), "w"); + fpcenter = gmx_ffopen(opt2fn("-ocenter", NFILE, fnm), "w"); + fprise = gmx_ffopen(opt2fn("-orise", NFILE, fnm), "w"); + fpradius = gmx_ffopen(opt2fn("-oradius", NFILE, fnm), "w"); + fptwist = gmx_ffopen(opt2fn("-otwist", NFILE, fnm), "w"); + fpbending = gmx_ffopen(opt2fn("-obending", NFILE, fnm), "w"); - fptheta1 = ffopen("theta1.xvg", "w"); - fptheta2 = ffopen("theta2.xvg", "w"); - fptheta3 = ffopen("theta3.xvg", "w"); + fptheta1 = gmx_ffopen("theta1.xvg", "w"); + fptheta2 = gmx_ffopen("theta2.xvg", "w"); + fptheta3 = gmx_ffopen("theta3.xvg", "w"); if (bIncremental) { @@ -513,17 +513,17 @@ int gmx_helixorient(int argc, char *argv[]) gmx_rmpbc_done(gpbc); - ffclose(fpaxis); - ffclose(fpcenter); - ffclose(fptilt); - ffclose(fprotation); - ffclose(fprise); - ffclose(fpradius); - ffclose(fptwist); - ffclose(fpbending); - ffclose(fptheta1); - ffclose(fptheta2); - ffclose(fptheta3); + gmx_ffclose(fpaxis); + gmx_ffclose(fpcenter); + gmx_ffclose(fptilt); + gmx_ffclose(fprotation); + gmx_ffclose(fprise); + gmx_ffclose(fpradius); + gmx_ffclose(fptwist); + gmx_ffclose(fpbending); + gmx_ffclose(fptheta1); + gmx_ffclose(fptheta2); + gmx_ffclose(fptheta3); close_trj(status); diff --git a/src/gromacs/gmxana/gmx_hydorder.c b/src/gromacs/gmxana/gmx_hydorder.c index bd093427b7..6a58d32e8d 100644 --- a/src/gromacs/gmxana/gmx_hydorder.c +++ b/src/gromacs/gmxana/gmx_hydorder.c @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -505,8 +505,8 @@ static void writesurftoxpms(real ***surf, int tblocks, int xbins, int ybins, rea yticks[j] += bw; } - xpmfile1 = ffopen(outfiles[0], "w"); - xpmfile2 = ffopen(outfiles[1], "w"); + xpmfile1 = gmx_ffopen(outfiles[0], "w"); + xpmfile2 = gmx_ffopen(outfiles[1], "w"); max1 = max2 = 0.0; min1 = min2 = 1000.00; @@ -545,8 +545,8 @@ static void writesurftoxpms(real ***surf, int tblocks, int xbins, int ybins, rea write_xpm(xpmfile2, 3, numbuf, "Height", "x[nm]", "y[nm]", xbins, ybins, xticks, yticks, profile2, min2, max2, lo, hi, &maplevels); } - ffclose(xpmfile1); - ffclose(xpmfile2); + gmx_ffclose(xpmfile1); + gmx_ffclose(xpmfile2); @@ -562,8 +562,8 @@ static void writeraw(real ***surf, int tblocks, int xbins, int ybins, char **fnm FILE *raw1, *raw2; int i, j, n; - raw1 = ffopen(fnms[0], "w"); - raw2 = ffopen(fnms[1], "w"); + raw1 = gmx_ffopen(fnms[0], "w"); + raw2 = gmx_ffopen(fnms[1], "w"); fprintf(raw1, "#Legend\n#TBlock\n#Xbin Ybin Z t\n"); fprintf(raw2, "#Legend\n#TBlock\n#Xbin Ybin Z t\n"); for (n = 0; n < tblocks; n++) @@ -580,8 +580,8 @@ static void writeraw(real ***surf, int tblocks, int xbins, int ybins, char **fnm } } - ffclose(raw1); - ffclose(raw2); + gmx_ffclose(raw1); + gmx_ffclose(raw2); } diff --git a/src/gromacs/gmxana/gmx_kinetics.c b/src/gromacs/gmxana/gmx_kinetics.c index fabada34e5..aae29b9ca8 100644 --- a/src/gromacs/gmxana/gmx_kinetics.c +++ b/src/gromacs/gmxana/gmx_kinetics.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -725,7 +725,7 @@ static void dump_remd_parameters(FILE *gp, t_remd_data *d, const char *fn, (d->sumft[i]-d->sumfct[i])*norm); } } - ffclose(fp); + gmx_ffclose(fp); } if (!d->bSum && rfn) { @@ -751,7 +751,7 @@ static void dump_remd_parameters(FILE *gp, t_remd_data *d, const char *fn, fprintf(fp, "\n"); } } - ffclose(fp); + gmx_ffclose(fp); } if (fn2 && (d->nstate > 2)) @@ -768,7 +768,7 @@ static void dump_remd_parameters(FILE *gp, t_remd_data *d, const char *fn, (d->sumit[i]-d->sumict[i])*norm); } } - ffclose(fp); + gmx_ffclose(fp); } if (mfn) { @@ -784,7 +784,7 @@ static void dump_remd_parameters(FILE *gp, t_remd_data *d, const char *fn, DG = BOLTZ*i*log(fff/(1-fff)); fprintf(fp, "%5d %8.3f %8.3f\n", i, fff, DG); } - ffclose(fp); + gmx_ffclose(fp); } } @@ -816,7 +816,7 @@ static void dump_remd_parameters(FILE *gp, t_remd_data *d, const char *fn, } fprintf(hp, "&\n"); } - ffclose(hp); + gmx_ffclose(hp); for (i = 0; (i < d->nparams); i++) { d->params[i] = params[i]; @@ -960,7 +960,7 @@ int gmx_kinetics(int argc, char *argv[]) dfile = opt2fn("-d", NFILE, fnm); dfile2 = opt2fn_null("-d2", NFILE, fnm); - fp = ffopen(opt2fn("-g", NFILE, fnm), "w"); + fp = gmx_ffopen(opt2fn("-g", NFILE, fnm), "w"); remd.temp = read_xvg_time(tfile, bHaveT, opt2parg_bSet("-b", NPA, pa), tb, @@ -1069,7 +1069,7 @@ int gmx_kinetics(int argc, char *argv[]) optimize_remd_parameters(&remd, maxiter, tol); dump_remd_parameters(fp, &remd, "test1.xvg", NULL, NULL, NULL, NULL, skip, tref, oenv); } - ffclose(fp); + gmx_ffclose(fp); view_all(oenv, NFILE, fnm); diff --git a/src/gromacs/gmxana/gmx_lie.c b/src/gromacs/gmxana/gmx_lie.c index de5fcf672f..f838c87fbd 100644 --- a/src/gromacs/gmxana/gmx_lie.c +++ b/src/gromacs/gmxana/gmx_lie.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -205,7 +205,7 @@ int gmx_lie(int argc, char *argv[]) } } close_enx(fp); - ffclose(out); + gmx_ffclose(out); fprintf(stderr, "\n"); if (nframes > 0) diff --git a/src/gromacs/gmxana/gmx_make_edi.c b/src/gromacs/gmxana/gmx_make_edi.c index a732f1e04b..d1c5f5eb5f 100644 --- a/src/gromacs/gmxana/gmx_make_edi.c +++ b/src/gromacs/gmxana/gmx_make_edi.c @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -983,7 +983,7 @@ int gmx_make_edi(int argc, char *argv[]) } /* Write edi-file */ - write_the_whole_thing(ffopen(EdiFile, "w"), &edi_params, eigvec1, nvec1, listen, evStepList); + write_the_whole_thing(gmx_ffopen(EdiFile, "w"), &edi_params, eigvec1, nvec1, listen, evStepList); return 0; } diff --git a/src/gromacs/gmxana/gmx_mdmat.c b/src/gromacs/gmxana/gmx_mdmat.c index aa710c68d6..43a9f0d21d 100644 --- a/src/gromacs/gmxana/gmx_mdmat.c +++ b/src/gromacs/gmxana/gmx_mdmat.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -350,7 +350,7 @@ int gmx_mdmat(int argc, char *argv[]) gmx_rmpbc_done(gpbc); if (bFrames) { - ffclose(out); + gmx_ffclose(out); } fprintf(stderr, "Processed %d frames\n", nframes); @@ -395,7 +395,7 @@ int gmx_mdmat(int argc, char *argv[]) fprintf(fp, "%3d %8.3f %3d %8.3f %3d %8.3f\n", i+1, ratio, tot_n[i], mean_n[i], natm[i], mean_n[i]/natm[i]); } - ffclose(fp); + gmx_ffclose(fp); } return 0; diff --git a/src/gromacs/gmxana/gmx_mindist.c b/src/gromacs/gmxana/gmx_mindist.c index 39caf539eb..c7cec72b86 100644 --- a/src/gromacs/gmxana/gmx_mindist.c +++ b/src/gromacs/gmxana/gmx_mindist.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -185,7 +185,7 @@ static void periodic_mindist_plot(const char *trxfn, const char *outfn, gmx_rmpbc_done(gpbc); } - ffclose(out); + gmx_ffclose(out); fprintf(stdout, "\nThe shortest periodic distance is %g (nm) at time %g (%s),\n" @@ -336,7 +336,7 @@ void dist_plot(const char *fn, const char *afile, const char *dfile, dist = xvgropen(dfile, buf, output_env_get_time_label(oenv), "Distance (nm)", oenv); sprintf(buf, "Number of Contacts %s %g nm", bMin ? "<" : ">", rcut); num = nfile ? xvgropen(nfile, buf, output_env_get_time_label(oenv), "Number", oenv) : NULL; - atm = afile ? ffopen(afile, "w") : NULL; + atm = afile ? gmx_ffopen(afile, "w") : NULL; trxout = xfile ? open_trx(xfile, "w") : NULL; if (bMat) @@ -534,14 +534,14 @@ void dist_plot(const char *fn, const char *afile, const char *dfile, while (read_next_x(oenv, status, &t, x0, box)); close_trj(status); - ffclose(dist); + gmx_ffclose(dist); if (num) { - ffclose(num); + gmx_ffclose(num); } if (atm) { - ffclose(atm); + gmx_ffclose(atm); } if (trxout) { diff --git a/src/gromacs/gmxana/gmx_mk_angndx.c b/src/gromacs/gmxana/gmx_mk_angndx.c index 09f7018980..98c7d058af 100644 --- a/src/gromacs/gmxana/gmx_mk_angndx.c +++ b/src/gromacs/gmxana/gmx_mk_angndx.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2013, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -305,7 +305,7 @@ int gmx_mk_angndx(int argc, char *argv[]) fprintf(out, "\n"); } } - ffclose(out); + gmx_ffclose(out); return 0; } diff --git a/src/gromacs/gmxana/gmx_morph.c b/src/gromacs/gmxana/gmx_morph.c index 2a6da609bb..fc452a9613 100644 --- a/src/gromacs/gmxana/gmx_morph.c +++ b/src/gromacs/gmxana/gmx_morph.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -198,7 +198,7 @@ int gmx_morph(int argc, char *argv[]) if (bRMS) { - ffclose(fp); + gmx_ffclose(fp); do_view(oenv, opt2fn("-or", NFILE, fnm), "-nxy"); } diff --git a/src/gromacs/gmxana/gmx_msd.c b/src/gromacs/gmxana/gmx_msd.c index bbb6c6c36a..c50daab370 100644 --- a/src/gromacs/gmxana/gmx_msd.c +++ b/src/gromacs/gmxana/gmx_msd.c @@ -216,7 +216,7 @@ static void corr_print(t_corr *curr, gmx_bool bTen, const char *fn, const char * } fprintf(out, "\n"); } - ffclose(out); + gmx_ffclose(out); } /* called from corr_loop, to do the main calculations */ @@ -610,7 +610,7 @@ void printmol(t_corr *curr, const char *fn, } } } - ffclose(out); + gmx_ffclose(out); do_view(oenv, fn, "-graphtype bar"); /* Compute variance, stddev and error */ diff --git a/src/gromacs/gmxana/gmx_nmeig.c b/src/gromacs/gmxana/gmx_nmeig.c index ed2be1ace0..597377aec0 100644 --- a/src/gromacs/gmxana/gmx_nmeig.c +++ b/src/gromacs/gmxana/gmx_nmeig.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -496,7 +496,7 @@ int gmx_nmeig(int argc, char *argv[]) { fprintf (out, "%6d %15g\n", begin+i, eigenvalues[i]); } - ffclose(out); + gmx_ffclose(out); if (opt2bSet("-qc", NFILE, fnm)) @@ -585,14 +585,14 @@ int gmx_nmeig(int argc, char *argv[]) qutot += qu; } } - ffclose(out); + gmx_ffclose(out); if (NULL != spec) { for (j = 0; (j < maxspec); j++) { fprintf(spec, "%10g %10g\n", 1.0*j, spectrum[j]); } - ffclose(spec); + gmx_ffclose(spec); } if (NULL != qc) { @@ -602,7 +602,7 @@ int gmx_nmeig(int argc, char *argv[]) nharm, nvsite); printf("Total correction to cV = %g J/mol K\n", qcvtot); printf("Total correction to H = %g kJ/mol\n", qutot); - ffclose(qc); + gmx_ffclose(qc); please_cite(stdout, "Caleman2011b"); } /* Writing eigenvectors. Note that if mass scaling was used, the eigenvectors diff --git a/src/gromacs/gmxana/gmx_order.c b/src/gromacs/gmxana/gmx_order.c index ecb42bccfd..52db66114c 100644 --- a/src/gromacs/gmxana/gmx_order.c +++ b/src/gromacs/gmxana/gmx_order.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -327,8 +327,8 @@ static void calc_tetra_order_parm(const char *fnNDX, const char *fnTPS, sfree(index); sfree(isize); - ffclose(fpsg); - ffclose(fpsk); + gmx_ffclose(fpsg); + gmx_ffclose(fpsk); fpsg = xvgropen(sgslfn, "S\\sg\\N Angle Order Parameter / Slab", "(nm)", "S\\sg\\N", @@ -343,8 +343,8 @@ static void calc_tetra_order_parm(const char *fnNDX, const char *fnTPS, fprintf(fpsk, "%10g %10g\n", (i+0.5)*box[slice_dim][slice_dim]/nslice, sk_slice_tot[i]/nframes); } - ffclose(fpsg); - ffclose(fpsk); + gmx_ffclose(fpsg); + gmx_ffclose(fpsk); } @@ -832,8 +832,8 @@ void order_plot(rvec order[], real *slOrder[], const char *afile, const char *bf 0.333 * order[atom][YY])); } - ffclose(ord); - ffclose(slOrd); + gmx_ffclose(ord); + gmx_ffclose(slOrd); } } diff --git a/src/gromacs/gmxana/gmx_polystat.c b/src/gromacs/gmxana/gmx_polystat.c index 66c3887a46..ef69e3b480 100644 --- a/src/gromacs/gmxana/gmx_polystat.c +++ b/src/gromacs/gmxana/gmx_polystat.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -468,14 +468,14 @@ int gmx_polystat(int argc, char *argv[]) close_trx(status); - ffclose(out); + gmx_ffclose(out); if (outv) { - ffclose(outv); + gmx_ffclose(outv); } if (outp) { - ffclose(outp); + gmx_ffclose(outp); } sum_eed2_tot /= frame; @@ -515,7 +515,7 @@ int gmx_polystat(int argc, char *argv[]) { fprintf(outi, "%d %8.4f\n", i+1, intd[i]); } - ffclose(outi); + gmx_ffclose(outi); } do_view(oenv, opt2fn("-o", NFILE, fnm), "-nxy"); diff --git a/src/gromacs/gmxana/gmx_potential.c b/src/gromacs/gmxana/gmx_potential.c index 88fdfa31a1..3ccb728231 100644 --- a/src/gromacs/gmxana/gmx_potential.c +++ b/src/gromacs/gmxana/gmx_potential.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -400,9 +400,9 @@ void plot_potential(double *potential[], double *charge[], double *field[], fprintf(fie, "\n"); } - ffclose(pot); - ffclose(cha); - ffclose(fie); + gmx_ffclose(pot); + gmx_ffclose(cha); + gmx_ffclose(fie); } int gmx_potential(int argc, char *argv[]) diff --git a/src/gromacs/gmxana/gmx_principal.c b/src/gromacs/gmxana/gmx_principal.c index ae1c6d35f9..7fe4c3c5b1 100644 --- a/src/gromacs/gmxana/gmx_principal.c +++ b/src/gromacs/gmxana/gmx_principal.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -124,10 +124,10 @@ int gmx_principal(int argc, char *argv[]) return 0; } - axis1 = ffopen(opt2fn("-a1", NFILE, fnm), "w"); - axis2 = ffopen(opt2fn("-a2", NFILE, fnm), "w"); - axis3 = ffopen(opt2fn("-a3", NFILE, fnm), "w"); - fmoi = ffopen(opt2fn("-om", NFILE, fnm), "w"); + axis1 = gmx_ffopen(opt2fn("-a1", NFILE, fnm), "w"); + axis2 = gmx_ffopen(opt2fn("-a2", NFILE, fnm), "w"); + axis3 = gmx_ffopen(opt2fn("-a3", NFILE, fnm), "w"); + fmoi = gmx_ffopen(opt2fn("-om", NFILE, fnm), "w"); read_tps_conf(ftp2fn(efTPS, NFILE, fnm), title, &top, &ePBC, NULL, NULL, box, TRUE); @@ -154,10 +154,10 @@ int gmx_principal(int argc, char *argv[]) close_trj(status); - ffclose(axis1); - ffclose(axis2); - ffclose(axis3); - ffclose(fmoi); + gmx_ffclose(axis1); + gmx_ffclose(axis2); + gmx_ffclose(axis3); + gmx_ffclose(fmoi); return 0; } diff --git a/src/gromacs/gmxana/gmx_rama.c b/src/gromacs/gmxana/gmx_rama.c index 3a86410ab2..8e2a74d0c7 100644 --- a/src/gromacs/gmxana/gmx_rama.c +++ b/src/gromacs/gmxana/gmx_rama.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -114,7 +114,7 @@ int gmx_rama(int argc, char *argv[]) } while (new_data(xr)); fprintf(stderr, "\n"); - ffclose(out); + gmx_ffclose(out); do_view(oenv, ftp2fn(efXVG, NFILE, fnm), NULL); diff --git a/src/gromacs/gmxana/gmx_rdf.c b/src/gromacs/gmxana/gmx_rdf.c index 0d2c80fa02..cfb64050bc 100644 --- a/src/gromacs/gmxana/gmx_rdf.c +++ b/src/gromacs/gmxana/gmx_rdf.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -742,7 +742,7 @@ static void do_rdf(const char *fnNDX, const char *fnTPS, const char *fnTRX, } fprintf(fp, "\n"); } - ffclose(fp); + gmx_ffclose(fp); do_view(oenv, fnRDF, NULL); @@ -773,7 +773,7 @@ static void do_rdf(const char *fnNDX, const char *fnTPS, const char *fnTRX, { fprintf(fp, "%10g %10g\n", i*0.5, hq[i]); } - ffclose(fp); + gmx_ffclose(fp); do_view(oenv, fnHQ, NULL); sfree(hq); sfree(integrand); @@ -812,7 +812,7 @@ static void do_rdf(const char *fnNDX, const char *fnTPS, const char *fnTRX, } fprintf(fp, "\n"); } - ffclose(fp); + gmx_ffclose(fp); sfree(sum); do_view(oenv, fnCNRDF, NULL); diff --git a/src/gromacs/gmxana/gmx_rms.c b/src/gromacs/gmxana/gmx_rms.c index 0670e75607..d75becc4fb 100644 --- a/src/gromacs/gmxana/gmx_rms.c +++ b/src/gromacs/gmxana/gmx_rms.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -1064,11 +1064,11 @@ int gmx_rms(int argc, char *argv[]) del_yaxis[i] = delta_maxy*i/del_lev; } sprintf(buf, "%s %s vs. delta t", gn_rms[0], whatname[ewhat]); - fp = ffopen("delta.xpm", "w"); + fp = gmx_ffopen("delta.xpm", "w"); write_xpm(fp, 0, buf, "density", output_env_get_time_label(oenv), whatlabel[ewhat], delta_xsize, del_lev+1, del_xaxis, del_yaxis, delta, 0.0, delta_max, rlo, rhi, &nlevels); - ffclose(fp); + gmx_ffclose(fp); } if (opt2bSet("-bin", NFILE, fnm)) { @@ -1081,7 +1081,7 @@ int gmx_rms(int argc, char *argv[]) gmx_fatal(FARGS, "Error writing to output file"); } } - ffclose(fp); + gmx_ffclose(fp); } } if (bBond) @@ -1151,7 +1151,7 @@ int gmx_rms(int argc, char *argv[]) } fprintf(fp, "\n"); } - ffclose(fp); + gmx_ffclose(fp); if (bMirror) { @@ -1189,7 +1189,7 @@ int gmx_rms(int argc, char *argv[]) } fprintf(fp, "\n"); } - ffclose(fp); + gmx_ffclose(fp); } if (bAv) @@ -1201,7 +1201,7 @@ int gmx_rms(int argc, char *argv[]) { fprintf(fp, "%10d %10g\n", j, rlstot/teller); } - ffclose(fp); + gmx_ffclose(fp); } if (bNorm) @@ -1211,7 +1211,7 @@ int gmx_rms(int argc, char *argv[]) { fprintf(fp, "%10d %10g\n", j, rlsnorm[j]/teller); } - ffclose(fp); + gmx_ffclose(fp); } do_view(oenv, opt2fn_null("-a", NFILE, fnm), "-graphtype bar"); do_view(oenv, opt2fn("-o", NFILE, fnm), NULL); diff --git a/src/gromacs/gmxana/gmx_rmsdist.c b/src/gromacs/gmxana/gmx_rmsdist.c index e34367b836..7de88c69a9 100644 --- a/src/gromacs/gmxana/gmx_rmsdist.c +++ b/src/gromacs/gmxana/gmx_rmsdist.c @@ -175,7 +175,7 @@ static int read_equiv(const char *eq_fn, t_equiv ***equivptr) int neq, na, n, resnr; t_equiv **equiv; - fp = ffopen(eq_fn, "r"); + fp = gmx_ffopen(eq_fn, "r"); neq = 0; equiv = NULL; while (get_a_line(fp, line, STRLEN)) @@ -214,7 +214,7 @@ static int read_equiv(const char *eq_fn, t_equiv ***equivptr) /* next */ neq++; } - ffclose(fp); + gmx_ffclose(fp); *equivptr = equiv; @@ -800,7 +800,7 @@ int gmx_rmsdist(int argc, char *argv[]) while (read_next_x(oenv, status, &t, x, box)); fprintf(stderr, "\n"); - ffclose(fp); + gmx_ffclose(fp); teller = nframes_read(status); diff --git a/src/gromacs/gmxana/gmx_rmsf.c b/src/gromacs/gmxana/gmx_rmsf.c index 7d52abe5d4..90249b1283 100644 --- a/src/gromacs/gmxana/gmx_rmsf.c +++ b/src/gromacs/gmxana/gmx_rmsf.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -106,7 +106,7 @@ void correlate_aniso(const char *fn, t_atoms *ref, t_atoms *calc, } } } - ffclose(fp); + gmx_ffclose(fp); } static void average_residues(double f[], double **U, int uind, @@ -469,9 +469,9 @@ int gmx_rmsf(int argc, char *argv[]) { fprintf(stdout, "\n"); print_dir(stdout, Uaver); - fp = ffopen(dirfn, "w"); + fp = gmx_ffopen(dirfn, "w"); print_dir(fp, Uaver); - ffclose(fp); + gmx_ffclose(fp); } for (i = 0; i < isize; i++) @@ -501,7 +501,7 @@ int gmx_rmsf(int argc, char *argv[]) pdb_bfac); } } - ffclose(fp); + gmx_ffclose(fp); } else { @@ -515,7 +515,7 @@ int gmx_rmsf(int argc, char *argv[]) bRes ? top.atoms.resinfo[top.atoms.atom[index[i]].resind].nr : index[i]+1, sqrt(rmsf[i])); } } - ffclose(fp); + gmx_ffclose(fp); } for (i = 0; i < isize; i++) @@ -544,7 +544,7 @@ int gmx_rmsf(int argc, char *argv[]) bRes ? top.atoms.resinfo[top.atoms.atom[index[i]].resind].nr : index[i]+1, sqrt(rmsf[i])); } } - ffclose(fp); + gmx_ffclose(fp); } if (opt2bSet("-oq", NFILE, fnm)) diff --git a/src/gromacs/gmxana/gmx_rotmat.c b/src/gromacs/gmxana/gmx_rotmat.c index a73eb49995..d323f1a0c4 100644 --- a/src/gromacs/gmxana/gmx_rotmat.c +++ b/src/gromacs/gmxana/gmx_rotmat.c @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2009,2010,2011,2012,2013, by the GROMACS development team, led by + * Copyright (c) 2009,2010,2011,2012,2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -309,7 +309,7 @@ int gmx_rotmat(int argc, char *argv[]) close_trj(status); - ffclose(out); + gmx_ffclose(out); do_view(oenv, ftp2fn(efXVG, NFILE, fnm), "-nxy"); diff --git a/src/gromacs/gmxana/gmx_saltbr.c b/src/gromacs/gmxana/gmx_saltbr.c index 3fac904139..a9cd92383d 100644 --- a/src/gromacs/gmxana/gmx_saltbr.c +++ b/src/gromacs/gmxana/gmx_saltbr.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -247,7 +247,7 @@ int gmx_saltbr(int argc, char *argv[]) { fprintf(fp, "%10g %10g\n", time[k], cgdist[i][j][k]); } - ffclose(fp); + gmx_ffclose(fp); } } } @@ -329,7 +329,7 @@ int gmx_saltbr(int argc, char *argv[]) } for (m = 0; (m < 3); m++) { - ffclose(out[m]); + gmx_ffclose(out[m]); if (nset[m] == 0) { remove(fn[m]); diff --git a/src/gromacs/gmxana/gmx_sas.c b/src/gromacs/gmxana/gmx_sas.c index 6715fa6e1d..64d0cfc303 100644 --- a/src/gromacs/gmxana/gmx_sas.c +++ b/src/gromacs/gmxana/gmx_sas.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2007, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -128,7 +128,7 @@ void do_conect(const char *fn, int n, rvec x[]) add_rec(c, j, i, d2); } } - fp = ffopen(fn, "a"); + fp = gmx_ffopen(fn, "a"); for (i = 0; (i < n); i++) { if ((c[i].aa == NO_ATID) || (c[i].ab == NO_ATID)) @@ -137,7 +137,7 @@ void do_conect(const char *fn, int n, rvec x[]) } fprintf(fp, "CONECT%5d%5d%5d\n", i+1, c[i].aa+1, c[i].ab+1); } - ffclose(fp); + gmx_ffclose(fp); sfree(c); } @@ -597,10 +597,10 @@ void sas_plot(int nfile, t_filenm fnm[], real solsize, int ndots, fprintf(stderr, "\n"); close_trj(status); - ffclose(fp); + gmx_ffclose(fp); if (vp) { - ffclose(vp); + gmx_ffclose(vp); } /* if necessary, print areas per atom to file too: */ @@ -659,9 +659,9 @@ void sas_plot(int nfile, t_filenm fnm[], real solsize, int ndots, } if (bITP) { - ffclose(fp3); + gmx_ffclose(fp3); } - ffclose(fp); + gmx_ffclose(fp); } /* Be a good citizen, keep our memory free! */ diff --git a/src/gromacs/gmxana/gmx_sham.c b/src/gromacs/gmxana/gmx_sham.c index 9cb4f84377..22545b9a5d 100644 --- a/src/gromacs/gmxana/gmx_sham.c +++ b/src/gromacs/gmxana/gmx_sham.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -101,7 +101,7 @@ static void lo_write_xplor(XplorMap * map, const char * file) FILE * fp; int z, i, j, n; - fp = ffopen(file, "w"); + fp = gmx_ffopen(file, "w"); /* The REMARKS part is the worst part of the XPLOR format * and may cause problems with some programs */ @@ -134,7 +134,7 @@ static void lo_write_xplor(XplorMap * map, const char * file) } } fprintf(fp, " -9999\n"); - ffclose(fp); + gmx_ffclose(fp); } static void write_xplor(const char *file, real *data, int *ibox, real dmin[], real dmax[]) @@ -277,7 +277,7 @@ static void pick_minima(const char *logfile, int *ibox, int ndim, int len, real snew(mm, len); nmin = 0; - fp = ffopen(logfile, "w"); + fp = gmx_ffopen(logfile, "w"); /* Loop over each element in the array of dimenion ndim seeking * minima with respect to every dimension. Specialized loops for * speed with ndim == 2 and ndim == 3. */ @@ -405,7 +405,7 @@ static void pick_minima(const char *logfile, int *ibox, int ndim, int len, real { print_minimum(fp, i, &mm[i]); } - ffclose(fp); + gmx_ffclose(fp); sfree(mm); } @@ -623,7 +623,7 @@ static void do_sham(const char *fn, const char *ndx, Smax = Emax-Smin; Sinf = Smax+1; /* Write out the free energy as a function of bin index */ - fp = ffopen(fn, "w"); + fp = gmx_ffopen(fn, "w"); for (i = 0; (i < len); i++) { if (P[i] != 0) @@ -639,7 +639,7 @@ static void do_sham(const char *fn, const char *ndx, S[i] = Sinf; } } - ffclose(fp); + gmx_ffclose(fp); /* Organize the structures in the bins */ snew(b, 1); snew(b->index, len+1); @@ -666,7 +666,7 @@ static void do_sham(const char *fn, const char *ndx, } */ /* Write the index file */ - fp = ffopen(ndx, "w"); + fp = gmx_ffopen(ndx, "w"); for (i = 0; (i < len); i++) { if (nbin[i] > 0) @@ -678,7 +678,7 @@ static void do_sham(const char *fn, const char *ndx, } } } - ffclose(fp); + gmx_ffclose(fp); snew(axis_x, ibox[0]+1); snew(axis_y, ibox[1]+1); snew(axis_z, ibox[2]+1); @@ -761,35 +761,35 @@ static void do_sham(const char *fn, const char *ndx, EE[i] = &(E[i*ibox[1]]); SS[i] = &(S[i*ibox[1]]); } - fp = ffopen(xpmP, "w"); + fp = gmx_ffopen(xpmP, "w"); write_xpm(fp, flags, "Probability Distribution", "", "PC1", "PC2", ibox[0], ibox[1], axis_x, axis_y, PP, 0, Pmax, rlo, rhi, &nlevels); - ffclose(fp); - fp = ffopen(xpm, "w"); + gmx_ffclose(fp); + fp = gmx_ffopen(xpm, "w"); write_xpm(fp, flags, "Gibbs Energy Landscape", "G (kJ/mol)", "PC1", "PC2", ibox[0], ibox[1], axis_x, axis_y, WW, 0, gmax, rlo, rhi, &nlevels); - ffclose(fp); - fp = ffopen(xpm2, "w"); + gmx_ffclose(fp); + fp = gmx_ffopen(xpm2, "w"); write_xpm(fp, flags, "Enthalpy Landscape", "H (kJ/mol)", "PC1", "PC2", ibox[0], ibox[1], axis_x, axis_y, EE, emin ? *emin : Emin, emax ? *emax : Einf, rlo, rhi, &nlevels); - ffclose(fp); - fp = ffopen(xpm3, "w"); + gmx_ffclose(fp); + fp = gmx_ffopen(xpm3, "w"); write_xpm(fp, flags, "Entropy Landscape", "TDS (kJ/mol)", "PC1", "PC2", ibox[0], ibox[1], axis_x, axis_y, SS, 0, Sinf, rlo, rhi, &nlevels); - ffclose(fp); + gmx_ffclose(fp); if (map) { - fp = ffopen(xpm4, "w"); + fp = gmx_ffopen(xpm4, "w"); write_xpm(fp, flags, "Custom Landscape", mname, "PC1", "PC2", ibox[0], ibox[1], axis_x, axis_y, MM, 0, Minf, rlo, rhi, &nlevels); - ffclose(fp); + gmx_ffclose(fp); } } else if (neig == 3) { /* Dump to PDB file */ - fp = ffopen(pdb, "w"); + fp = gmx_ffopen(pdb, "w"); for (i = 0; (i < ibox[0]); i++) { xxx[XX] = 3*(i+0.5-ibox[0]/2); @@ -809,7 +809,7 @@ static void do_sham(const char *fn, const char *ndx, } } } - ffclose(fp); + gmx_ffclose(fp); write_xplor("out.xplor", W, ibox, min_eig, max_eig); if (map) { @@ -829,10 +829,10 @@ static void do_sham(const char *fn, const char *ndx, snew(buf, strlen(xpm)+4); sprintf(buf, "%s", xpm); sprintf(&buf[strlen(xpm)-4], "12.xpm"); - fp = ffopen(buf, "w"); + fp = gmx_ffopen(buf, "w"); write_xpm(fp, flags, "Gibbs Energy Landscape", "W (kJ/mol)", "PC1", "PC2", ibox[0], ibox[1], axis_x, axis_y, WW, 0, gmax, rlo, rhi, &nlevels); - ffclose(fp); + gmx_ffclose(fp); for (i = 0; (i < ibox[0]); i++) { for (j = 0; (j < ibox[2]); j++) @@ -841,10 +841,10 @@ static void do_sham(const char *fn, const char *ndx, } } sprintf(&buf[strlen(xpm)-4], "13.xpm"); - fp = ffopen(buf, "w"); + fp = gmx_ffopen(buf, "w"); write_xpm(fp, flags, "SHAM Energy Landscape", "kJ/mol", "PC1", "PC3", ibox[0], ibox[2], axis_x, axis_z, WW, 0, gmax, rlo, rhi, &nlevels); - ffclose(fp); + gmx_ffclose(fp); for (i = 0; (i < ibox[1]); i++) { for (j = 0; (j < ibox[2]); j++) @@ -853,10 +853,10 @@ static void do_sham(const char *fn, const char *ndx, } } sprintf(&buf[strlen(xpm)-4], "23.xpm"); - fp = ffopen(buf, "w"); + fp = gmx_ffopen(buf, "w"); write_xpm(fp, flags, "SHAM Energy Landscape", "kJ/mol", "PC2", "PC3", ibox[1], ibox[2], axis_y, axis_z, WW, 0, gmax, rlo, rhi, &nlevels); - ffclose(fp); + gmx_ffclose(fp); sfree(buf); } if (map) @@ -920,7 +920,7 @@ static void ehisto(const char *fh, int n, real **enerT, const output_env_t oenv) } fprintf(fp, "\n"); } - ffclose(fp); + gmx_ffclose(fp); } int gmx_sham(int argc, char *argv[]) diff --git a/src/gromacs/gmxana/gmx_sigeps.c b/src/gromacs/gmxana/gmx_sigeps.c index 7fbb3d74e7..8a2b36050a 100644 --- a/src/gromacs/gmxana/gmx_sigeps.c +++ b/src/gromacs/gmxana/gmx_sigeps.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2012,2013, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -190,7 +190,7 @@ int gmx_sigeps(int argc, char *argv[]) oldx = x; } - ffclose(fp); + gmx_ffclose(fp); do_view(oenv, ftp2fn(efXVG, NFILE, fnm), NULL); diff --git a/src/gromacs/gmxana/gmx_sorient.c b/src/gromacs/gmxana/gmx_sorient.c index ee20a4907f..d967503099 100644 --- a/src/gromacs/gmxana/gmx_sorient.c +++ b/src/gromacs/gmxana/gmx_sorient.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -397,7 +397,7 @@ int gmx_sorient(int argc, char *argv[]) { fprintf(fp, "%g %g\n", (i+0.5)*binwidth-1, 2*normfac*hist1[i]); } - ffclose(fp); + gmx_ffclose(fp); sprintf(str, "Solvent normal orientation between %g and %g nm", rmin, rmax); fp = xvgropen(opt2fn("-no", NFILE, fnm), str, "cos(\\8q\\4\\s2\\N)", "", oenv); @@ -409,7 +409,7 @@ int gmx_sorient(int argc, char *argv[]) { fprintf(fp, "%g %g\n", (i+0.5)*binwidth, normfac*hist2[i]); } - ffclose(fp); + gmx_ffclose(fp); sprintf(str, "Solvent orientation"); @@ -425,7 +425,7 @@ int gmx_sorient(int argc, char *argv[]) histn[i] ? histi1[i]/histn[i] : 0, histn[i] ? histi2[i]/histn[i] : 0); } - ffclose(fp); + gmx_ffclose(fp); sprintf(str, "Cumulative solvent orientation"); fp = xvgropen(opt2fn("-co", NFILE, fnm), str, "r (nm)", "", oenv); @@ -444,7 +444,7 @@ int gmx_sorient(int argc, char *argv[]) c2 += histi2[i]*normfac; fprintf(fp, "%g %g %g\n", (i+1)*rbinw, c1, c2); } - ffclose(fp); + gmx_ffclose(fp); sprintf(str, "Solvent distribution"); fp = xvgropen(opt2fn("-rc", NFILE, fnm), str, "r (nm)", "molecules/nm", oenv); @@ -457,7 +457,7 @@ int gmx_sorient(int argc, char *argv[]) { fprintf(fp, "%g %g\n", (i+0.5)*rbinw, histn[i]*normfac); } - ffclose(fp); + gmx_ffclose(fp); do_view(oenv, opt2fn("-o", NFILE, fnm), NULL); do_view(oenv, opt2fn("-no", NFILE, fnm), NULL); diff --git a/src/gromacs/gmxana/gmx_spatial.c b/src/gromacs/gmxana/gmx_spatial.c index 78a64e4cf0..93354fa7d3 100644 --- a/src/gromacs/gmxana/gmx_spatial.c +++ b/src/gromacs/gmxana/gmx_spatial.c @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2007,2008,2009,2010,2011,2012,2013, by the GROMACS development team, led by + * Copyright (c) 2007,2008,2009,2010,2011,2012,2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -320,7 +320,7 @@ int gmx_spatial(int argc, char *argv[]) } /* OUTPUT */ - flp = ffopen("grid.cube", "w"); + flp = gmx_ffopen("grid.cube", "w"); fprintf(flp, "Spatial Distribution Function\n"); fprintf(flp, "test\n"); fprintf(flp, "%5d%12.6f%12.6f%12.6f\n", nidxp, (MINBIN[XX]+(minx+iIGNOREOUTER)*rBINWIDTH)*10./bohr, (MINBIN[YY]+(miny+iIGNOREOUTER)*rBINWIDTH)*10./bohr, (MINBIN[ZZ]+(minz+iIGNOREOUTER)*rBINWIDTH)*10./bohr); @@ -449,7 +449,7 @@ int gmx_spatial(int argc, char *argv[]) } fprintf(flp, "\n"); } - ffclose(flp); + gmx_ffclose(flp); /* printf("x=%d to %d\n",minx,maxx); */ /* printf("y=%d to %d\n",miny,maxy); */ diff --git a/src/gromacs/gmxana/gmx_spol.c b/src/gromacs/gmxana/gmx_spol.c index 62b1569857..5c5eb710a1 100644 --- a/src/gromacs/gmxana/gmx_spol.c +++ b/src/gromacs/gmxana/gmx_spol.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -380,7 +380,7 @@ int gmx_spol(int argc, char *argv[]) nmol += hist[i]; fprintf(fp, "%g %g\n", i*bw, nmol/nf); } - ffclose(fp); + gmx_ffclose(fp); do_view(oenv, opt2fn("-o", NFILE, fnm), NULL); diff --git a/src/gromacs/gmxana/gmx_tcaf.c b/src/gromacs/gmxana/gmx_tcaf.c index 6d0e9048f7..6177bba7d1 100644 --- a/src/gromacs/gmxana/gmx_tcaf.c +++ b/src/gromacs/gmxana/gmx_tcaf.c @@ -101,7 +101,7 @@ static void process_tcaf(int nframes, real dt, int nkc, real **tc, rvec *kfac, } fprintf(fp, "\n"); } - ffclose(fp); + gmx_ffclose(fp); do_view(oenv, fn_trans, "-nxy"); } @@ -169,7 +169,7 @@ static void process_tcaf(int nframes, real dt, int nkc, real **tc, rvec *kfac, } fprintf(fp, "\n"); } - ffclose(fp); + gmx_ffclose(fp); do_view(oenv, fn_tc, "-nxy"); if (fn_cub) @@ -217,7 +217,7 @@ static void process_tcaf(int nframes, real dt, int nkc, real **tc, rvec *kfac, } fprintf(fp, "&\n"); } - ffclose(fp); + gmx_ffclose(fp); do_view(oenv, fn_tcf, "-nxy"); if (fn_cub) @@ -244,10 +244,10 @@ static void process_tcaf(int nframes, real dt, int nkc, real **tc, rvec *kfac, fprintf(fp_cub, "&\n"); } fprintf(fp_vk, "&\n"); - ffclose(fp_cub); + gmx_ffclose(fp_cub); do_view(oenv, fn_cub, "-nxy"); } - ffclose(fp_vk); + gmx_ffclose(fp_vk); do_view(oenv, fn_vk, "-nxy"); } diff --git a/src/gromacs/gmxana/gmx_traj.c b/src/gromacs/gmxana/gmx_traj.c index 31f90f2946..a76ffc1023 100644 --- a/src/gromacs/gmxana/gmx_traj.c +++ b/src/gromacs/gmxana/gmx_traj.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -466,7 +466,7 @@ static void write_pdb_bfac(const char *fname, const char *xname, fprintf(fp, "%-5d %10.3f %10.3f %10.3f\n", 1+i, sum[index[i]][XX], sum[index[i]][YY], sum[index[i]][ZZ]); } - ffclose(fp); + gmx_ffclose(fp); max = 0; maxi = 0; for (i = 0; i < isize; i++) @@ -586,7 +586,7 @@ static void print_histo(const char *fn, int nhisto, int histo[], real binwidth, { fprintf(fp, "%10.3e %10d\n", i*binwidth, histo[i]); } - ffclose(fp); + gmx_ffclose(fp); } int gmx_traj(int argc, char *argv[]) @@ -1051,7 +1051,7 @@ int gmx_traj(int argc, char *argv[]) if (bOX) { - ffclose(outx); + gmx_ffclose(outx); } if (bOXT) { @@ -1059,27 +1059,27 @@ int gmx_traj(int argc, char *argv[]) } if (bOV) { - ffclose(outv); + gmx_ffclose(outv); } if (bOF) { - ffclose(outf); + gmx_ffclose(outf); } if (bOB) { - ffclose(outb); + gmx_ffclose(outb); } if (bOT) { - ffclose(outt); + gmx_ffclose(outt); } if (bEKT) { - ffclose(outekt); + gmx_ffclose(outekt); } if (bEKR) { - ffclose(outekr); + gmx_ffclose(outekr); } if (bVD) diff --git a/src/gromacs/gmxana/gmx_trjconv.c b/src/gromacs/gmxana/gmx_trjconv.c index cda3df8455..fa5f0561eb 100644 --- a/src/gromacs/gmxana/gmx_trjconv.c +++ b/src/gromacs/gmxana/gmx_trjconv.c @@ -1351,7 +1351,7 @@ int gmx_trjconv(int argc, char *argv[]) case efPDB: if (( !bSeparate && !bSplit ) && !bSubTraj) { - out = ffopen(out_file, filemode); + out = gmx_ffopen(out_file, filemode); } break; default: @@ -1789,7 +1789,7 @@ int gmx_trjconv(int argc, char *argv[]) top_title, fr.time); if (bSeparate || bSplitHere) { - out = ffopen(out_file2, "w"); + out = gmx_ffopen(out_file2, "w"); } switch (ftp) { @@ -1838,7 +1838,7 @@ int gmx_trjconv(int argc, char *argv[]) } if (bSeparate) { - ffclose(out); + gmx_ffclose(out); out = NULL; } break; @@ -1896,7 +1896,7 @@ int gmx_trjconv(int argc, char *argv[]) } else if (out != NULL) { - ffclose(out); + gmx_ffclose(out); } if (bSubTraj) { diff --git a/src/gromacs/gmxana/gmx_trjorder.c b/src/gromacs/gmxana/gmx_trjorder.c index 4d089c8274..b16b4fc01c 100644 --- a/src/gromacs/gmxana/gmx_trjorder.c +++ b/src/gromacs/gmxana/gmx_trjorder.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -376,7 +376,7 @@ int gmx_trjorder(int argc, char *argv[]) } if (fp) { - ffclose(fp); + gmx_ffclose(fp); } gmx_rmpbc_done(gpbc); diff --git a/src/gromacs/gmxana/gmx_tune_pme.c b/src/gromacs/gmxana/gmx_tune_pme.c index e63be167e1..25f4c30065 100644 --- a/src/gromacs/gmxana/gmx_tune_pme.c +++ b/src/gromacs/gmxana/gmx_tune_pme.c @@ -1429,7 +1429,7 @@ static void do_the_tests( if (0 == repeats) { fprintf(fp, "\nNo benchmarks done since number of repeats (-r) is 0.\n"); - ffclose(fp); + gmx_ffclose(fp); finalize(opt2fn("-p", nfile, fnm)); exit(0); } @@ -2313,7 +2313,7 @@ int gmx_tune_pme(int argc, char *argv[]) } /* Open performance output file and write header info */ - fp = ffopen(opt2fn("-p", NFILE, fnm), "w"); + fp = gmx_ffopen(opt2fn("-p", NFILE, fnm), "w"); /* Make a quick consistency check of command line parameters */ check_input(nnodes, repeats, &ntprs, &rmin, rcoulomb, &rmax, @@ -2496,7 +2496,7 @@ int gmx_tune_pme(int argc, char *argv[]) launch_simulation(bLaunch, fp, bThreads, cmd_mpirun, cmd_np, cmd_mdrun, cmd_args_launch, simulation_tpr, best_npme); } - ffclose(fp); + gmx_ffclose(fp); /* ... or simply print the performance results to screen: */ if (!bLaunch) diff --git a/src/gromacs/gmxana/gmx_vanhove.c b/src/gromacs/gmxana/gmx_vanhove.c index a8cef29b25..7876233164 100644 --- a/src/gromacs/gmxana/gmx_vanhove.c +++ b/src/gromacs/gmxana/gmx_vanhove.c @@ -425,11 +425,11 @@ int gmx_vanhove(int argc, char *argv[]) { ticky[i] = i*rbin; } - fp = ffopen(matfile, "w"); + fp = gmx_ffopen(matfile, "w"); write_xpm(fp, MAT_SPATIAL_Y, "Van Hove function", "G (1/nm)", sbin == 0 ? "time (ps)" : "sqrt(time) (ps^1/2)", "r (nm)", mat_nx, nbin, tickx, ticky, mat, 0, matmax, rlo, rhi, &nlev); - ffclose(fp); + gmx_ffclose(fp); } if (orfile) @@ -453,7 +453,7 @@ int gmx_vanhove(int argc, char *argv[]) } fprintf(fp, "\n"); } - ffclose(fp); + gmx_ffclose(fp); } if (otfile) @@ -465,7 +465,7 @@ int gmx_vanhove(int argc, char *argv[]) { fprintf(fp, "%g %g\n", f*dt, (real)pt[f]/(tcount[f]*isize)); } - ffclose(fp); + gmx_ffclose(fp); } do_view(oenv, matfile, NULL); diff --git a/src/gromacs/gmxana/gmx_wham.cpp b/src/gromacs/gmxana/gmx_wham.cpp index e1bc36fba0..9483baaab4 100644 --- a/src/gromacs/gmxana/gmx_wham.cpp +++ b/src/gromacs/gmxana/gmx_wham.cpp @@ -1245,7 +1245,7 @@ void calc_cumulatives(t_UmbrellaWindow *window, int nWindows, fprintf(fp, "\n"); } printf("Wrote cumulative distribution functions to %s\n", fn); - ffclose(fp); + gmx_ffclose(fp); sfree(fn); sfree(buf); } @@ -1471,7 +1471,7 @@ void print_histograms(const char *fnhist, t_UmbrellaWindow * window, int nWindow fprintf(fp, "\n"); } - ffclose(fp); + gmx_ffclose(fp); printf("Wrote %s\n", fn); if (bs_index >= 0) { @@ -1715,7 +1715,7 @@ void do_bootstrapping(const char *fnres, const char* fnprof, const char *fnhist, } fprintf(fp, "&\n"); } - ffclose(fp); + gmx_ffclose(fp); /* write average and stddev */ fp = xvgropen(fnres, "Average and stddev from bootstrapping", "z", ylabel, opt->oenv); @@ -1728,7 +1728,7 @@ void do_bootstrapping(const char *fnres, const char* fnprof, const char *fnhist, stddev = (tmp >= 0.) ? sqrt(tmp) : 0.; /* Catch rouding errors */ fprintf(fp, "%e\t%e\t%e\n", (i+0.5)*opt->dz+opt->min, bsProfiles_av [i], stddev); } - ffclose(fp); + gmx_ffclose(fp); printf("Wrote boot strap result to %s\n", fnres); } @@ -1764,7 +1764,7 @@ void read_wham_in(const char *fn, char ***filenamesRet, int *nfilesRet, int nread, sizenow, i, block = 1; FILE *fp; - fp = ffopen(fn, "r"); + fp = gmx_ffopen(fn, "r"); nread = 0; sizenow = 0; while (fgets(tmp, sizeof(tmp), fp) != NULL) @@ -1861,7 +1861,7 @@ FILE *open_pdo_pipe(const char *fn, t_UmbrellaOptions *opt, gmx_bool *bPipeOpen) } else { - pipe = ffopen(fn, "r"); + pipe = gmx_ffopen(fn, "r"); *bPipeOpen = FALSE; } @@ -1874,7 +1874,7 @@ void pdo_close_file(FILE *fp) #ifdef HAVE_PIPES pclose(fp); #else - ffclose(fp); + gmx_ffclose(fp); #endif } @@ -1927,7 +1927,7 @@ void read_pdo_files(char **fn, int nfiles, t_UmbrellaHeader* header, } else { - ffclose(file); + gmx_ffclose(file); } } printf("\n"); @@ -1965,7 +1965,7 @@ void read_pdo_files(char **fn, int nfiles, t_UmbrellaHeader* header, } else { - ffclose(file); + gmx_ffclose(file); } } printf("\n"); @@ -2703,7 +2703,7 @@ void calcIntegratedAutocorrelationTimes(t_UmbrellaWindow *window, int nwins, printf(" done\n"); if (fpcorr) { - ffclose(fpcorr); + gmx_ffclose(fpcorr); } /* plot IACT along reaction coordinate */ @@ -2742,7 +2742,7 @@ void calcIntegratedAutocorrelationTimes(t_UmbrellaWindow *window, int nwins, } } } - ffclose(fp); + gmx_ffclose(fp); printf("Wrote %s\n", fn); } @@ -2981,7 +2981,7 @@ void guessPotByIntegration(t_UmbrellaWindow *window, int nWindows, t_UmbrellaOpt { fprintf(fp, "%g %g\n", (j+0.5)*dz+opt->min, pot[j]); } - ffclose(fp); + gmx_ffclose(fp); printf("verbose mode: wrote %s with PMF from interated forces\n", "pmfintegrated.xvg"); } @@ -3035,7 +3035,7 @@ void readPullGroupSelection(t_UmbrellaOptions *opt, char **fnTpr, int nTpr) char fmt[1024], fmtign[1024]; int block = 1, sizenow; - fp = ffopen(opt->fnGroupsel, "r"); + fp = gmx_ffopen(opt->fnGroupsel, "r"); opt->groupsel = NULL; snew(tmpbuf, len); @@ -3500,7 +3500,7 @@ int gmx_wham(int argc, char *argv[]) } fprintf(histout, "\n"); } - ffclose(histout); + gmx_ffclose(histout); printf("Wrote %s\n", opt2fn("-hist", NFILE, fnm)); if (opt.bHistOnly) { @@ -3601,7 +3601,7 @@ int gmx_wham(int argc, char *argv[]) { fprintf(profout, "%e\t%e\n", (double)(i+0.5)/opt.bins*(opt.max-opt.min)+opt.min, profile[i]); } - ffclose(profout); + gmx_ffclose(profout); printf("Wrote %s\n", opt2fn("-o", NFILE, fnm)); /* Bootstrap Method */ diff --git a/src/gromacs/gmxana/gmx_xpm2ps.c b/src/gromacs/gmxana/gmx_xpm2ps.c index b0519d49d1..38df488f1f 100644 --- a/src/gromacs/gmxana/gmx_xpm2ps.c +++ b/src/gromacs/gmxana/gmx_xpm2ps.c @@ -677,7 +677,7 @@ void xpm_mat(const char *outf, int nmat, t_matrix *mat, t_matrix *mat2, int nmap; t_mapping *map = NULL; - out = ffopen(outf, "w"); + out = gmx_ffopen(outf, "w"); for (i = 0; i < nmat; i++) { @@ -724,7 +724,7 @@ void xpm_mat(const char *outf, int nmat, t_matrix *mat, t_matrix *mat2, write_xpm_m(out, mat[i]); } } - ffclose(out); + gmx_ffclose(out); } static void tick_spacing(int n, real axis[], real offset, char axisnm, @@ -1169,7 +1169,7 @@ void write_combined_matrix(int ecombine, const char *fn, real **rmat1, **rmat2; real rhi, rlo; - out = ffopen(fn, "w"); + out = gmx_ffopen(fn, "w"); for (k = 0; k < nmat; k++) { if (mat2[k].nx != mat1[k].nx || mat2[k].ny != mat1[k].ny) @@ -1240,7 +1240,7 @@ void write_combined_matrix(int ecombine, const char *fn, rmat1, rlo, rhi, white, black, &nlevels); } } - ffclose(out); + gmx_ffclose(out); } void do_mat(int nmat, t_matrix *mat, t_matrix *mat2, diff --git a/src/gromacs/gmxana/powerspect.c b/src/gromacs/gmxana/powerspect.c index 2acc521914..277d33fa02 100644 --- a/src/gromacs/gmxana/powerspect.c +++ b/src/gromacs/gmxana/powerspect.c @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2013, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -99,8 +99,8 @@ void powerspectavg(real ***intftab, int tsteps, int xbins, int ybins, char **out } /*Print out average energy-spectrum to outfiles[0] and outfiles[1];*/ - datfile1 = ffopen(outfiles[0], "w"); - datfile2 = ffopen(outfiles[1], "w"); + datfile1 = gmx_ffopen(outfiles[0], "w"); + datfile2 = gmx_ffopen(outfiles[1], "w"); /*Filling dat files with spectral data*/ fprintf(datfile1, "%s\n", "kx\t ky\t\tPower(kx,ky)"); @@ -110,8 +110,8 @@ void powerspectavg(real ***intftab, int tsteps, int xbins, int ybins, char **out fprintf(datfile1, "%d\t%d\t %8.6f\n", (n / fy), (n % fy), pspectavg1[n]); fprintf(datfile2, "%d\t%d\t %8.6f\n", (n /fy), (n % fy), pspectavg2[n]); } - ffclose(datfile1); - ffclose(datfile2); + gmx_ffclose(datfile1); + gmx_ffclose(datfile2); free(ftspect1); free(ftspect2); diff --git a/src/gromacs/gmxana/pp2shift.c b/src/gromacs/gmxana/pp2shift.c index aec07370c0..a5284e1569 100644 --- a/src/gromacs/gmxana/pp2shift.c +++ b/src/gromacs/gmxana/pp2shift.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -137,7 +137,7 @@ static void dump_sd(const char *fn, t_shiftdata *sd) } } sprintf(buf, "%s.xpm", fn); - fp = ffopen(buf, "w"); + fp = gmx_ffopen(buf, "w"); write_xpm(fp, 0, fn, fn, "Phi", "Psi", nnx, nny, x_phi, y_psi, newdata, lo, hi, rlo, rhi, &nlevels); for (i = 0; (i < nnx); i++) @@ -188,7 +188,7 @@ static t_shiftdata *read_shifts(const char *fn) } sd->data[i][j] = sd->data[i][0]; } - ffclose(fp); + gmx_ffclose(fp); if (bDebugMode()) { diff --git a/src/gromacs/gmxlib/atomprop.c b/src/gromacs/gmxlib/atomprop.c index cbce2a6bb2..41ee4e18eb 100644 --- a/src/gromacs/gmxlib/atomprop.c +++ b/src/gromacs/gmxlib/atomprop.c @@ -238,7 +238,7 @@ static void read_prop(gmx_atomprop_t aps, int eprop, double factor) } /* for libraries we can use the low-level close routines */ - ffclose(fp); + gmx_ffclose(fp); ap->bSet = TRUE; } diff --git a/src/gromacs/gmxlib/copyrite.cpp b/src/gromacs/gmxlib/copyrite.cpp index b59d759f1e..e0cab08de3 100644 --- a/src/gromacs/gmxlib/copyrite.cpp +++ b/src/gromacs/gmxlib/copyrite.cpp @@ -94,7 +94,7 @@ static void pukeit(const char *db, const char *defstring, char *retstring, { nhlp = fget_lines(fp, &help); /* for libraries we can use the low-level close routines */ - ffclose(fp); + gmx_ffclose(fp); rng = gmx_rng_init(gmx_rng_make_seed()); *cqnum = static_cast(nhlp*gmx_rng_uniform_real(rng)); gmx_rng_destroy(rng); diff --git a/src/gromacs/gmxlib/readinp.c b/src/gromacs/gmxlib/readinp.c index a8a46d66b0..cd665652b4 100644 --- a/src/gromacs/gmxlib/readinp.c +++ b/src/gromacs/gmxlib/readinp.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -68,7 +68,7 @@ t_inpfile *read_inpfile(const char *fn, int *ninp, fprintf(debug, "Reading MDP file %s\n", fn); } - in = ffopen(fn, "r"); + in = gmx_ffopen(fn, "r"); nin = lc = 0; do @@ -201,7 +201,7 @@ t_inpfile *read_inpfile(const char *fn, int *ninp, } while (ptr); - ffclose(in); + gmx_ffclose(in); if (debug) { diff --git a/src/gromacs/gmxlib/sfactor.c b/src/gromacs/gmxlib/sfactor.c index 51a39d872c..6b2159e3b5 100644 --- a/src/gromacs/gmxlib/sfactor.c +++ b/src/gromacs/gmxlib/sfactor.c @@ -610,7 +610,7 @@ extern void save_data (structure_factor_t *sft, const char *file, int ngrps, } } - ffclose (fp); + gmx_ffclose (fp); } diff --git a/src/gromacs/gmxpreprocess/fflibutil.cpp b/src/gromacs/gmxpreprocess/fflibutil.cpp index a4c9dfe78b..b9928cdcf2 100644 --- a/src/gromacs/gmxpreprocess/fflibutil.cpp +++ b/src/gromacs/gmxpreprocess/fflibutil.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2012,2013, by the GROMACS development team, led by + * Copyright (c) 2010,2012,2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -343,7 +343,7 @@ FILE *fflib_open(const char *file) file_fullpath = gmxlibfn(file); fprintf(stderr, "Opening force field file %s\n", file_fullpath); - fp = ffopen(file_fullpath, "r"); + fp = gmx_ffopen(file_fullpath, "r"); sfree(file_fullpath); return fp; diff --git a/src/gromacs/gmxpreprocess/gen_vsite.c b/src/gromacs/gmxpreprocess/gen_vsite.c index f3ad7fa4e4..dade614bbb 100644 --- a/src/gromacs/gmxpreprocess/gen_vsite.c +++ b/src/gromacs/gmxpreprocess/gen_vsite.c @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -312,7 +312,7 @@ static void read_vsite_database(const char *ddbname, *nvsiteconf = nvsite; *nvsitetop = ntop; - ffclose(ddb); + gmx_ffclose(ddb); } static int nitrogen_is_planar(t_vsiteconf vsiteconflist[], int nvsiteconf, char atomtype[]) diff --git a/src/gromacs/gmxpreprocess/h_db.c b/src/gromacs/gmxpreprocess/h_db.c index ed7fe4f39b..4bd2e5f067 100644 --- a/src/gromacs/gmxpreprocess/h_db.c +++ b/src/gromacs/gmxpreprocess/h_db.c @@ -191,7 +191,7 @@ static void read_h_db_file(const char *hfn, int *nahptr, t_hackblock **ah) } nah++; } - ffclose(in); + gmx_ffclose(in); /* Sort the list (necessary to be able to use bsearch */ qsort(aah, nah, (size_t)sizeof(**ah), compaddh); diff --git a/src/gromacs/gmxpreprocess/nm2type.c b/src/gromacs/gmxpreprocess/nm2type.c index 8e1dac95d5..1118100847 100644 --- a/src/gromacs/gmxpreprocess/nm2type.c +++ b/src/gromacs/gmxpreprocess/nm2type.c @@ -126,7 +126,7 @@ static void rd_nm2type_file(const char *fn, int *nnm, t_nm2type **nmp) } } while (bCont); - ffclose(fp); + gmx_ffclose(fp); *nnm = nnnm; *nmp = nm2t; diff --git a/src/gromacs/gmxpreprocess/pdb2gmx.c b/src/gromacs/gmxpreprocess/pdb2gmx.c index f64c93f4dd..f7207a898c 100644 --- a/src/gromacs/gmxpreprocess/pdb2gmx.c +++ b/src/gromacs/gmxpreprocess/pdb2gmx.c @@ -1458,7 +1458,7 @@ int gmx_pdb2gmx(int argc, char *argv[]) { fp = fflib_open(rrn[i]); read_rtprename(rrn[i], fp, &nrtprename, &rtprename); - ffclose(fp); + gmx_ffclose(fp); sfree(rrn[i]); } sfree(rrn); diff --git a/src/gromacs/gmxpreprocess/pdb2top.cpp b/src/gromacs/gmxpreprocess/pdb2top.cpp index 822b6a7ab4..baba4b4625 100644 --- a/src/gromacs/gmxpreprocess/pdb2top.cpp +++ b/src/gromacs/gmxpreprocess/pdb2top.cpp @@ -250,10 +250,10 @@ choose_ff(const char *ffsel, if (gmx_fexist(buf)) { /* We don't use fflib_open, because we don't want printf's */ - fp = ffopen(buf, "r"); + fp = gmx_ffopen(buf, "r"); snew(desc[i], STRLEN); get_a_line(fp, desc[i], STRLEN); - ffclose(fp); + gmx_ffclose(fp); } else { @@ -410,7 +410,7 @@ void choose_watermodel(const char *wmsel, const char *ffdir, sfree(model[nwm]); } } - ffclose(fp); + gmx_ffclose(fp); fprintf(stderr, "%2d: %s\n", nwm+1, "None"); sel = -1; diff --git a/src/gromacs/gmxpreprocess/resall.c b/src/gromacs/gmxpreprocess/resall.c index 3b643ffe02..b09f0819c2 100644 --- a/src/gromacs/gmxpreprocess/resall.c +++ b/src/gromacs/gmxpreprocess/resall.c @@ -93,7 +93,7 @@ gpp_atomtype_t read_atype(const char *ffdir, t_symtab *tab) fprintf(stderr, "\rAtomtype %d", nratt+1); } } - ffclose(in); + gmx_ffclose(in); sfree(file[f]); } fprintf(stderr, "\n"); @@ -539,7 +539,7 @@ void read_resall(char *rrdb, int *nrtpptr, t_restp **rtp, } } } - ffclose(in); + gmx_ffclose(in); /* give back unused memory */ srenew(rrtp, nrtp); diff --git a/src/gromacs/gmxpreprocess/solvate.cpp b/src/gromacs/gmxpreprocess/solvate.cpp index 41cc0db1d4..3cbd5556a6 100644 --- a/src/gromacs/gmxpreprocess/solvate.cpp +++ b/src/gromacs/gmxpreprocess/solvate.cpp @@ -525,8 +525,8 @@ static void update_top(t_atoms *atoms, matrix box, int NFILE, t_filenm fnm[], if (ftp2bSet(efTOP, NFILE, fnm) ) { fprintf(stderr, "Processing topology\n"); - fpin = ffopen(topinout, "r"); - fpout = ffopen(TEMP_FILENM, "w"); + fpin = gmx_ffopen(topinout, "r"); + fpout = gmx_ffopen(TEMP_FILENM, "w"); line = 0; bSystem = bMolecules = FALSE; while (fgets(buf, STRLEN, fpin)) @@ -595,17 +595,17 @@ static void update_top(t_atoms *atoms, matrix box, int NFILE, t_filenm fnm[], fprintf(fpout, "%s", buf); } } - ffclose(fpin); + gmx_ffclose(fpin); if (nsol) { fprintf(stdout, "Adding line for %d solvent molecules to " "topology file (%s)\n", nsol, topinout); fprintf(fpout, "%-15s %5d\n", "SOL", nsol); } - ffclose(fpout); - /* use ffopen to generate backup of topinout */ - fpout = ffopen(topinout, "w"); - ffclose(fpout); + gmx_ffclose(fpout); + /* use gmx_ffopen to generate backup of topinout */ + fpout = gmx_ffopen(topinout, "w"); + gmx_ffclose(fpout); rename(TEMP_FILENM, topinout); } #undef TEMP_FILENM diff --git a/src/gromacs/gmxpreprocess/ter_db.c b/src/gromacs/gmxpreprocess/ter_db.c index 0261410e8d..e1390987e9 100644 --- a/src/gromacs/gmxpreprocess/ter_db.c +++ b/src/gromacs/gmxpreprocess/ter_db.c @@ -398,7 +398,7 @@ static void read_ter_db_file(char *fn, nb++; srenew(tb, nb); - ffclose(in); + gmx_ffclose(in); *ntbptr = nb; *tbptr = tb; diff --git a/src/gromacs/gmxpreprocess/tomorse.c b/src/gromacs/gmxpreprocess/tomorse.c index e3b1ed7fde..fc2727df60 100644 --- a/src/gromacs/gmxpreprocess/tomorse.c +++ b/src/gromacs/gmxpreprocess/tomorse.c @@ -94,7 +94,7 @@ static t_2morse *read_dissociation_energies(int *n2morse) /* If we did not read three items, quit reading */ } while (nread == 3); - ffclose(fp); + gmx_ffclose(fp); /* Set the return values */ *n2morse = n2m; diff --git a/src/gromacs/gmxpreprocess/x2top.c b/src/gromacs/gmxpreprocess/x2top.c index c5b75e99e4..4246eb7ee7 100644 --- a/src/gromacs/gmxpreprocess/x2top.c +++ b/src/gromacs/gmxpreprocess/x2top.c @@ -618,7 +618,7 @@ int gmx_x2top(int argc, char *argv[]) cgnr, rtp_header_settings.nrexcl); print_top_mols(fp, mymol.name, ffdir, NULL, 0, NULL, 1, &mymol); - ffclose(fp); + gmx_ffclose(fp); } if (bRTP) { diff --git a/src/gromacs/gmxpreprocess/xlate.c b/src/gromacs/gmxpreprocess/xlate.c index 36aeda4fba..fed4c8b73e 100644 --- a/src/gromacs/gmxpreprocess/xlate.c +++ b/src/gromacs/gmxpreprocess/xlate.c @@ -163,7 +163,7 @@ void rename_atoms(const char *xlfile, const char *ffdir, { fp = fflib_open(f[i]); get_xlatoms(f[i], fp, &nxlate, &xlatom); - ffclose(fp); + gmx_ffclose(fp); sfree(f[i]); } sfree(f); diff --git a/src/gromacs/mdlib/pme.c b/src/gromacs/mdlib/pme.c index 34ebe16bbe..8036486ca8 100644 --- a/src/gromacs/mdlib/pme.c +++ b/src/gromacs/mdlib/pme.c @@ -1221,9 +1221,9 @@ static int copy_pmegrid_to_fftgrid(gmx_pme_t pme, real *pmegrid, real *fftgrid, char fn[STRLEN], format[STRLEN]; real val; sprintf(fn, "pmegrid%d.pdb", pme->nodeid); - fp = ffopen(fn, "w"); + fp = gmx_ffopen(fn, "w"); sprintf(fn, "pmegrid%d.txt", pme->nodeid); - fp2 = ffopen(fn, "w"); + fp2 = gmx_ffopen(fn, "w"); sprintf(format, "%s%s\n", pdbformat, "%6.2f%6.2f"); #endif @@ -1257,8 +1257,8 @@ static int copy_pmegrid_to_fftgrid(gmx_pme_t pme, real *pmegrid, real *fftgrid, } } #ifdef DEBUG_PME - ffclose(fp); - ffclose(fp2); + gmx_ffclose(fp); + gmx_ffclose(fp2); #endif } return 0; diff --git a/src/gromacs/mdlib/tables.c b/src/gromacs/mdlib/tables.c index 7cfce0bc24..464f82ac3b 100644 --- a/src/gromacs/mdlib/tables.c +++ b/src/gromacs/mdlib/tables.c @@ -1602,7 +1602,7 @@ t_forcetable make_atf_table(FILE *out, const output_env_t oenv, fprintf(fp, "%15.10e %15.10e %15.10e\n", x0, y0, yp); } - ffclose(fp); + gmx_ffclose(fp); } done_tabledata(&(td[0])); diff --git a/src/gromacs/pulling/pull_rotation.c b/src/gromacs/pulling/pull_rotation.c index edd84a4f3e..6ae8510d48 100644 --- a/src/gromacs/pulling/pull_rotation.c +++ b/src/gromacs/pulling/pull_rotation.c @@ -771,7 +771,7 @@ static FILE *open_output_file(const char *fn, int steps, const char what[]) FILE *fp; - fp = ffopen(fn, "w"); + fp = gmx_ffopen(fn, "w"); fprintf(fp, "# Output of %s is written in intervals of %d time step%s.\n#\n", what, steps, steps > 1 ? "s" : ""); diff --git a/src/gromacs/utility/file.cpp b/src/gromacs/utility/file.cpp index 59f5a3d363..b0adbce9d9 100644 --- a/src/gromacs/utility/file.cpp +++ b/src/gromacs/utility/file.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -128,7 +128,7 @@ void File::open(const char *filename, const char *mode) { GMX_RELEASE_ASSERT(impl_->fp_ == NULL, "Attempted to open the same file object twice"); - // TODO: Port all necessary functionality from ffopen() here. + // TODO: Port all necessary functionality from gmx_ffopen() here. impl_->fp_ = fopen(filename, mode); if (impl_->fp_ == NULL) { diff --git a/src/programs/mdrun/membed.c b/src/programs/mdrun/membed.c index 738cb3fe30..77231a1130 100644 --- a/src/programs/mdrun/membed.c +++ b/src/programs/mdrun/membed.c @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -895,8 +895,8 @@ static void top_update(const char *topfile, rm_t *rm_p, gmx_mtop_t *mtop) char buf[STRLEN], buf2[STRLEN], *temp; int i, *nmol_rm, nmol, line; - fpin = ffopen(topfile, "r"); - fpout = ffopen(TEMP_FILENM, "w"); + fpin = gmx_ffopen(topfile, "r"); + fpout = gmx_ffopen(TEMP_FILENM, "w"); snew(nmol_rm, mtop->nmoltype); for (i = 0; i < rm_p->nr; i++) @@ -961,10 +961,10 @@ static void top_update(const char *topfile, rm_t *rm_p, gmx_mtop_t *mtop) } } - ffclose(fpout); - /* use ffopen to generate backup of topinout */ - fpout = ffopen(topfile, "w"); - ffclose(fpout); + gmx_ffclose(fpout); + /* use gmx_ffopen to generate backup of topinout */ + fpout = gmx_ffopen(topfile, "w"); + gmx_ffclose(fpout); rename(TEMP_FILENM, topfile); #undef TEMP_FILENM } diff --git a/src/programs/view/fgrid.cpp b/src/programs/view/fgrid.cpp index 09eec37fbd..7eee65889f 100644 --- a/src/programs/view/fgrid.cpp +++ b/src/programs/view/fgrid.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2013, The GROMACS development team. - * Copyright (c) 2013, by the GROMACS development team, led by + * Copyright (c) 2013,2014, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -438,7 +438,7 @@ t_fgrid *FGridFromFile(const char *infile) } fscanf(in, "%15s", buf); } - ffclose(in); + gmx_ffclose(in); return fgrid; } -- 2.22.0