From 8ed97f5441b3d2dd0ecd21dcde6d999cd866c3a2 Mon Sep 17 00:00:00 2001 From: Paul Bauer Date: Wed, 11 Sep 2019 10:55:28 +0200 Subject: [PATCH] Remove -sub option from trjconv This functionality is now in gmx extract-cluster. Change-Id: I5c74ce346f2e422f1b494663f0eb3206083c05be --- docs/release-notes/2020/major/tools.rst | 1 + docs/user-guide/cmdline.rst | 20 ++++ src/gromacs/tools/trjconv.cpp | 131 +++--------------------- 3 files changed, 34 insertions(+), 118 deletions(-) diff --git a/docs/release-notes/2020/major/tools.rst b/docs/release-notes/2020/major/tools.rst index 92a1d01939..de582e4b17 100644 --- a/docs/release-notes/2020/major/tools.rst +++ b/docs/release-notes/2020/major/tools.rst @@ -42,3 +42,4 @@ Added extract-cluster Added a dedicated tool to extract trajectory frames corresponding to different clusters obtained from :ref:`gmx cluster`. The new :ref:`extract-cluster ` tool generates new trajectories that contain only those frames that correspond to the correct cluster. +The corresponding option **-sub** in :ref:`gmx trjconv` has been removed. diff --git a/docs/user-guide/cmdline.rst b/docs/user-guide/cmdline.rst index f4ec5a0b9a..fed58b407a 100644 --- a/docs/user-guide/cmdline.rst +++ b/docs/user-guide/cmdline.rst @@ -146,6 +146,26 @@ options or bug fixes are not typically included. For more information about changed features, please check out the :ref:`release notes `. +Version 2020 +^^^^^^^^^^^^ + +gmx convert-trj +............... + +**new** + +:ref:`gmx convert-trj` has been introduced as a selection-enabled alternative +for exchanging trajectory file format (previously done in :ref:`gmx trjconv`). + +gmx extract-cluster +................... + +**new** + +:ref:`gmx extract-cluster` has been introduced as a selection-enabled way to +write sub-trajectories based on the output from a cluster analysis. The +corresponding option **-sub** in :ref:`gmx trjconv` has been removed. + Version 2018 ^^^^^^^^^^^^ diff --git a/src/gromacs/tools/trjconv.cpp b/src/gromacs/tools/trjconv.cpp index c67685b369..f560ba3902 100644 --- a/src/gromacs/tools/trjconv.cpp +++ b/src/gromacs/tools/trjconv.cpp @@ -232,15 +232,13 @@ int gmx_trjconv(int argc, char *argv[]) "* fit atoms to reference structure", "* reduce the number of frames", "* change the timestamps of the frames ([TT]-t0[tt] and [TT]-timestep[tt])", - "* cut the trajectory in small subtrajectories according", - " to information in an index file. This allows subsequent analysis of", - " the subtrajectories that could, for example, be the result of a", - " cluster analysis. Use option [TT]-sub[tt].", - " This assumes that the entries in the index file are frame numbers and", - " dumps each group in the index file to a separate trajectory file.", "* select frames within a certain range of a quantity given", " in an [REF].xvg[ref] file.", "", + "The option to write subtrajectories (-sub) based on the information obtained from", + "cluster analysis has been removed from [THISMODULE] and is now part of", + "[gmx extract-cluster]", + "", "[gmx-trjcat] is better suited for concatenating multiple trajectory files.", "[PAR]", @@ -509,14 +507,9 @@ int gmx_trjconv(int argc, char *argv[]) char *grpnm = nullptr; int *frindex, nrfri; char *frname; - int ifit, my_clust = -1; + int ifit; int *ind_fit; char *gn_fit; - t_cluster_ndx *clust = nullptr; - t_trxstatus **clust_status = nullptr; - int *clust_status_id = nullptr; - int ntrxopen = 0; - int *nfwritten = nullptr; int ndrop = 0, ncol, drop0 = 0, drop1 = 0, dropuse = 0; double **dropval; real tshift = 0, dt = -1, prec; @@ -527,7 +520,7 @@ int gmx_trjconv(int argc, char *argv[]) gmx_bool bCopy, bDoIt, bIndex, bTDump, bSetTime, bTPS = FALSE, bDTset = FALSE; gmx_bool bExec, bTimeStep = FALSE, bDumpFrame = FALSE, bSetXtcPrec, bNeedPrec; gmx_bool bHaveFirstFrame, bHaveNextFrame, bSetBox, bSetUR, bSplit = FALSE; - gmx_bool bSubTraj = FALSE, bDropUnder = FALSE, bDropOver = FALSE, bTrans = FALSE; + gmx_bool bDropUnder = FALSE, bDropOver = FALSE, bTrans = FALSE; gmx_bool bWriteFrame, bSplitHere; const char *top_file, *in_file, *out_file = nullptr; char out_file2[256], *charpt; @@ -669,45 +662,13 @@ int gmx_trjconv(int argc, char *argv[]) outf_base[outf_ext - out_file] = '\0'; } - bSubTraj = opt2bSet("-sub", NFILE, fnm); + bool bSubTraj = opt2bSet("-sub", NFILE, fnm); if (bSubTraj) { - if ((ftp != efXTC) && (ftp != efTRR)) - { - /* It seems likely that other trajectory file types - * could work here. */ - gmx_fatal(FARGS, "Can only use the sub option with output file types " - "xtc and trr"); - } - clust = cluster_index(nullptr, opt2fn("-sub", NFILE, fnm)); - - /* Check for number of files disabled, as FOPEN_MAX is not the correct - * number to check for. In my linux box it is only 16. - */ - if (/* DISABLES CODE */ (false)) - //if (clust->clust->nr > FOPEN_MAX-4) - { - gmx_fatal(FARGS, "Can not open enough (%d) files to write all the" - " trajectories.\ntry splitting the index file in %d parts.\n" - "FOPEN_MAX = %d", - clust->clust->nr, 1+clust->clust->nr/FOPEN_MAX, FOPEN_MAX); - } - gmx_warning("The -sub option could require as many open output files as there are\n" - "index groups in the file (%d). If you get I/O errors opening new files,\n" - "try reducing the number of index groups in the file, and perhaps\n" - "using trjconv -sub several times on different chunks of your index file.\n", - clust->clust->nr); - - snew(clust_status, clust->clust->nr); - snew(clust_status_id, clust->clust->nr); - snew(nfwritten, clust->clust->nr); - for (i = 0; (i < clust->clust->nr); i++) - { - clust_status[i] = nullptr; - clust_status_id[i] = -1; - } - bSeparate = bSplit = FALSE; + gmx_fatal(FARGS, "The -sub option has been removed from gmx trjconv and is now part\n" + "of gmx extract-cluster and does nothing here\n"); } + /* skipping */ if (skip_nr <= 0) { @@ -1006,7 +967,7 @@ int gmx_trjconv(int argc, char *argv[]) case efXTC: case efTRR: out = nullptr; - if (!bSplit && !bSubTraj) + if (!bSplit) { trxout = open_trx(out_file, filemode); } @@ -1014,7 +975,7 @@ int gmx_trjconv(int argc, char *argv[]) case efGRO: case efG96: case efPDB: - if (( !bSeparate && !bSplit ) && !bSubTraj) + if (!bSeparate && !bSplit) { out = gmx_ffopen(out_file, filemode); } @@ -1051,24 +1012,6 @@ int gmx_trjconv(int argc, char *argv[]) fr.step = newstep; newstep++; } - if (bSubTraj) - { - /*if (frame >= clust->clust->nra) - gmx_fatal(FARGS,"There are more frames in the trajectory than in the cluster index file\n");*/ - if (frame > clust->maxframe) - { - my_clust = -1; - } - else - { - my_clust = clust->inv_clust[frame]; - } - if ((my_clust < 0) || (my_clust >= clust->clust->nr) || - (my_clust == -1)) - { - my_clust = -1; - } - } if (bSetBox) { @@ -1424,45 +1367,7 @@ int gmx_trjconv(int argc, char *argv[]) } trxout = open_trx(out_file2, filemode); } - if (bSubTraj) - { - if (my_clust != -1) - { - char buf[STRLEN]; - if (clust_status_id[my_clust] == -1) - { - sprintf(buf, "%s.%s", clust->grpname[my_clust], ftp2ext(ftp)); - clust_status[my_clust] = open_trx(buf, "w"); - clust_status_id[my_clust] = 1; - ntrxopen++; - } - else if (clust_status_id[my_clust] == -2) - { - gmx_fatal(FARGS, "File %s.xtc should still be open (%d open .xtc files)\n" "in order to write frame %d. my_clust = %d", - clust->grpname[my_clust], ntrxopen, frame, - my_clust); - } - write_trxframe(clust_status[my_clust], &frout, gc); - nfwritten[my_clust]++; - if (nfwritten[my_clust] == - (clust->clust->index[my_clust+1]- - clust->clust->index[my_clust])) - { - close_trx(clust_status[my_clust]); - clust_status[my_clust] = nullptr; - clust_status_id[my_clust] = -2; - ntrxopen--; - if (ntrxopen < 0) - { - gmx_fatal(FARGS, "Less than zero open .xtc files!"); - } - } - } - } - else - { - write_trxframe(trxout, &frout, gc); - } + write_trxframe(trxout, &frout, gc); break; case efGRO: case efG96: @@ -1598,16 +1503,6 @@ int gmx_trjconv(int argc, char *argv[]) { gmx_ffclose(out); } - if (bSubTraj) - { - for (i = 0; (i < clust->clust->nr); i++) - { - if (clust_status_id[i] >= 0) - { - close_trx(clust_status[i]); - } - } - } } if (bTPS) -- 2.22.0