made trjconv -novel work again, fixes #722
authorBerk Hess <hess@hess.theophys.kth.se>
Tue, 2 Aug 2011 10:24:44 +0000 (12:24 +0200)
committerBerk Hess <hess@hess.theophys.kth.se>
Tue, 2 Aug 2011 10:24:44 +0000 (12:24 +0200)
src/tools/gmx_trjconv.c

index 00b2b5ff79d4819f29498175e02a96ec62fe03ff..f8bada386eba3a2a907f6532d27517e539a04f6e 100644 (file)
@@ -1383,6 +1383,8 @@ int gmx_trjconv(int argc,char *argv[])
                         }
                         /* Copy the input trxframe struct to the output trxframe struct */
                         frout = fr;
+                       frout.bV    &= bVels;
+                       frout.bF    &= bForce;
                         frout.natoms = nout;
                         if (bNeedPrec && (bSetPrec || !fr.bPrec)) {
                             frout.bPrec = TRUE;
@@ -1390,18 +1392,18 @@ int gmx_trjconv(int argc,char *argv[])
                         }
                         if (bCopy) {
                             frout.x = xmem;
-                            if (bVels) {
+                            if (frout.bV) {
                                 frout.v = vmem;
                             }
-                            if (bForce) {
+                            if (frout.bF) {
                                 frout.f = fmem;
                             }
                             for(i=0; i<nout; i++) {
                                 copy_rvec(fr.x[index[i]],frout.x[i]);
-                                if (bVels && fr.bV) {
+                                if (frout.bV) {
                                     copy_rvec(fr.v[index[i]],frout.v[i]);
                                 }
-                                if (bForce && fr.bF) {
+                                if (frout.bF) {
                                     copy_rvec(fr.f[index[i]],frout.f[i]);
                                 }
                             }
@@ -1473,7 +1475,7 @@ int gmx_trjconv(int argc,char *argv[])
                             switch(ftp) {
                             case efGRO: 
                                 write_hconf_p(out,title,&useatoms,prec2ndec(frout.prec),
-                                              frout.x,fr.bV?frout.v:NULL,frout.box);
+                                              frout.x,frout.bV?frout.v:NULL,frout.box);
                                 break;
                             case efPDB:
                                 fprintf(out,"REMARK    GENERATED BY TRJCONV\n");