/*
+ * This file is part of the GROMACS molecular simulation package.
*
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
+ * 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.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * For more info, check our website at http://www.gromacs.org
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
*
- * And Hey:
- * Green Red Orange Magenta Azure Cyan Skyblue
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "gmxpre.h"
#include <math.h>
-#include <ctype.h>
-
-#include "macros.h"
-#include "smalloc.h"
-#include "typedefs.h"
-#include "names.h"
-#include "copyrite.h"
-#include "statutil.h"
-#include "tpxio.h"
-#include "string2.h"
-#include "strdb.h"
-#include "vec.h"
-#include "macros.h"
-#include "index.h"
-#include "pbc.h"
-#include "xvgr.h"
-#include "futil.h"
-#include "matio.h"
-#include "gmx_ana.h"
+
+#include "gromacs/commandline/pargs.h"
+#include "gromacs/fileio/matio.h"
+#include "gromacs/fileio/strdb.h"
+#include "gromacs/fileio/tpxio.h"
+#include "gromacs/fileio/trxio.h"
+#include "gromacs/fileio/xvgr.h"
+#include "gromacs/gmxana/gmx_ana.h"
+#include "gromacs/legacyheaders/macros.h"
+#include "gromacs/legacyheaders/names.h"
+#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/legacyheaders/viewit.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/pbcutil/pbc.h"
+#include "gromacs/topology/index.h"
+#include "gromacs/utility/futil.h"
+#include "gromacs/utility/smalloc.h"
static void calc_dist(int nind, atom_id index[], rvec x[], int ePBC, matrix box,
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))
{
lp += n;
snew(equiv[neq], 1);
- equiv[neq][0].nname = strdup(atomname);
+ equiv[neq][0].nname = gmx_strdup(atomname);
while (sscanf(lp, "%d %s %s %n", &resnr, resname, atomname, &n) == 3)
{
/* this is not efficient, but I'm lazy (again) */
srenew(equiv[neq], na+1);
equiv[neq][na].rnr = resnr-1;
- equiv[neq][na].rname = strdup(resname);
- equiv[neq][na].aname = strdup(atomname);
+ equiv[neq][na].rname = gmx_strdup(resname);
+ equiv[neq][na].aname = gmx_strdup(atomname);
if (na > 0)
{
equiv[neq][na].nname = NULL;
/* next */
neq++;
}
- ffclose(fp);
+ gmx_ffclose(fp);
*equivptr = equiv;
}
if (bFound)
{
- *nname = strdup(equiv[i-1][0].nname);
+ *nname = gmx_strdup(equiv[i-1][0].nname);
}
return bFound;
rnrj, *atoms->resinfo[rnrj].name, *atoms->atomname[index[j]]);
if (nnm[i] && bEquiv)
{
- nnm[j] = strdup(nnm[i]);
+ nnm[j] = gmx_strdup(nnm[i]);
}
if (bEquiv)
{
/* set index for matching atom */
- noe_index[j] = groupnr;
+ noe_index[i] = groupnr;
/* skip matching atom */
i = j;
}
This is supposed to cover all CH3 groups and the like */
anmi = *atoms->atomname[index[i]];
anmil = strlen(anmi);
- bMatch = i < isize-3 && anmi[anmil-1] == '1';
+ bMatch = i <= isize-3 && anmi[anmil-1] == '1';
if (bMatch)
{
for (j = 1; j < 3; j++)
noe_gr[gi].anr = index[i];
if (nnm[i])
{
- noe_gr[gi].aname = strdup(nnm[i]);
+ noe_gr[gi].aname = gmx_strdup(nnm[i]);
}
else
{
- noe_gr[gi].aname = strdup(*atoms->atomname[index[i]]);
+ noe_gr[gi].aname = gmx_strdup(*atoms->atomname[index[i]]);
if (noe_index[i] == noe_index[i+1])
{
noe_gr[gi].aname[strlen(noe_gr[gi].aname)-1] = '*';
}
}
noe_gr[gi].rnr = atoms->atom[index[i]].resind;
- noe_gr[gi].rname = strdup(*atoms->resinfo[noe_gr[gi].rnr].name);
+ noe_gr[gi].rname = gmx_strdup(*atoms->resinfo[noe_gr[gi].rnr].name);
/* dump group definitions */
if (debug)
{
return sqrt(r2);
}
-int gmx_rmsdist (int argc, char *argv[])
+int gmx_rmsdist(int argc, char *argv[])
{
const char *desc[] = {
- "[TT]g_rmsdist[tt] computes the root mean square deviation of atom distances,",
+ "[THISMODULE] computes the root mean square deviation of atom distances,",
"which has the advantage that no fit is needed like in standard RMS",
- "deviation as computed by [TT]g_rms[tt].",
+ "deviation as computed by [gmx-rms].",
"The reference structure is taken from the structure file.",
"The RMSD at time t is calculated as the RMS",
"of the differences in distance between atom-pairs in the reference",
"structure and the structure at time t.[PAR]",
- "[TT]g_rmsdist[tt] can also produce matrices of the rms distances, rms distances",
+ "[THISMODULE] can also produce matrices of the rms distances, rms distances",
"scaled with the mean distance and the mean distances and matrices with",
"NMR averaged distances (1/r^3 and 1/r^6 averaging). Finally, lists",
"of atom pairs with 1/r^3 and 1/r^6 averaged distance below the",
"equivalent atoms can be supplied ([TT]-equiv[tt]), each line containing",
"a set of equivalent atoms specified as residue number and name and",
"atom name; e.g.:[PAR]",
- "[TT]3 SER HB1 3 SER HB2[tt][PAR]",
+ "[TT]HB* 3 SER HB1 3 SER HB2[tt][PAR]",
"Residue and atom names must exactly match those in the structure",
"file, including case. Specifying non-sequential atoms is undefined."
};
#define NFILE asize(fnm)
- parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME | PCA_BE_NICE,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv);
+ if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME,
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ {
+ return 0;
+ }
bRMS = opt2bSet("-rms", NFILE, fnm);
bScale = opt2bSet("-scl", NFILE, fnm);
}
/*do a first step*/
- natom = read_first_x(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &t, &x, box);
+ natom = read_first_x(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &t, &x, box);
+ teller = 0;
do
{
rmsnow = rms_diff(isize, d, d_r);
fprintf(fp, "%g %g\n", t, rmsnow);
+ teller++;
}
- while (read_next_x(oenv, status, &t, natom, x, box));
+ while (read_next_x(oenv, status, &t, x, box));
fprintf(stderr, "\n");
- ffclose(fp);
-
- teller = nframes_read(status);
+ gmx_ffclose(fp);
close_trj(status);
do_view(oenv, ftp2fn(efXVG, NFILE, fnm), NULL);
- thanx(stderr);
return 0;
}