From: Magnus Lundborg Date: Fri, 27 Mar 2015 11:20:38 +0000 (+0100) Subject: Update header when appending to TNG file. X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=0d2e798828b2a2987e3bcecb5465548a3048037d;p=alexxy%2Fgromacs.git Update header when appending to TNG file. The library now handles updating the size of the headers by moving the first frame sets to make room (if necessary). Therefore this is now enabled when appending to a trajectory from mdrun. Change-Id: I7334a1b0c251856f30e116b63161f7676055dce1 --- diff --git a/src/gromacs/fileio/tngio.cpp b/src/gromacs/fileio/tngio.cpp index 2ae31c288e..417c246ca3 100644 --- a/src/gromacs/fileio/tngio.cpp +++ b/src/gromacs/fileio/tngio.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * 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. @@ -106,22 +106,16 @@ void gmx_tng_open(const char *filename, if (mode == 'w' || mode == 'a') { - /* FIXME in TNG: When adding data to the header, subsequent blocks might get - * overwritten. This could be solved by moving the first trajectory - * frame set(s) to the end of the file. Could that cause other problems, - * e.g. when continuing a simulation? */ char hostname[256]; gmx_gethostname(hostname, 256); if (mode == 'w') { tng_first_computer_name_set(*tng, hostname); } -/* TODO: This should be implemented when the above fixme is done (adding data to - * the header). */ -// else -// { -// tng_last_computer_name_set(*tng, hostname); -// } + else + { + tng_last_computer_name_set(*tng, hostname); + } char programInfo[256]; const char *precisionString = ""; @@ -135,12 +129,10 @@ void gmx_tng_open(const char *filename, { tng_first_program_name_set(*tng, programInfo); } -/* TODO: This should be implemented when the above fixme is done (adding data to - * the header). */ -// else -// { -// tng_last_program_name_set(*tng, programInfo); -// } + else + { + tng_last_program_name_set(*tng, programInfo); + } char username[256]; if (!gmx_getusername(username, 256)) @@ -149,13 +141,12 @@ void gmx_tng_open(const char *filename, { tng_first_user_name_set(*tng, username); } + else + { + tng_last_user_name_set(*tng, username); + tng_file_headers_write(*tng, TNG_USE_HASH); + } } -/* TODO: This should be implemented when the above fixme is done (adding data to - * the header). */ -// else -// { -// tng_last_user_name_set(*tng, username); -// } } #else gmx_file("GROMACS was compiled without TNG support, cannot handle this file type");