From 8f78b16d2f94ec617630e3cab95744369830e2f3 Mon Sep 17 00:00:00 2001 From: Alexey Shvetsov Date: Fri, 20 Aug 2010 01:57:58 +0400 Subject: [PATCH] gmx_anaeig.c fix segfault when using project and filter Signed-off-by: Alexey Shvetsov --- src/tools/gmx_anaeig.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/tools/gmx_anaeig.c b/src/tools/gmx_anaeig.c index 5cf11a9..12aa1cb 100644 --- a/src/tools/gmx_anaeig.c +++ b/src/tools/gmx_anaeig.c @@ -495,7 +495,6 @@ static void project(const char *trajfile,t_topology *top,int ePBC,matrix topbox, } nfr++; } while (read_next_x(oenv,status,&t,nat,xread,box)); - close_trj(out); sfree(x); if (filterfile) close_trx(out); @@ -999,7 +998,6 @@ int gmx_anaeig(int argc,char *argv[]) nfit=0; ifit=NULL; w_rls=NULL; - gpbc = gmx_rmpbc_init(&top.idef,ePBC,atoms->nr,topbox); if (!bTPS) bTop=FALSE; @@ -1007,6 +1005,7 @@ int gmx_anaeig(int argc,char *argv[]) bTop=read_tps_conf(ftp2fn(efTPS,NFILE,fnm), title,&top,&ePBC,&xtop,NULL,topbox,bM); atoms=&top.atoms; + gpbc = gmx_rmpbc_init(&top.idef,ePBC,atoms->nr,topbox); gmx_rmpbc(gpbc,atoms->nr,topbox,xtop); /* Fitting is only required for the projection */ if (bProj && bFit1) { @@ -1039,8 +1038,8 @@ int gmx_anaeig(int argc,char *argv[]) reset_x(nfit,ifit,atoms->nr,NULL,xrefp,w_rls); } } + gmx_rmpbc_done(gpbc); } - gmx_rmpbc_done(gpbc); if (bIndex) { printf("\nSelect an index group of %d elements that corresponds to the eigenvectors\n",natoms); -- 1.7.2