}
}
-static void read_stx_conf(const char *infile, char *title, t_topology *top,
+static void read_stx_conf(const char *infile, t_topology *top,
rvec x[], rvec *v, int *ePBC, matrix box)
{
FILE *in;
switch (ftp)
{
case efGRO:
- gmx_gro_read_conf(infile, title, top, x, v, box);
+ gmx_gro_read_conf(infile, top, x, v, box);
break;
case efG96:
fr.title = NULL;
read_g96_conf(in, infile, &fr, &top->symtab, g96_line);
gmx_fio_fclose(in);
copy_mat(fr.box, box);
- std::strncpy(title, fr.title, STRLEN);
+ top->name = put_symtab(&top->symtab, fr.title);
sfree(const_cast<char *>(fr.title));
break;
case efPDB:
case efBRK:
case efENT:
- gmx_pdb_read_conf(infile, title, top, x, ePBC, box);
+ gmx_pdb_read_conf(infile, top, x, ePBC, box);
break;
case efESP:
- gmx_espresso_read_conf(infile, title, top, x, v, box);
+ gmx_espresso_read_conf(infile, top, x, v, box);
break;
default:
gmx_incons("Not supported in read_stx_conf");
sfree(g->grpname);
}
-gmx_bool read_tps_conf(const char *infile, char *title, t_topology *top, int *ePBC,
+gmx_bool read_tps_conf(const char *infile, t_topology *top, int *ePBC,
rvec **x, rvec **v, matrix box, gmx_bool bMass)
{
t_tpxheader header;
/* 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
{
snew(*v, natoms);
}
- read_stx_conf(infile, title, top, *x, (v == NULL) ? NULL : *v, ePBC, box);
+ read_stx_conf(infile, top, *x, (v == NULL) ? NULL : *v, ePBC, box);
if (bXNULL)
{
sfree(*x);
rvec x[], rvec *v, int ePBC, matrix box);
/* As write_sto_conf, but uses a gmx_mtop_t struct */
-gmx_bool read_tps_conf(const char *infile, char *title, struct t_topology *top,
+gmx_bool read_tps_conf(const char *infile, 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.
"molecule"
};
-void gmx_espresso_read_conf(const char *infile, char *title,
+void gmx_espresso_read_conf(const char *infile,
t_topology *top, rvec x[], rvec *v, matrix box)
{
t_atoms *atoms = &top->atoms;
gmx_bool bFoundParticles, bFoundProp, bFoundVariable, bMol;
// TODO: The code does not understand titles it writes...
- title[0] = '\0';
+ top->name = put_symtab(&top->symtab, "");
clear_mat(box);
struct t_atoms;
struct t_topology;
-void gmx_espresso_read_conf(const char *infile, char *title,
+void gmx_espresso_read_conf(const char *infile,
t_topology *top, rvec x[], rvec *v, matrix box);
int get_espresso_coordnum(const char *infile);
return bVel;
}
-void gmx_gro_read_conf(const char *infile, char *title,
+void gmx_gro_read_conf(const char *infile,
t_topology *top, rvec x[], rvec *v, matrix box)
{
FILE *in = gmx_fio_fopen(infile, "r");
int ndec;
+ char title[STRLEN];
get_w_conf(in, infile, title, &top->symtab, &top->atoms, &ndec, x, v, box);
+ top->name = put_symtab(&top->symtab, title);
gmx_fio_fclose(in);
}
struct t_trxframe;
void get_coordnum(const char *infile, int *natoms);
-void gmx_gro_read_conf(const char *infile, char *title,
+void gmx_gro_read_conf(const char *infile,
struct t_topology *top, rvec x[], rvec *v, matrix box);
gmx_bool gro_next_x_or_v(FILE *status, struct t_trxframe *fr);
}
}
-void gmx_pdb_read_conf(const char *infile, char *title,
+void gmx_pdb_read_conf(const char *infile,
t_topology *top, rvec x[], int *ePBC, matrix box)
{
FILE *in = gmx_fio_fopen(infile, "r");
+ char title[STRLEN];
read_pdbfile(in, title, NULL, &top->atoms, &top->symtab, x, ePBC, box, TRUE, NULL);
+ top->name = put_symtab(&top->symtab, title);
gmx_fio_fclose(in);
}
* ePBC and gmx_conect structure may be NULL.
*/
-void gmx_pdb_read_conf(const char *infile, char *title,
+void gmx_pdb_read_conf(const char *infile,
struct t_topology *top, rvec x[], int *ePBC, matrix box);
/* Read a pdb file and extract ATOM and HETATM fields.
* Read a box from the CRYST1 line, return 0 box when no CRYST1 is found.
{
snew(testTop_, 1);
int ePBC = -2;
- char title[STRLEN];
- read_tps_conf(referenceFilename_.c_str(), title, testTop_,
+ read_tps_conf(referenceFilename_.c_str(), testTop_,
&ePBC, &testX_, NULL, testBox_, FALSE);
- testTop_->name = put_symtab(&testTop_->symtab, title);
}
void testTopologies()
{
t_pdbfile *pdbf;
double e;
- char buf[256], *ptr;
FILE *fp;
snew(pdbf, 1);
t_topology top;
- read_tps_conf(fn, buf, &top, &pdbf->ePBC, &pdbf->x, NULL, pdbf->box, FALSE);
+ read_tps_conf(fn, &top, &pdbf->ePBC, &pdbf->x, NULL, pdbf->box, FALSE);
pdbf->atoms = top.atoms;
fp = gmx_ffopen(fn, "r");
- do
+ char buf[256], *ptr;
+ while ((ptr = fgets2(buf, 255, fp)) != NULL)
{
- ptr = fgets2(buf, 255, fp);
- if (ptr)
+ if (std::strstr(buf, "Intermolecular") != NULL)
{
- if (std::strstr(buf, "Intermolecular") != NULL)
- {
- ptr = std::strchr(buf, '=');
- sscanf(ptr+1, "%lf", &e);
- pdbf->edocked = e;
- }
- else if (std::strstr(buf, "Estimated Free") != NULL)
- {
- ptr = std::strchr(buf, '=');
- sscanf(ptr+1, "%lf", &e);
- pdbf->efree = e;
- }
+ ptr = std::strchr(buf, '=');
+ sscanf(ptr+1, "%lf", &e);
+ pdbf->edocked = e;
+ }
+ else if (std::strstr(buf, "Estimated Free") != NULL)
+ {
+ ptr = std::strchr(buf, '=');
+ sscanf(ptr+1, "%lf", &e);
+ pdbf->efree = e;
}
}
- while (ptr != NULL);
gmx_ffclose(fp);
return pdbf;
int natoms;
char *grpname;
const char *indexfile;
- char title[STRLEN];
int i, j, d;
int nout, *iout, noutvec, *outvec, nfit;
atom_id *index = NULL, *ifit = NULL;
else
{
bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm),
- title, &top, &ePBC, &xtop, NULL, topbox, bM);
+ &top, &ePBC, &xtop, NULL, topbox, bM);
atoms = &top.atoms;
gpbc = gmx_rmpbc_init(&top.idef, ePBC, atoms->nr);
gmx_rmpbc(gpbc, atoms->nr, topbox, xtop);
t_trxframe fr;
t_atoms outatoms;
real t, comp;
- char *grpname[MAX_ENDS], title[256];
+ char *grpname[MAX_ENDS];
/* FIXME: The constness should not be cast away */
char *anm = (char *)"CA", *rnm = (char *)"GLY";
int i, gnx[MAX_ENDS];
return 0;
}
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), title, &top, &ePBC, &xtop, NULL, box, TRUE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, NULL, box, TRUE);
bKink = opt2bSet("-ok", NFILE, fnm) || opt2bSet("-okr", NFILE, fnm)
|| opt2bSet("-okl", NFILE, fnm);
rvec *x;
int ePBC;
matrix box;
- char title[256], grpname[256];
+ char grpname[256];
t_dlist *dlist;
gmx_bool bChi, bCorr, bSSHisto;
gmx_bool bDo_rt, bDo_oh, bDo_ot, bDo_jc;
/* Find the chi angles using atoms struct and a list of amino acids */
t_topology *top;
snew(top, 1);
- read_tps_conf(ftp2fn(efSTX, NFILE, fnm), title, top, &ePBC, &x, NULL, box, FALSE);
+ read_tps_conf(ftp2fn(efSTX, NFILE, fnm), top, &ePBC, &x, NULL, box, FALSE);
t_atoms &atoms = top->atoms;
if (atoms.pdbinfo == NULL)
{
snew(atoms.pdbinfo, atoms.nr);
}
- fprintf(log, "Title: %s\n", title);
+ fprintf(log, "Title: %s\n", *top->name);
gmx_residuetype_init(&rt);
dlist = mk_dlist(log, &atoms, &nlist, bPhi, bPsi, bChi, bHChi, maxchi, r0, rt);
if (bReadTraj)
{
/* don't read mass-database as masses (and top) are not used */
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), buf, &top, &ePBC, &xtps, NULL, box,
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtps, NULL, box,
TRUE);
if (bPBC)
{
/* the two structure files */
const char *conf1file, *conf2file, *matchndxfile, *outfile;
FILE *fp;
- char title1[STRLEN], title2[STRLEN], *name1, *name2;
+ char *name1, *name2;
t_topology *top1, *top2;
int ePBC1, ePBC2;
t_atoms *atoms1, *atoms2;
/* reading reference structure from first structure file */
fprintf(stderr, "\nReading first structure file\n");
snew(top1, 1);
- read_tps_conf(conf1file, title1, top1, &ePBC1, &x1, &v1, box1, TRUE);
+ read_tps_conf(conf1file, top1, &ePBC1, &x1, &v1, box1, TRUE);
atoms1 = &(top1->atoms);
fprintf(stderr, "%s\nContaining %d atoms in %d residues\n",
- title1, atoms1->nr, atoms1->nres);
+ *top1->name, atoms1->nr, atoms1->nres);
if (bRmpbc)
{
/* reading second structure file */
fprintf(stderr, "\nReading second structure file\n");
snew(top2, 1);
- read_tps_conf(conf2file, title2, top2, &ePBC2, &x2, &v2, box2, TRUE);
+ read_tps_conf(conf2file, top2, &ePBC2, &x2, &v2, box2, TRUE);
atoms2 = &(top2->atoms);
fprintf(stderr, "%s\nContaining %d atoms in %d residues\n",
- title2, atoms2->nr, atoms2->nres);
+ *top2->name, atoms2->nr, atoms2->nres);
if (bRmpbc)
{
fp = gmx_ffopen(outfile, "w");
if (!bOne)
{
- write_pdbfile(fp, title1, atoms1, x1, ePBC1, box1, ' ', 1, NULL, TRUE);
+ write_pdbfile(fp, *top1->name, atoms1, x1, ePBC1, box1, ' ', 1, NULL, TRUE);
}
- write_pdbfile(fp, title2, atoms2, x2, ePBC2, box2, ' ', bOne ? -1 : 2, NULL, TRUE);
+ write_pdbfile(fp, *top2->name, atoms2, x2, ePBC2, box2, ' ', bOne ? -1 : 2, NULL, TRUE);
gmx_ffclose(fp);
break;
case efGRO:
fp = gmx_ffopen(outfile, "w");
if (!bOne)
{
- write_hconf_p(fp, title1, atoms1, 3, x1, v1, box1);
+ write_hconf_p(fp, *top1->name, atoms1, 3, x1, v1, box1);
}
- write_hconf_p(fp, title2, atoms2, 3, x2, v2, box2);
+ write_hconf_p(fp, *top2->name, atoms2, 3, x2, v2, box2);
gmx_ffclose(fp);
break;
default:
"WARNING: cannot write the reference structure to %s file\n",
ftp2ext(fn2ftp(outfile)));
}
- write_sto_conf(outfile, title2, atoms2, x2, v2, ePBC2, box2);
+ write_sto_conf(outfile, *top2->name, atoms2, x2, v2, ePBC2, box2);
break;
}
xpmfile = opt2fn_null("-xpm", NFILE, fnm);
xpmafile = opt2fn_null("-xpma", NFILE, fnm);
- read_tps_conf(fitfile, str, &top, &ePBC, &xref, NULL, box, TRUE);
+ read_tps_conf(fitfile, &top, &ePBC, &xref, NULL, box, TRUE);
atoms = &top.atoms;
if (bFit)
output_env_t oenv;
t_topology top;
- char title[STRLEN];
char **grpname = NULL;
const char *indexfn;
t_trxframe fr;
real *mass2 = NULL;
- rvec *xtop, *vtop;
matrix box;
atom_id *index0;
int *indexm = NULL;
bACF = opt2bSet("-caf", NFILE, fnm);
bINT = opt2bSet("-mc", NFILE, fnm);
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), title, &top, &ePBC, &xtop, &vtop, box, TRUE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, NULL, NULL, box, TRUE);
-
-
- sfree(xtop);
- sfree(vtop);
indexfn = ftp2fn_null(efNDX, NFILE, fnm);
snew(grpname, 1);
real t, m, mtot;
t_pbc pbc;
int cav = 0, c1 = 0, c2 = 0;
- char **grpname, title[256], buf[STRLEN];
+ char **grpname, buf[STRLEN];
const char *unit;
int i, j, k, l, ngrps, anagrp, *gnx = NULL, nindex, nradial = 0, nfr, nmpower;
atom_id **ind = NULL, *index;
if (ftp2bSet(efTPS, NFILE, fnm) || !ftp2bSet(efNDX, NFILE, fnm))
{
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), title, &top, &ePBC, &x, NULL, box,
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, NULL, box,
bRadial);
}
if (!bRadial)
rvec *xp, *x;
int *average_area;
real **accr, *accr_ptr = NULL, *av_area, *norm_av_area;
- char pdbfile[32], tmpfile[32], title[256];
+ char pdbfile[32], tmpfile[32];
char dssp[256];
const char *dptr;
output_env_t oenv;
fnAArea = opt2fn_null("-aa", NFILE, fnm);
bDoAccSurf = (fnArea || fnTArea || fnAArea);
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), title, &top, &ePBC, &xp, NULL, box, FALSE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xp, NULL, box, FALSE);
atoms = &(top.atoms);
check_oo(atoms);
bPhbres = bPhobics(atoms);
t_trxframe fr;
matrix box;
int gnx;
- char title[256];
real t0, t1;
t_trxstatus *status;
int nV, nframes, n_alloc, i, j, fftcode, Nmol, Natom;
please_cite(fplog, "Pascal2011a");
please_cite(fplog, "Caleman2011b");
- read_tps_conf(ftp2fn(efTPR, NFILE, fnm), title, &top, &ePBC, NULL, NULL, box, TRUE);
+ read_tps_conf(ftp2fn(efTPR, NFILE, fnm), &top, &ePBC, NULL, NULL, box, TRUE);
/* Handle index groups */
get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &grpNatoms, &index, &grpname);
rho = (tmass*AMU)/(V*NANO*NANO*NANO);
sigHS = std::pow(6*y*V/(M_PI*Natom), 1.0/3.0);
- fprintf(fplog, "System = \"%s\"\n", title);
+ fprintf(fplog, "System = \"%s\"\n", *top.name);
fprintf(fplog, "Nmol = %d\n", Nmol);
fprintf(fplog, "Natom = %d\n", Natom);
fprintf(fplog, "dt = %g ps\n", dt);
int i, j, natoms, isize;
t_trxstatus *status;
atom_id *index = NULL, *index_all;
- char title[256], *grpname;
+ char *grpname;
real angle, trans;
rvec *x, *v, *xout, *vout;
matrix box;
t_topology *top;
snew(top, 1);
- read_tps_conf(opt2fn("-f", NFILE, fnm), title, top, NULL, &x, &v, box, FALSE);
+ read_tps_conf(opt2fn("-f", NFILE, fnm), top, NULL, &x, &v, box, FALSE);
t_atoms &atoms = top->atoms;
if (atoms.pdbinfo == NULL)
{
FILE *out;
const char *infile, *outfile;
- char title[STRLEN];
int outftp, inftp, natom, i, j, n_bfac, itype, ntype;
double *bfac = NULL, c6, c12;
int *bfac_nr = NULL;
t_topology *top_tmp;
snew(top_tmp, 1);
- read_tps_conf(infile, title, top_tmp, &ePBC, &x, &v, box, FALSE);
+ read_tps_conf(infile, top_tmp, &ePBC, &x, &v, box, FALSE);
t_atoms &atoms = top_tmp->atoms;
natom = atoms.nr;
if (atoms.pdbinfo == NULL)
if (outftp == efPDB)
{
out = gmx_ffopen(outfile, "w");
- write_pdbfile_indexed(out, title, &atoms, x, ePBC, box, ' ', 1, isize, index, conect, TRUE);
+ write_pdbfile_indexed(out, *top_tmp->name, &atoms, x, ePBC, box, ' ', 1, isize, index, conect, TRUE);
gmx_ffclose(out);
}
else
{
- write_sto_conf_indexed(outfile, title, &atoms, x, bHaveV ? v : NULL, ePBC, box, isize, index);
+ write_sto_conf_indexed(outfile, *top_tmp->name, &atoms, x, bHaveV ? v : NULL, ePBC, box, isize, index);
}
}
else
atoms.resinfo[atoms.atom[i].resind].chainid = label[0];
}
}
- write_pdbfile(out, title, &atoms, x, ePBC, box, ' ', -1, conect, TRUE);
+ write_pdbfile(out, *top_tmp->name, &atoms, x, ePBC, box, ' ', -1, conect, TRUE);
if (bLegend)
{
pdb_legend(out, atoms.nr, atoms.nres, &atoms, x);
}
else
{
- write_sto_conf(outfile, title, &atoms, x, bHaveV ? v : NULL, ePBC, box);
+ write_sto_conf(outfile, *top_tmp->name, &atoms, x, bHaveV ? v : NULL, ePBC, box);
}
}
gmx_atomprop_destroy(aps);
int ePBC = -1;
rvec *xtop;
matrix topbox, *box, boxf;
- char title[256], *grpname;
+ char *grpname;
int isize;
atom_id *index;
real *w_rls = NULL;
}
if (topfile)
{
- bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), title, &top, &ePBC,
+ bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC,
&xtop, NULL, topbox, TRUE);
if (bTop)
{
t_pbc pbc;
int *repl, ePBC;
atom_id *index;
- char *grpname, title[STRLEN];
+ char *grpname;
gmx_bool *bSet;
int i, nw, nwa, nsa, nsalt, iqtot;
output_env_t oenv;
}
/* Read atom positions and charges */
- read_tps_conf(ftp2fn(efTPR, NFILE, fnm), title, &top, &ePBC, &x, &v, box, FALSE);
+ read_tps_conf(ftp2fn(efTPR, NFILE, fnm), &top, &ePBC, &x, &v, box, FALSE);
atoms = top.atoms;
/* Compute total charge */
atom_id *ind_grp;
const char *xfn, *nfn;
char *gn_grp;
- char title[STRLEN];
matrix box;
gmx_bool bFreeze;
rvec dx, *x = NULL, *v = NULL;
gmx_fatal(FARGS, "disre_dist should be >= 0");
}
+ const char *title = "";
if (xfn != NULL)
{
fprintf(stderr, "\nReading structure file\n");
- t_topology *top;
+ t_topology *top = NULL;
snew(top, 1);
- read_tps_conf(xfn, title, top, NULL, &x, &v, box, FALSE);
+ read_tps_conf(xfn, top, NULL, &x, &v, box, FALSE);
+ title = *top->name;
atoms = &top->atoms;
if (atoms->pdbinfo == NULL)
{
rvec d, d1; /* eigenvalues of inertia tensor */
real t, t0, tm, gyro;
int natoms;
- char *grpname, title[256];
+ char *grpname;
int j, m, gnx, nam, mol;
atom_id *index;
output_env_t oenv;
printf("Will print radius normalised by charge\n");
}
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), title, &top, &ePBC, &x, NULL, box, TRUE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, NULL, box, TRUE);
get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &gnx, &index, &grpname);
if (nmol > gnx || gnx % nmol != 0)
FILE *fpsg = NULL, *fpsk = NULL;
t_topology top;
int ePBC;
- char title[STRLEN];
t_trxstatus *status;
int natoms;
real t;
* i.e 1D Row-major order in (t,x,y) */
- read_tps_conf(fnTPS, title, &top, &ePBC, &xtop, NULL, box, FALSE);
+ read_tps_conf(fnTPS, &top, &ePBC, &xtop, NULL, box, FALSE);
*nslicex = static_cast<int>(box[XX][XX]/binw + onehalf); /*Calculate slicenr from binwidth*/
*nslicey = static_cast<int>(box[YY][YY]/binw + onehalf);
write_t_edx(fp, edpars->sori, "NORIGIN, XORIGIN");
}
-int read_conffile(const char *confin, char *title, rvec **x)
+int read_conffile(const char *confin, rvec **x)
{
t_topology top;
matrix box;
printf("read coordnumber from file %s\n", confin);
- read_tps_conf(confin, title, &top, NULL, x, NULL, box, FALSE);
+ read_tps_conf(confin, &top, NULL, x, NULL, box, FALSE);
printf("number of coordinates in file %d\n", top.atoms.nr);
return top.atoms.nr;
}
int ngro;
int ntar;
rvec *xtar;
- char title[STRLEN];
char * grpname;
- ntar = read_conffile(StructureFile, title, &xtar);
+ ntar = read_conffile(StructureFile, &xtar);
printf("Select an index group of %d elements that corresponds to the atoms in the structure file %s\n",
ntar, StructureFile);
get_index(atoms, IndexFile, 1, &ngro, &igro, &grpname);
/*to read topology file*/
t_topology top;
int ePBC;
- char title[STRLEN];
matrix topbox;
rvec *xtop;
gmx_bool bFit1;
&xref1, &edi_params.fitmas, &xav1, &edi_params.pcamas, &nvec1, &eignr1, &eigvec1, &eigval1);
read_tps_conf(ftp2fn(efTPS, NFILE, fnm),
- title, &top, &ePBC, &xtop, NULL, topbox, 0);
+ &top, &ePBC, &xtop, NULL, topbox, 0);
atoms = &top.atoms;
#define NPA asize(pa)
output_env_t oenv;
- char title[STRLEN];
int nndxin;
const char *stxfile;
char **ndxinfiles;
t_topology *top;
snew(top, 1);
fprintf(stderr, "\nReading structure file\n");
- read_tps_conf(stxfile, title, top, &ePBC, &x, &v, box, FALSE);
+ read_tps_conf(stxfile, top, &ePBC, &x, &v, box, FALSE);
atoms = &top->atoms;
if (atoms->pdbinfo == NULL)
{
t_trxstatus *status;
gmx_bool bCalcN, bFrames;
real t, ratio;
- char title[256], label[234];
+ char label[234];
t_rgb rlo, rhi;
rvec *x;
real **mdmat, *resnr, **totmdmat;
fprintf(stderr, "Will calculate number of different contacts\n");
}
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), title, &top, &ePBC, &x, NULL, box, FALSE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, NULL, box, FALSE);
fprintf(stderr, "Select group for analysis\n");
get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &isize, &index, &grpname);
output_env_t oenv;
t_topology *top = NULL;
int ePBC = -1;
- char title[256];
rvec *x;
matrix box;
gmx_bool bTop = FALSE;
if (tpsfnm || resfnm || !ndxfnm)
{
snew(top, 1);
- bTop = read_tps_conf(tpsfnm, title, top, &ePBC, &x, NULL, box, FALSE);
+ bTop = read_tps_conf(tpsfnm, top, &ePBC, &x, NULL, box, FALSE);
if (bPI && !bTop)
{
printf("\nWARNING: Without a run input file a trajectory with broken molecules will not give the correct periodic image distance\n\n");
rvec *x1, *x2, *xx;
matrix box;
real rms1, rms2, fac, *mass;
- char title[STRLEN], *grpname;
+ char *grpname;
gmx_bool bRMS;
output_env_t oenv;
t_topology *top;
snew(top, 1);
- read_tps_conf(opt2fn("-f1", NFILE, fnm), title, top, NULL, &x1, NULL, box, FALSE);
+ read_tps_conf(opt2fn("-f1", NFILE, fnm), top, NULL, &x1, NULL, box, FALSE);
nat1 = top->atoms.nr;
- read_tps_conf(opt2fn("-f2", NFILE, fnm), title, top, NULL, &x2, NULL, box, FALSE);
+ read_tps_conf(opt2fn("-f2", NFILE, fnm), top, NULL, &x2, NULL, box, FALSE);
nat2 = top->atoms.nr;
if (nat1 != nat2)
{
t_topology top;
int ePBC;
matrix box;
- char title[256];
const char *trx_file, *tps_file, *ndx_file, *msd_file, *mol_file, *pdb_file;
rvec *xdum;
gmx_bool bTop;
gmx_fatal(FARGS, "Can only calculate the full tensor for 3D msd");
}
- bTop = read_tps_conf(tps_file, title, &top, &ePBC, &xdum, NULL, box, bMW || bRmCOMM);
+ bTop = read_tps_conf(tps_file, &top, &ePBC, &xdum, NULL, box, bMW || bRmCOMM);
if (mol_file && !bTop)
{
gmx_fatal(FARGS,
matrix box;
real *eigval, *invsqrtm, t, disp;
int natoms;
- char *grpname, title[STRLEN];
+ char *grpname;
const char *indexfile;
int i, j, d, s, v;
int nout, *iout, noutvec, *outvec;
read_eigenvectors(opt2fn("-v", NFILE, fnm), &natoms, &bFit,
&xref, &bDMR, &xav, &bDMA, &nvec, &eignr, &eigvec, &eigval);
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), title, &top, &ePBC, &xtop, NULL, box, bDMA);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, NULL, box, bDMA);
atoms = &top.atoms;
printf("\nSelect an index group of %d elements that corresponds to the eigenvectors\n", natoms);
real * eigval;
int * dummy;
real * invsqrtm;
- char title[STRLEN];
real fraction;
int *out_eigidx;
rvec * this_eigvec;
read_eigenvectors(opt2fn("-v", NFILE, fnm), &natoms, &bFit,
&xref, &bDMR, &xav, &bDMA, &nvec, &eignr, &eigvec, &eigval);
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), title, &top, &ePBC, &xtop, NULL, box, bDMA);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, NULL, box, bDMA);
/* Find vectors and phases */
FILE *fpsg = NULL, *fpsk = NULL;
t_topology top;
int ePBC;
- char title[STRLEN];
t_trxstatus *status;
int natoms;
real t;
gmx_rmpbc_t gpbc = NULL;
- read_tps_conf(fnTPS, title, &top, &ePBC, &xtop, NULL, box, FALSE);
+ read_tps_conf(fnTPS, &top, &ePBC, &xtop, NULL, box, FALSE);
snew(sg_slice, nslice);
snew(sk_slice, nslice);
rvec * x;
int natoms;
- char *grpname, title[256];
+ char *grpname;
int i, gnx;
atom_id *index;
rvec moi;
}
sfree(legend);
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), title, &top, &ePBC, NULL, NULL, box, TRUE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, NULL, NULL, box, TRUE);
get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &gnx, &index, &grpname);
}
}
- bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), buf, &top, &ePBC, &xp,
+ bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xp,
NULL, box, TRUE);
snew(w_rls, top.atoms.nr);
snew(w_rms, top.atoms.nr);
t_noe_gr *noe_gr = NULL;
t_noe **noe = NULL;
t_rgb rlo, rhi;
- char buf[255];
gmx_bool bRMS, bScale, bMean, bNOE, bNMR3, bNMR6, bNMR;
static int nlevels = 40;
}
/* get topology and index */
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), buf, &top, &ePBC, &x, NULL, box, FALSE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, NULL, box, FALSE);
if (!bPBC)
{
rvec *x, *pdbx, *xref;
t_trxstatus *status;
const char *label;
- char title[STRLEN];
FILE *fp; /* the graphics file */
const char *devfn, *dirfn;
devfn = opt2fn_null("-od", NFILE, fnm);
dirfn = opt2fn_null("-dir", NFILE, fnm);
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), title, &top, &ePBC, &xref, NULL, box, TRUE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xref, NULL, box, TRUE);
+ const char *title = *top.name;
snew(w_rls, top.atoms.nr);
fprintf(stderr, "Select group(s) for root mean square calculation\n");
t_topology *top_pdb;
snew(top_pdb, 1);
/* Read coordinates twice */
- read_tps_conf(opt2fn("-q", NFILE, fnm), title, top_pdb, NULL, NULL, NULL, pdbbox, FALSE);
+ read_tps_conf(opt2fn("-q", NFILE, fnm), top_pdb, NULL, NULL, NULL, pdbbox, FALSE);
snew(pdbatoms, 1);
*pdbatoms = top_pdb->atoms;
- read_tps_conf(opt2fn("-q", NFILE, fnm), title, top_pdb, NULL, &pdbx, NULL, pdbbox, FALSE);
+ read_tps_conf(opt2fn("-q", NFILE, fnm), top_pdb, NULL, &pdbx, NULL, pdbbox, FALSE);
+ title = *top_pdb->name;
snew(refatoms, 1);
*refatoms = top_pdb->atoms;
sfree(top_pdb);
matrix box, R;
real t;
int natoms, i;
- char *grpname, title[256];
+ char *grpname;
int gnx;
gmx_rmpbc_t gpbc = NULL;
atom_id *index;
return 0;
}
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), title, &top, &ePBC, &x_ref, NULL, box, bMW);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x_ref, NULL, box, bMW);
gpbc = gmx_rmpbc_init(&top.idef, ePBC, top.atoms.nr);
gmx_bool bMC = FALSE;
int ePBC = -1;
matrix box;
- char title[STRLEN];
rvec *x;
int natoms;
real t;
snew(grpname, 1);
snew(index, 1);
- read_tps_conf(fnTPX, title, top, &ePBC, &x, NULL, box, TRUE);
+ read_tps_conf(fnTPX, top, &ePBC, &x, NULL, box, TRUE);
printf("\nPlease select group for SANS spectra calculation:\n");
get_index(&(top->atoms), ftp2fn_null(efNDX, NFILE, fnm), 1, &isize, &index, grpname);
{
t_topology top;
int ePBC = -1;
- char title[STRLEN];
t_trxstatus *status;
int natoms;
real t;
bTPS = (opt2bSet("-s", NFILE, fnm) || !opt2bSet("-n", NFILE, fnm) || bCom);
if (bTPS)
{
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), title, &top, &ePBC, &xtop, NULL, box,
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, NULL, box,
bCom);
}
double MAXBIN[3];
t_topology top;
int ePBC;
- char title[STRLEN];
t_trxframe fr;
rvec *xtop;
matrix box, box_pbc;
return 0;
}
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), title, &top, &ePBC, &xtop, NULL, box, TRUE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, NULL, box, TRUE);
sfree(xtop);
atoms = &(top.atoms);
return 0;
}
- bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), title, &top, &ePBC, NULL, NULL, box,
+ bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, NULL, NULL, box,
TRUE);
get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &gnx, &index, &grpname);
t_topology top;
int ePBC;
real *mass, time;
- char title[STRLEN];
const char *indexfn;
t_trxframe fr, frout;
int flags, nvhisto = 0, *vhisto = NULL;
}
sprintf(sffmt6, "%s%s%s%s%s%s", sffmt, sffmt, sffmt, sffmt, sffmt, sffmt);
- bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), title, &top, &ePBC,
+ bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC,
&xtop, NULL, topbox,
bCom && (bOX || bOXT || bOV || bOT || bEKT || bEKR));
sfree(xtop);
if (bTPS)
{
- read_tps_conf(top_file, top_title, &top, &ePBC, &xp, NULL, top_box,
+ read_tps_conf(top_file, &top, &ePBC, &xp, NULL, top_box,
bReset || bPBCcomRes);
- atoms = &top.atoms;
+ std::strncpy(top_title, *top.name, 255);
+ top_title[255] = '\0';
+ atoms = &top.atoms;
if (0 == top.mols.nr && (bCluster || bPBCcomMol))
{
gmx_rmpbc_t gpbc;
real t, totmass, mass, rcut2 = 0, n2;
int natoms, nwat, ncut;
- char **grpname, title[256];
+ char **grpname;
int i, j, d, *isize, isize_ref = 0, isize_sol;
atom_id sa, sr, *swi, **index, *ind_ref = NULL, *ind_sol;
output_env_t oenv;
return 0;
}
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), title, &top, &ePBC, &x, NULL, box, TRUE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, NULL, box, TRUE);
sfree(x);
/* get index groups */
output_env_t oenv;
const char *matfile, *otfile, *orfile;
- char title[256];
t_topology top;
int ePBC;
matrix boxtop, box, *sbox, avbox, corr;
exit(0);
}
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), title, &top, &ePBC, &xtop, NULL, boxtop,
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, NULL, boxtop,
FALSE);
get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &isize, &index, &grpname);
int gnx;
atom_id *index;
char *grpname;
- char title[256];
/* t0, t1 are the beginning and end time respectively.
* dt is the time step, mass is temp variable for atomic mass.
*/
if (bTPS)
{
- bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), title, &top, &ePBC, NULL, NULL, box,
+ bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, NULL, NULL, box,
TRUE);
get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &gnx, &index, &grpname);
}
{
int i, *isize, flags = TRX_READ_X, **index_atp;
t_trxstatus *status;
- char **grpname, title[STRLEN];
+ char **grpname;
atom_id **index;
t_topology top;
int ePBC;
sf->energy = energy;
/* Read the topology informations */
- read_tps_conf (fnTPS, title, &top, &ePBC, &xtop, NULL, box, TRUE);
+ read_tps_conf (fnTPS, &top, &ePBC, &xtop, NULL, box, TRUE);
sfree (xtop);
/* groups stuff... */
int vol;
t_atoms *atoms; /* list with all atoms */
- char title[STRLEN];
rvec *x, *xx, *v; /* coordinates? */
real t;
vec4 *xrot, *vrot;
t_topology *top;
snew(top, 1);
atoms = &top->atoms;
- read_tps_conf(opt2fn("-f", NFILE, fnm), title, top, &ePBC, &x, &v, box, FALSE);
+ read_tps_conf(opt2fn("-f", NFILE, fnm), top, &ePBC, &x, &v, box, FALSE);
natoms = atoms->nr;
nres = atoms->nres; /* nr of residues in one element? */
/* make space for all the atoms */
}
gmx_rng_destroy(rng);
- write_sto_conf(opt2fn("-o", NFILE, fnm), title, atoms, x, v, ePBC, box);
+ write_sto_conf(opt2fn("-o", NFILE, fnm), *top->name, atoms, x, v, ePBC, box);
return 0;
}
fprintf(stderr, "processing coordinates...\n");
}
- char title[STRLEN];
t_topology *conftop;
snew(conftop, 1);
init_state(state, 0, 0, 0, 0, 0);
- read_tps_conf(confin, title, conftop, NULL, &state->x, &state->v, state->box, FALSE);
+ read_tps_conf(confin, conftop, NULL, &state->x, &state->v, state->box, FALSE);
state->natoms = state->nalloc = conftop->atoms.nr;
if (state->natoms != sys->natoms)
{
t_topology *top;
matrix box, invbox;
int natoms, npbcdim = 0;
- char warn_buf[STRLEN], title[STRLEN];
+ char warn_buf[STRLEN];
int a, i, ai, j, k, mb, nat_molb;
gmx_molblock_t *molb;
t_params *pr, *prfb;
t_atom *atom;
snew(top, 1);
- read_tps_conf(fn, title, top, NULL, &x, &v, box, FALSE);
+ read_tps_conf(fn, top, NULL, &x, &v, box, FALSE);
natoms = top->atoms.nr;
done_top(top);
sfree(top);
if (bProt)
{
/* Generate a solute configuration */
- title = readConformation(inputConfFile_.c_str(), top, &x, NULL,
- &ePBC, box, "solute");
+ readConformation(inputConfFile_.c_str(), top, &x, NULL,
+ &ePBC, box, "solute");
if (top->atoms.nr == 0)
{
fprintf(stderr, "Note: no atoms in %s\n", inputConfFile_.c_str());
- sfree(title);
- title = NULL;
+ }
+ else
+ {
+ title = *top->name;
}
}
if (bBox_)
{
int ePBC_dummy;
matrix box_dummy;
- char *title_ins
- = readConformation(insertConfFile_.c_str(), top_insrt, &x_insrt,
- NULL, &ePBC_dummy, box_dummy, "molecule");
+ readConformation(insertConfFile_.c_str(), top_insrt, &x_insrt,
+ NULL, &ePBC_dummy, box_dummy, "molecule");
if (top_insrt->atoms.nr == 0)
{
gmx_fatal(FARGS, "No molecule in %s, please check your input",
}
if (title == NULL)
{
- title = title_ins;
- }
- else
- {
- sfree(title_ins);
+ title = *top_insrt->name;
}
if (positionFile_.empty())
{
sfree(top);
done_top(top_insrt);
sfree(top_insrt);
- sfree(title);
return 0;
}
printf("Reading %s...\n", inf);
t_topology *top;
snew(top, 1);
- read_tps_conf(inf, title, top, ePBC, x, NULL, box, FALSE);
- *atoms = top->atoms;
+ read_tps_conf(inf, top, ePBC, x, NULL, box, FALSE);
+ strncpy(title, *top->name, STRLEN);
+ title[STRLEN-1] = '\0';
+ *atoms = top->atoms;
sfree(top);
natom = atoms->nr;
if (atoms->pdbinfo == NULL)
}
printf("Read");
- if (title && title[0])
+ if (title[0])
{
printf(" '%s',", title);
}
return exclusionDistances;
}
-char *readConformation(const char *confin, t_topology *top, rvec **x, rvec **v,
- int *ePBC, matrix box, const char *statusTitle)
+void readConformation(const char *confin, t_topology *top, rvec **x, rvec **v,
+ int *ePBC, matrix box, const char *statusTitle)
{
- char *title;
-
- snew(title, STRLEN);
-
fprintf(stderr, "Reading %s configuration%s\n", statusTitle, v ? " and velocities" : "");
- read_tps_conf(confin, title, top, ePBC, x, v, box, FALSE);
+ read_tps_conf(confin, top, ePBC, x, v, box, FALSE);
fprintf(stderr, "%s\nContaining %d atoms in %d residues\n",
- title, top->atoms.nr, top->atoms.nres);
-
- return title;
+ *top->name, top->atoms.nr, top->atoms.nres);
}
* Used by solvate and insert-molecules. The returned pointers *x and
* *v should be freed by the caller. top should have its destructor
* called. */
-char *readConformation(const char *confin, struct t_topology *top, rvec **x, rvec **v,
- int *ePBC, matrix box, const char *statusTitle);
+void readConformation(const char *confin, struct t_topology *top, rvec **x, rvec **v,
+ int *ePBC, matrix box, const char *statusTitle);
#endif
char *filename = gmxlibfn(fn);
snew(top_solvt, 1);
- char *title_solvt
- = readConformation(filename, top_solvt, &x_solvt, &v_solvt,
- &ePBC_solvt, box_solvt, "solvent");
+ readConformation(filename, top_solvt, &x_solvt, &v_solvt,
+ &ePBC_solvt, box_solvt, "solvent");
t_atoms *atoms_solvt = &top_solvt->atoms;
- sfree(title_solvt);
if (0 == atoms_solvt->nr)
{
gmx_fatal(FARGS, "No solvent in %s, please check your input\n", filename);
gmx_atomprop_t aps;
/* solute configuration data */
- char *title = NULL;
t_topology *top;
rvec *x = NULL, *v = NULL;
int ePBC = -1;
{
/* Generate a solute configuration */
conf_prot = opt2fn("-cp", NFILE, fnm);
- title = readConformation(conf_prot, top, &x,
- bReadV ? &v : NULL, &ePBC, box, "solute");
+ readConformation(conf_prot, top, &x,
+ bReadV ? &v : NULL, &ePBC, box, "solute");
if (bReadV && !v)
{
fprintf(stderr, "Note: no velocities found\n");
fprintf(stderr, "Writing generated configuration to %s\n", confout);
if (bProt)
{
- write_sto_conf(confout, title, &top->atoms, x, v, ePBC, box);
+ write_sto_conf(confout, *top->name, &top->atoms, x, v, ePBC, box);
}
else
{
sfree(v);
done_top(top);
sfree(top);
- sfree(title);
output_env_done(oenv);
done_filenms(NFILE, fnm);
t_nm2type *nm2t;
t_mols mymol;
int nnm;
- char title[STRLEN], forcefield[32], ffdir[STRLEN];
+ char forcefield[32], ffdir[STRLEN];
rvec *x; /* coordinates? */
int *nbonds, *cgnr;
int bts[] = { 1, 1, 1, 2 };
/* Read coordinates */
t_topology *top;
snew(top, 1);
- read_tps_conf(opt2fn("-f", NFILE, fnm), title, top, &epbc, &x, NULL, box, FALSE);
+ read_tps_conf(opt2fn("-f", NFILE, fnm), top, &epbc, &x, NULL, box, FALSE);
t_atoms *atoms = &top->atoms;
natoms = atoms->nr;
if (atoms->pdbinfo == NULL)
void TopologyManager::loadTopology(const char *filename)
{
- char title[STRLEN];
int ePBC;
rvec *xtop = NULL;
matrix box;
GMX_RELEASE_ASSERT(top_ == NULL, "Topology initialized more than once");
snew(top_, 1);
read_tps_conf(gmx::test::TestFileManager::getInputFilePath(filename).c_str(),
- title, top_, &ePBC, frame_ != NULL ? &xtop : NULL,
+ top_, &ePBC, frame_ != NULL ? &xtop : NULL,
NULL, box, FALSE);
if (frame_ != NULL)
void chk_tps(const char *fn, real vdw_fac, real bon_lo, real bon_hi)
{
int natom, i, j, k;
- char title[STRLEN];
t_topology top;
int ePBC;
t_atoms *atoms;
gmx_atomprop_t aps;
fprintf(stderr, "Checking coordinate file %s\n", fn);
- read_tps_conf(fn, title, &top, &ePBC, &x, &v, box, TRUE);
+ read_tps_conf(fn, &top, &ePBC, &x, &v, box, TRUE);
atoms = &top.atoms;
natom = atoms->nr;
fprintf(stderr, "%d atoms in file\n", atoms->nr);
// Load the topology if requested.
if (!impl_->topfile_.empty())
{
- char title[STRLEN];
-
snew(impl_->topInfo_.top_, 1);
- impl_->topInfo_.bTop_ = read_tps_conf(impl_->topfile_.c_str(), title,
+ impl_->topInfo_.bTop_ = read_tps_conf(impl_->topfile_.c_str(),
impl_->topInfo_.top_, &impl_->topInfo_.ePBC_,
&impl_->topInfo_.xtop_, NULL, impl_->topInfo_.boxtop_, TRUE);
if (hasTrajectory()