#include "gromacs/legacyheaders/typedefs.h"
#include "gromacs/math/vec.h"
#include "gromacs/pbcutil/pbc.h"
+#include "gromacs/topology/atomprop.h"
#include "gromacs/topology/mtop_util.h"
#include "gromacs/topology/symtab.h"
#include "gromacs/topology/topology.h"
}
}
+static void tpx_make_chain_identifiers(t_atoms *atoms, t_block *mols)
+{
+ int m, a, a0, a1, r;
+ char c, chainid;
+ int chainnum;
+
+ /* We always assign a new chain number, but save the chain id characters
+ * for larger molecules.
+ */
+#define CHAIN_MIN_ATOMS 15
+
+ chainnum = 0;
+ chainid = 'A';
+ for (m = 0; m < mols->nr; m++)
+ {
+ a0 = mols->index[m];
+ a1 = mols->index[m+1];
+ if ((a1-a0 >= CHAIN_MIN_ATOMS) && (chainid <= 'Z'))
+ {
+ c = chainid;
+ chainid++;
+ }
+ else
+ {
+ c = ' ';
+ }
+ for (a = a0; a < a1; a++)
+ {
+ atoms->resinfo[atoms->atom[a].resind].chainnum = chainnum;
+ atoms->resinfo[atoms->atom[a].resind].chainid = c;
+ }
+ chainnum++;
+ }
+
+ /* Blank out the chain id if there was only one chain */
+ if (chainid == 'B')
+ {
+ for (r = 0; r < atoms->nres; r++)
+ {
+ atoms->resinfo[r].chainid = ' ';
+ }
+ }
+}
+
void read_stx_conf(const char *infile, char *title, t_atoms *atoms,
rvec x[], rvec *v, int *ePBC, matrix box)
{
gmx_incons("Not supported in read_stx_conf");
}
}
+
+static void done_gmx_groups_t(gmx_groups_t *g)
+{
+ int i;
+
+ for (i = 0; (i < egcNR); i++)
+ {
+ if (NULL != g->grps[i].nm_ind)
+ {
+ sfree(g->grps[i].nm_ind);
+ g->grps[i].nm_ind = NULL;
+ }
+ if (NULL != g->grpnr[i])
+ {
+ sfree(g->grpnr[i]);
+ g->grpnr[i] = NULL;
+ }
+ }
+ /* The contents of this array is in symtab, don't free it here */
+ sfree(g->grpname);
+}
+
+gmx_bool read_tps_conf(const char *infile, char *title, t_topology *top, int *ePBC,
+ rvec **x, rvec **v, matrix box, gmx_bool bMass)
+{
+ t_tpxheader header;
+ int natoms, i, version, generation;
+ gmx_bool bTop, bXNULL = FALSE;
+ gmx_mtop_t *mtop;
+ gmx_atomprop_t aps;
+
+ bTop = fn2bTPX(infile);
+ *ePBC = -1;
+ if (bTop)
+ {
+ read_tpxheader(infile, &header, TRUE, &version, &generation);
+ if (x)
+ {
+ snew(*x, header.natoms);
+ }
+ if (v)
+ {
+ snew(*v, header.natoms);
+ }
+ snew(mtop, 1);
+ *ePBC = read_tpx(infile, NULL, box, &natoms,
+ (x == NULL) ? NULL : *x, (v == NULL) ? NULL : *v, NULL, mtop);
+ *top = gmx_mtop_t_to_t_topology(mtop);
+ /* In this case we need to throw away the group data too */
+ done_gmx_groups_t(&mtop->groups);
+ sfree(mtop);
+ std::strcpy(title, *top->name);
+ tpx_make_chain_identifiers(&top->atoms, &top->mols);
+ }
+ else
+ {
+ get_stx_coordnum(infile, &natoms);
+ init_t_atoms(&top->atoms, natoms, (fn2ftp(infile) == efPDB));
+ if (x == NULL)
+ {
+ snew(x, 1);
+ bXNULL = TRUE;
+ }
+ snew(*x, natoms);
+ if (v)
+ {
+ snew(*v, natoms);
+ }
+ read_stx_conf(infile, title, &top->atoms, *x, (v == NULL) ? NULL : *v, ePBC, box);
+ if (bXNULL)
+ {
+ sfree(*x);
+ sfree(x);
+ }
+ if (bMass)
+ {
+ aps = gmx_atomprop_init();
+ for (i = 0; (i < natoms); i++)
+ {
+ if (!gmx_atomprop_query(aps, epropMass,
+ *top->atoms.resinfo[top->atoms.atom[i].resind].name,
+ *top->atoms.atomname[i],
+ &(top->atoms.atom[i].m)))
+ {
+ if (debug)
+ {
+ fprintf(debug, "Can not find mass for atom %s %d %s, setting to 1\n",
+ *top->atoms.resinfo[top->atoms.atom[i].resind].name,
+ top->atoms.resinfo[top->atoms.atom[i].resind].nr,
+ *top->atoms.atomname[i]);
+ }
+ }
+ }
+ gmx_atomprop_destroy(aps);
+ }
+ top->idef.ntypes = -1;
+ }
+
+ return bTop;
+}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, 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.
struct gmx_mtop_t;
struct t_atoms;
+struct t_topology;
int read_g96_conf(FILE *fp, const char *infile, t_trxframe *fr, char *line);
/* read a Gromos96 coordinate or trajectory file, *
* If ePBC!=NULL return the type of pbc in *ePBC or -1 if unknown.
*/
+gmx_bool read_tps_conf(const char *infile, char *title, struct t_topology *top,
+ int *ePBC, rvec **x, rvec **v, matrix box, gmx_bool bMass);
+/* Read title, top.atoms, x, v (if not NULL) and box from an STX file,
+ * memory for atoms, x and v will be allocated.
+ * Return TRUE if a complete topology was read.
+ * If infile is a TPX file read the whole top,
+ * else if bMass=TRUE, read the masses into top.atoms from the mass database.
+ */
+
#ifdef __cplusplus
}
#endif
#include <gtest/gtest.h>
#include "gromacs/fileio/filenm.h"
-#include "gromacs/fileio/tpxio.h"
#include "gromacs/math/vec.h"
#include "gromacs/math/vectypes.h"
#include "gromacs/topology/atoms.h"
#include <algorithm>
-#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/filenm.h"
#include "gromacs/fileio/gmxfio.h"
#include "gromacs/fileio/gmxfio-xdr.h"
#include "gromacs/legacyheaders/names.h"
#include "gromacs/legacyheaders/txtdump.h"
#include "gromacs/math/vec.h"
-#include "gromacs/topology/atomprop.h"
#include "gromacs/topology/block.h"
#include "gromacs/topology/mtop_util.h"
#include "gromacs/topology/symtab.h"
}
-void tpx_make_chain_identifiers(t_atoms *atoms, t_block *mols)
-{
- int m, a, a0, a1, r;
- char c, chainid;
- int chainnum;
-
- /* We always assign a new chain number, but save the chain id characters
- * for larger molecules.
- */
-#define CHAIN_MIN_ATOMS 15
-
- chainnum = 0;
- chainid = 'A';
- for (m = 0; m < mols->nr; m++)
- {
- a0 = mols->index[m];
- a1 = mols->index[m+1];
- if ((a1-a0 >= CHAIN_MIN_ATOMS) && (chainid <= 'Z'))
- {
- c = chainid;
- chainid++;
- }
- else
- {
- c = ' ';
- }
- for (a = a0; a < a1; a++)
- {
- atoms->resinfo[atoms->atom[a].resind].chainnum = chainnum;
- atoms->resinfo[atoms->atom[a].resind].chainid = c;
- }
- chainnum++;
- }
-
- /* Blank out the chain id if there was only one chain */
- if (chainid == 'B')
- {
- for (r = 0; r < atoms->nres; r++)
- {
- atoms->resinfo[r].chainid = ' ';
- }
- }
-}
-
static void do_moltype(t_fileio *fio, gmx_moltype_t *molt, gmx_bool bRead,
t_symtab *symtab, int file_version,
gmx_groups_t *groups)
{
return (efTPR == fn2ftp(file));
}
-
-static void done_gmx_groups_t(gmx_groups_t *g)
-{
- int i;
-
- for (i = 0; (i < egcNR); i++)
- {
- if (NULL != g->grps[i].nm_ind)
- {
- sfree(g->grps[i].nm_ind);
- g->grps[i].nm_ind = NULL;
- }
- if (NULL != g->grpnr[i])
- {
- sfree(g->grpnr[i]);
- g->grpnr[i] = NULL;
- }
- }
- /* The contents of this array is in symtab, don't free it here */
- sfree(g->grpname);
-}
-
-gmx_bool read_tps_conf(const char *infile, char *title, t_topology *top, int *ePBC,
- rvec **x, rvec **v, matrix box, gmx_bool bMass)
-{
- t_tpxheader header;
- int natoms, i, version, generation;
- gmx_bool bTop, bXNULL = FALSE;
- gmx_mtop_t *mtop;
- gmx_atomprop_t aps;
-
- bTop = fn2bTPX(infile);
- *ePBC = -1;
- if (bTop)
- {
- read_tpxheader(infile, &header, TRUE, &version, &generation);
- if (x)
- {
- snew(*x, header.natoms);
- }
- if (v)
- {
- snew(*v, header.natoms);
- }
- snew(mtop, 1);
- *ePBC = read_tpx(infile, NULL, box, &natoms,
- (x == NULL) ? NULL : *x, (v == NULL) ? NULL : *v, NULL, mtop);
- *top = gmx_mtop_t_to_t_topology(mtop);
- /* In this case we need to throw away the group data too */
- done_gmx_groups_t(&mtop->groups);
- sfree(mtop);
- std::strcpy(title, *top->name);
- tpx_make_chain_identifiers(&top->atoms, &top->mols);
- }
- else
- {
- get_stx_coordnum(infile, &natoms);
- init_t_atoms(&top->atoms, natoms, (fn2ftp(infile) == efPDB));
- if (x == NULL)
- {
- snew(x, 1);
- bXNULL = TRUE;
- }
- snew(*x, natoms);
- if (v)
- {
- snew(*v, natoms);
- }
- read_stx_conf(infile, title, &top->atoms, *x, (v == NULL) ? NULL : *v, ePBC, box);
- if (bXNULL)
- {
- sfree(*x);
- sfree(x);
- }
- if (bMass)
- {
- aps = gmx_atomprop_init();
- for (i = 0; (i < natoms); i++)
- {
- if (!gmx_atomprop_query(aps, epropMass,
- *top->atoms.resinfo[top->atoms.atom[i].resind].name,
- *top->atoms.atomname[i],
- &(top->atoms.atom[i].m)))
- {
- if (debug)
- {
- fprintf(debug, "Can not find mass for atom %s %d %s, setting to 1\n",
- *top->atoms.resinfo[top->atoms.atom[i].resind].name,
- top->atoms.resinfo[top->atoms.atom[i].resind].nr,
- *top->atoms.atomname[i]);
- }
- }
- }
- gmx_atomprop_destroy(aps);
- }
- top->idef.ntypes = -1;
- }
-
- return bTop;
-}
gmx_bool fn2bTPX(const char *file);
/* return if *file is one of the TPX file types */
-gmx_bool read_tps_conf(const char *infile, char *title, struct t_topology *top,
- int *ePBC, rvec **x, rvec **v, matrix box, gmx_bool bMass);
-/* Read title, top.atoms, x, v (if not NULL) and box from an STX file,
- * memory for atoms, x and v will be allocated.
- * Return TRUE if a complete topology was read.
- * If infile is a TPX file read the whole top,
- * else if bMass=TRUE, read the masses into top.atoms from the mass database.
- */
-
-void tpx_make_chain_identifiers(struct t_atoms *atoms, struct t_block *mols);
-
#ifdef __cplusplus
}
#endif
#include "eigio.h"
-#include "gromacs/fileio/tpxio.h"
#include "gromacs/fileio/trnio.h"
#include "gromacs/math/vec.h"
#include "gromacs/utility/futil.h"
#include <string.h>
#include "gromacs/commandline/pargs.h"
-#include "gromacs/fileio/tpxio.h"
+#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/gmxana/gmx_ana.h"
#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/matio.h"
#include "gromacs/fileio/pdbio.h"
-#include "gromacs/fileio/tpxio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/gmxana/gmx_ana.h"
#include "gromacs/gmxana/gstat.h"
#include <string.h>
#include "gromacs/commandline/pargs.h"
+#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/matio.h"
-#include "gromacs/fileio/tpxio.h"
#include "gromacs/fileio/trnio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/filenm.h"
#include "gromacs/fileio/pdbio.h"
-#include "gromacs/fileio/tpxio.h"
#include "gromacs/gmxana/gmx_ana.h"
#include "gromacs/legacyheaders/macros.h"
#include "gromacs/legacyheaders/txtdump.h"
#include <stdlib.h>
#include "gromacs/commandline/pargs.h"
-#include "gromacs/fileio/tpxio.h"
+#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/gmxana/gmx_ana.h"
#include <string.h>
#include "gromacs/commandline/pargs.h"
-#include "gromacs/fileio/tpxio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/gmxana/gmx_ana.h"
#include <string.h>
#include "gromacs/commandline/pargs.h"
+#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/matio.h"
-#include "gromacs/fileio/tpxio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/gmxana/gmx_ana.h"
#include "gromacs/gmxana/gstat.h"
#include "gromacs/commandline/pargs.h"
#include "gromacs/correlationfunctions/autocorr.h"
+#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/enxio.h"
#include "gromacs/fileio/matio.h"
#include "gromacs/fileio/trxio.h"
#include <stdlib.h>
#include "gromacs/commandline/pargs.h"
+#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/matio.h"
#include "gromacs/fileio/pdbio.h"
#include "gromacs/fileio/strdb.h"
-#include "gromacs/fileio/tpxio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/gmxana/gstat.h"
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, 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.
#include <string.h>
#include "gromacs/commandline/pargs.h"
-#include "gromacs/fileio/tpxio.h"
+#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/gmxana/gmx_ana.h"
#include "gromacs/gmxana/princ.h"
#include "gromacs/commandline/pargs.h"
#include "gromacs/fileio/confio.h"
-#include "gromacs/fileio/tpxio.h"
#include "gromacs/gmxana/gmx_ana.h"
#include "gromacs/legacyheaders/force.h"
#include "gromacs/legacyheaders/macros.h"
#include "gromacs/commandline/pargs.h"
#include "gromacs/correlationfunctions/autocorr.h"
-#include "gromacs/fileio/tpxio.h"
+#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/gmxana/gmx_ana.h"
#include <string.h>
#include "gromacs/commandline/pargs.h"
+#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/matio.h"
-#include "gromacs/fileio/tpxio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/gmxana/binsearch.h"
#include "gromacs/commandline/pargs.h"
#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/pdbio.h"
-#include "gromacs/fileio/tpxio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/gmxana/eigio.h"
#include "gromacs/legacyheaders/macros.h"
#include <string.h>
#include "gromacs/commandline/pargs.h"
+#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/filenm.h"
#include "gromacs/fileio/matio.h"
-#include "gromacs/fileio/tpxio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/gmxana/gmx_ana.h"
#include <string.h>
#include "gromacs/commandline/pargs.h"
-#include "gromacs/fileio/tpxio.h"
+#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/gmxana/gmx_ana.h"
#include "gromacs/commandline/pargs.h"
#include "gromacs/fileio/confio.h"
-#include "gromacs/fileio/tpxio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/gmxana/gmx_ana.h"
#include <string.h>
#include "gromacs/commandline/pargs.h"
+#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/pdbio.h"
-#include "gromacs/fileio/tpxio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/gmxana/eigio.h"
#include "gromacs/gmxana/gmx_ana.h"
#include <string.h>
#include "gromacs/commandline/pargs.h"
+#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/pdbio.h"
-#include "gromacs/fileio/tpxio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/gmxana/eigio.h"
#include "gromacs/gmxana/gmx_ana.h"
#include "gromacs/commandline/pargs.h"
#include "gromacs/fileio/confio.h"
-#include "gromacs/fileio/tpxio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/gmxana/cmat.h"
#include <string.h>
#include "gromacs/commandline/pargs.h"
-#include "gromacs/fileio/tpxio.h"
+#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/gmxana/gmx_ana.h"
#include <stdlib.h>
#include "gromacs/commandline/pargs.h"
+#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/matio.h"
-#include "gromacs/fileio/tpxio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/gmxana/cmat.h"
#include <math.h>
#include "gromacs/commandline/pargs.h"
+#include "gromacs/fileio/confio.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/commandline/pargs.h"
#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/pdbio.h"
-#include "gromacs/fileio/tpxio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/gmxana/gmx_ana.h"
int step, nre, natoms, i, g, m, teller = 0;
real t, lambda, *w_rls, *w_rms;
- t_tpxheader header;
t_inputrec ir;
t_topology top;
int ePBC;
#include <string.h>
#include "gromacs/commandline/pargs.h"
-#include "gromacs/fileio/tpxio.h"
+#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/gmxana/gmx_ana.h"
#include "config.h"
#include "gromacs/commandline/pargs.h"
-#include "gromacs/fileio/tpxio.h"
+#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/gmxana/gmx_ana.h"
#include "gmxpre.h"
#include "gromacs/commandline/pargs.h"
-#include "gromacs/fileio/tpxio.h"
+#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/gmxana/gmx_ana.h"
#include <stdlib.h>
#include "gromacs/commandline/pargs.h"
-#include "gromacs/fileio/tpxio.h"
+#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/gmxana/gmx_ana.h"
#include "gromacs/legacyheaders/macros.h"
#include "gromacs/commandline/pargs.h"
#include "gromacs/fileio/confio.h"
-#include "gromacs/fileio/tpxio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/gmxana/gmx_ana.h"
#include "gromacs/fileio/pdbio.h"
#include "gromacs/fileio/tngio.h"
#include "gromacs/fileio/tngio_for_tools.h"
-#include "gromacs/fileio/tpxio.h"
#include "gromacs/fileio/trnio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xtcio.h"
#include <string.h>
#include "gromacs/commandline/pargs.h"
-#include "gromacs/fileio/tpxio.h"
+#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/gmxana/gmx_ana.h"
#include <string.h>
#include "gromacs/commandline/pargs.h"
+#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/matio.h"
-#include "gromacs/fileio/tpxio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/gmxana/gmx_ana.h"
#include "sfactor.h"
+#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/strdb.h"
-#include "gromacs/fileio/tpxio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/legacyheaders/macros.h"
#include <cstring>
-#include "gromacs/fileio/tpxio.h"
+#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/trx.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/math/vec.h"
#include <string.h>
+#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/timecontrol.h"
-#include "gromacs/fileio/tpxio.h"
#include "gromacs/fileio/trx.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/legacyheaders/oenv.h"