t_trxstatus * trjtools_gmx_prepare_tng_writing(const char *filename, char filemode, t_trxstatus *in, const char *infile, const int natoms, const gmx_mtop_t *mtop, gmx::ArrayRef<const int> index, const char *index_group_name) { if (filemode != 'w' && filemode != 'a') { gmx_incons("Sorry, can only prepare for TNG output."); } t_trxstatus *out; snew(out, 1); status_init(out); if (in != nullptr) { gmx_prepare_tng_writing(filename, filemode, &in->tng, &out->tng, natoms, mtop, index, index_group_name); } else if ((infile) && (efTNG == fn2ftp(infile))) { gmx_tng_trajectory_t tng_in; gmx_tng_open(infile, 'r', &tng_in); gmx_prepare_tng_writing(filename, filemode, &tng_in, &out->tng, natoms, mtop, index, index_group_name); } else { // we start from a file that is not a tng file or have been unable to load the // input file, so we need to populate the fields independently of it gmx_prepare_tng_writing(filename, filemode, nullptr, &out->tng, natoms, mtop, index, index_group_name); } return out; }
void trjtools_gmx_prepare_tng_writing(const char *filename, char filemode, t_trxstatus *in, t_trxstatus **out, const char *infile, const int natoms, const gmx_mtop_t *mtop, const int *index, const char *index_group_name) { if (filemode != 'w' && filemode != 'a') { gmx_incons("Sorry, can only prepare for TNG output."); } if (*out == nullptr) { snew((*out), 1); } status_init(*out); if (in != nullptr) { gmx_prepare_tng_writing(filename, filemode, &in->tng, &(*out)->tng, natoms, mtop, index, index_group_name); } else if (efTNG == fn2ftp(infile)) { tng_trajectory_t tng_in; gmx_tng_open(infile, 'r', &tng_in); gmx_prepare_tng_writing(filename, filemode, &tng_in, &(*out)->tng, natoms, mtop, index, index_group_name); } }