<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Dear Jonathan,<br>
      <br>
      I'm on vacation but I will look into this next week.<br>
      <br>
      Regards,<br>
      <br>
      Magnus<br>
      <br>
      On 2017-07-08 17:18, Jonathan Barnoud wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:4c2ad6c6-1342-dad1-51b8-cfde098d6cc6@barnoud.net">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      Dear all,<br>
      <br>
      With other developers of MDAnalysis, we are working on a python
      wrapper for the TNG library. While it is aimed at being used in
      MDAnalysis, this wrapper is written to be used standalone. More
      details can be found at <a class="moz-txt-link-rfc2396E"
        href="http://www.mdanalysis.org/pytng/" moz-do-not-send="true">&lt;http://www.mdanalysis.org/pytng/&gt;</a>.<br>
      <br>
      I am working on the writing of a basic TNG file. I want to be able
      to write particle positions  and a box shape for each frame. Each
      frame can have an arbitrary time attached to it. I did manage to
      do this in this pull request: <a class="moz-txt-link-rfc2396E"
        href="https://github.com/MDAnalysis/pytng/pull/18"
        moz-do-not-send="true">&lt;https://github.com/MDAnalysis/pytng/pull/18&gt;</a>,
      and in this minimal example jupyter notebook:
      <a class="moz-txt-link-rfc2396E"
        href="https://gist.github.com/jbarnoud/b8f750f116b76aba1b205babc001b569"
        moz-do-not-send="true">&lt;https://gist.github.com/jbarnoud/b8f750f116b76aba1b205babc001b569&gt;</a>.
      Both cases are written in cython rather than C, but they call the
      same functions from the tng_io library that a C program would.<br>
      <br>
      There are a few things I am not completely sure about, though.<br>
      <br>
      1. When I write the box shape with `tng_util_box_shape_write` or
      `tng_util_box_shape_with_time_write`, I do not manage to read it
      back with gromacs. Both 'gmx check' and 'gmx dump' fail to read
      the box with the following message:<br>
      <br>
          TNG library: Cannot uncompress data block.
      /home/jon/src/gromacs-2016.3/src/external/tng_io/src/lib/tng_io.c:5298<br>
      <br>
      I did solve the problem by using `tng_util_generic_write` (or its
      `with_time` equivalent) and by setting the compression to
      `TNG_UNCOMPRESSED`.<br>
      <br>
      Does gromacs support the TNG_GZIP_COMPRESSION that is the default
      for the high level `tng_util_box_shape_write` function? If so,
      what should I do to have it working?<br>
      <br>
      2. I write an arbitrary time with each frame. The time is
      arbitrary in the sense that I do not know before hand what is the
      time that the user of the library will provide for the frame, and
      that the time difference between two consecutive frames do not
      have to be constant (nor even positive). I managed this by setting
      the number of frames per frame set to 1, and to set the time per
      frame to 0.<br>
      <br>
      Is it possible to have the arbitrary time with more than one frame
      per frame set? I did get some results by setting the time per
      frame for each frame using the time difference with the previous
      frame, but I got some strange behaviors when the difference was 0;
      and `<span class="n">tng_time_per_frame_set</span><span class="p">`
        refuses negative values.<br>
        <br>
        Also, I noticed that all the `tng_util_*_with_time_write`
        functions expect the time to be expressed in seconds, while
        `tng_time_per_frame_set` expects picoseconds. Is there a reason
        for this discrepancy?<br>
        <br>
        Thank you for any insight you may provide,<br>
        Jonathan Barnoud<br>
      </span>
      <pre><code></code></pre>
      <code><br>
      </code> <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
    </blockquote>
    <p><br>
    </p>
  </body>
</html>