/*
+ * 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 <stdlib.h>
#include <string.h>
-#include "typedefs.h"
-#include "macros.h"
-#include "mshift.h"
-#include "xvgr.h"
-#include "vec.h"
-#include "do_fit.h"
-#include "confio.h"
-#include "smalloc.h"
-#include "nrnb.h"
-#include "disre.h"
-#include "statutil.h"
-#include "force.h"
+#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/legacyheaders/macros.h"
+#include "gromacs/pbcutil/mshift.h"
+#include "gromacs/legacyheaders/viewit.h"
+#include "gromacs/fileio/confio.h"
+#include "gromacs/legacyheaders/nrnb.h"
+#include "gromacs/legacyheaders/disre.h"
+#include "gromacs/legacyheaders/force.h"
#include "gstat.h"
-#include "main.h"
-#include "pdbio.h"
-#include "index.h"
-#include "mdatoms.h"
-#include "tpxio.h"
-#include "mdrun.h"
-#include "names.h"
-#include "matio.h"
-#include "mtop_util.h"
+#include "gromacs/legacyheaders/main.h"
+#include "gromacs/fileio/pdbio.h"
+#include "gromacs/topology/index.h"
+#include "gromacs/legacyheaders/mdatoms.h"
+#include "gromacs/fileio/tpxio.h"
+#include "gromacs/fileio/trxio.h"
+#include "gromacs/legacyheaders/mdrun.h"
+#include "gromacs/legacyheaders/names.h"
+#include "gromacs/topology/mtop_util.h"
#include "gmx_ana.h"
+#include "gromacs/commandline/pargs.h"
+#include "gromacs/fileio/matio.h"
+#include "gromacs/fileio/xvgr.h"
+#include "gromacs/math/do_fit.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/pbcutil/ishift.h"
+#include "gromacs/pbcutil/pbc.h"
+#include "gromacs/pbcutil/rmpbc.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/smalloc.h"
typedef struct {
int n;
fprintf(fp, "\n");
}
-static void check_viol(FILE *log, t_commrec *cr,
+static void check_viol(FILE *log,
t_ilist *disres, t_iparams forceparams[],
rvec x[], rvec f[],
- t_forcerec *fr, t_pbc *pbc, t_graph *g, t_dr_result dr[],
+ t_pbc *pbc, t_graph *g, t_dr_result dr[],
int clust_id, int isize, atom_id index[], real vvindex[],
t_fcdata *fcd)
{
t_iatom *forceatoms;
int i, j, nat, n, type, nviol, ndr, label;
real ener, rt, mviol, tviol, viol, lam, dvdl, drt;
+ rvec *fshift;
static gmx_bool bFirst = TRUE;
lam = 0;
while (((i+n) < disres->nr) &&
(forceparams[forceatoms[i+n]].disres.label == label));
- calc_disres_R_6(cr->ms, n, &forceatoms[i], forceparams,
+ calc_disres_R_6(n, &forceatoms[i], forceparams,
(const rvec*)x, pbc, fcd, NULL);
if (fcd->disres.Rt_6[0] <= 0)
dr[clust_id].aver_3[ndr] += drt;
dr[clust_id].aver_6[ndr] += fcd->disres.Rt_6[0];
+ snew(fshift, SHIFTS);
ener = interaction_function[F_DISRES].ifunc(n, &forceatoms[i], forceparams,
- (const rvec*)x, f, fr->fshift,
+ (const rvec*)x, f, fshift,
pbc, g, lam, &dvdl, NULL, fcd, NULL);
+ sfree(fshift);
viol = fcd->disres.sumviol;
if (viol > 0)
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", "<V> (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[])
{
const char *desc[] = {
- "[TT]g_disre[tt] computes violations of distance restraints.",
+ "[THISMODULE] computes violations of distance restraints.",
"If necessary, all protons can be added to a protein molecule ",
- "using the [TT]g_protonate[tt] program.[PAR]",
+ "using the [gmx-protonate] program.[PAR]",
"The program always",
"computes the instantaneous violations rather than time-averaged,",
"because this analysis is done from a trajectory file afterwards",
rvec *xtop;
gmx_localtop_t *top;
t_atoms *atoms = NULL;
- t_forcerec *fr;
t_fcdata fcd;
t_nrnb nrnb;
- t_commrec *cr;
t_graph *g;
int ntopatoms, natoms, i, j, kkk;
t_trxstatus *status;
gmx_rmpbc_t gpbc = NULL;
t_filenm fnm[] = {
- { efTPX, NULL, NULL, ffREAD },
+ { efTPR, NULL, NULL, ffREAD },
{ efTRX, "-f", NULL, ffREAD },
{ efXVG, "-ds", "drsum", ffWRITE },
{ efXVG, "-da", "draver", ffWRITE },
};
#define NFILE asize(fnm)
- cr = init_par(&argc, &argv);
- parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW | PCA_BE_NICE,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv);
+ if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW,
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ {
+ return 0;
+ }
- gmx_log_open(ftp2fn(efLOG, NFILE, fnm), cr, FALSE, 0, &fplog);
+ fplog = ftp2FILE(efLOG, NFILE, fnm, "w");
if (ntop)
{
init5(ntop);
}
- read_tpxheader(ftp2fn(efTPX, NFILE, fnm), &header, FALSE, NULL, NULL);
+ read_tpxheader(ftp2fn(efTPR, NFILE, fnm), &header, FALSE, NULL, NULL);
snew(xtop, header.natoms);
- read_tpx(ftp2fn(efTPX, NFILE, fnm), &ir, box, &ntopatoms, xtop, NULL, NULL, &mtop);
+ read_tpx(ftp2fn(efTPR, NFILE, fnm), &ir, box, &ntopatoms, xtop, NULL, NULL, &mtop);
bPDB = opt2bSet("-q", NFILE, fnm);
if (bPDB)
{
}
ir.dr_tau = 0.0;
- init_disres(fplog, &mtop, &ir, NULL, FALSE, &fcd, NULL, FALSE);
+ init_disres(fplog, &mtop, &ir, NULL, &fcd, NULL, FALSE);
natoms = read_first_x(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &t, &x, box);
snew(f, 5*natoms);
}
mdatoms = init_mdatoms(fplog, &mtop, ir.efep != efepNO);
- atoms2md(&mtop, &ir, 0, NULL, 0, mtop.natoms, mdatoms);
+ atoms2md(&mtop, &ir, 0, NULL, mtop.natoms, mdatoms);
update_mdatoms(mdatoms, ir.fepvals->init_lambda);
- fr = mk_forcerec();
- fprintf(fplog, "Made forcerec\n");
- init_forcerec(fplog, oenv, fr, NULL, &ir, &mtop, cr, box, FALSE,
- NULL, NULL, NULL, NULL, NULL, FALSE, -1);
init_nrnb(&nrnb);
if (ir.ePBC != epbcNONE)
{
}
my_clust = clust->inv_clust[j];
range_check(my_clust, 0, clust->clust->nr);
- check_viol(fplog, cr, &(top->idef.il[F_DISRES]),
+ check_viol(fplog, &(top->idef.il[F_DISRES]),
top->idef.iparams,
- x, f, fr, pbc_null, g, dr_clust, my_clust, isize, index, vvindex, &fcd);
+ x, f, pbc_null, g, dr_clust, my_clust, isize, index, vvindex, &fcd);
}
else
{
- check_viol(fplog, cr, &(top->idef.il[F_DISRES]),
+ check_viol(fplog, &(top->idef.il[F_DISRES]),
top->idef.iparams,
- x, f, fr, pbc_null, g, &dr, 0, isize, index, vvindex, &fcd);
+ x, f, pbc_null, g, &dr, 0, isize, index, vvindex, &fcd);
}
if (bPDB)
{
}
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");
do_view(oenv, opt2fn("-dm", NFILE, fnm), "-nxy");
}
- gmx_finalize_par();
-
gmx_log_close(fplog);
return 0;