From: viktor drobot (linux776_at_gmail.com)
Date: Tue Mar 03 2020 - 02:28:39 CST

Thank you! Is there any clue about including this patch in a39 build?

-------- Original message --------
> Weird. I remember fixing some of these things when I found them
> impeding my own science output, but checking the diffs with respect to
> the CVS, I see that I fixed some more AMBER weirdness that never made
> it into the rst7plugin. My use case always had a timestep, so even my
> "fixed" version had issues with your fourth example, which I've
> corrected here.
>
> See the attached version of rst7plugin.c, as well as the diff against
> the current version in CVS. This will load things correctly even if a
> timestep isn't present. It should just be a simple recompile once
> you've replaced the file if you are in to that sort of thing, but
> otherwise it will depend on how quickly John or someone with real CVS
> access corrects the plugin and triggers a new alpha build to be released.
>
> -Josh
>
> On Sun, Feb 23, 2020 at 3:39 PM viktor drobot <linux776_at_gmail.com
> <mailto:linux776_at_gmail.com>> wrote:
>
> Hi all. Recently I've been working a lot with AMBER Restart files
> and used VMD for visualizing them. I've faced one small annoying
> bug with VMD - it detects this type of input quite wrong. My AMBER
> version is 18 and VMD is 1.9.4a38.
>
> Here is <https://ftp.desolve.ru/ftp/viktor/vmd_test.tar.gz>
> (https://ftp.desolve.ru/ftp/viktor/vmd_test.tar.gz) my special
> test case which consists of 5 files: topology (*system.prmtop*),
> coordinates with timestamp (*crd.rst*), coordinates without
> timestamp (*crd_notime.rst*), coordinates and velocities with
> timestamp (*crdvel.rst*), coordinates and velocities without
> timestamp (*crdvel_notime.rst*). According to the specs
> <https://ambermd.org/FileFormats.php#restart>
> (https://ambermd.org/FileFormats.php#restart) timestamp field for
> plain text restarts is optional. I think restarts without
> timestamp are usually the very first input files for MD
> simulations right after tleap or something similar and restarts
> with timestamp are just frames grepped from trajectory.
>
> I load parm + crd in VMD with the following filetypes: AMBER7 Parm
> (topology) and AMBER7 Restart (coordinates). However I observe
> inconsistent behavior for some restarts. Below I'll try to
> illustrate it in detail.
>
>
> 1. Restart with coordinates and timestamp (*crd.rst*)
>
> When loading this combination I can see the following in console:
>
> rst7plugin) Title: Cpptraj Generated Restart
>
> rst7plugin) This file contains velocity info.
> rst7plugin) The Restartcrd has 85722 atoms.
> Info) Using plugin rst7 for coordinates from file /tmp/1/crd.rst
> rst7plugin) Importing velocities from restart file.
> Info) Finished with coordinate file /tmp/1/crd.rst.
>
> This file has no velocity info but has periodic box info. VMD
> tells that it found velocities, however periodic box isn't found.
> Actually it doesn't show anything and I see that total length of
> trajectory is 0. So, only black screen without anything useful.
>
> 2. Restart with coordinates only (*crd_notime.rst*)
>
> Console log:
>
> rst7plugin) Title: Cpptraj Generated Restart
>
> rst7plugin) This file has no velocity info.
> rst7plugin) The Restartcrd has 85722 atoms.
> rst7plugin) This restartcrd file has box info.
> rst7plugin) Box Dimensions are 84.415970 100.727646 100.317093
> 90.000000 90.000000 90.000000
> Info) Using plugin rst7 for coordinates from file
> /tmp/1/crd_notime.rst
> Info) Finished with coordinate file /tmp/1/crd_notime.rst.
>
> It tells that no velocities were found and reads in proper
> periodic box. I can see my molecules on the screen so that
> combination works fine.
>
> 3. Restart with coordinates, velocities and timestamp (*crdvel.rst*)
>
> Console output:
>
> rst7plugin) Title: Cpptraj Generated Restart
>
> rst7plugin) This file contains velocity info.
> rst7plugin) The Restartcrd has 85722 atoms.
> rst7plugin) This restartcrd file has box info.
> rst7plugin) Box Dimensions are 84.415970 100.727646 100.317093
> 90.000000 90.000000 90.000000
> Info) Using plugin rst7 for coordinates from file /tmp/1/crdvel.rst
> rst7plugin) Importing velocities from restart file.
> rst7plugin) Importing velocities from restart file.
> Info) Finished with coordinate file /tmp/1/crdvel.rst.
>
> It loads proper periodic box, detects velocities. I can see
> molecular visualization. However it tells that velocities were
> read two times. This is strange.
>
> 4. Restart with coordinates, velocities and without timestamp
> (*crdvel_notime.rst*)
>
> Info from console:
>
> rst7plugin) Title: Cpptraj Generated Restart
>
> rst7plugin) This file has no velocity info.
> rst7plugin) The Restartcrd has 85722 atoms.
> rst7plugin) This restartcrd file has box info.
> rst7plugin) Box Dimensions are -0.243004 -0.109651 0.003363
> 0.591160 0.550960 -0.262683
> Info) Using plugin rst7 for coordinates from file
> /tmp/1/crdvel_notime.rst
> Info) Finished with coordinate file /tmp/1/crdvel_notime.rst.
>
> It says that no velocities were found and also reads in incorrect
> periodic box. However molecular visualization is shown on the
> screen. Strange behavior too.
>
>
> Seems like VMD relies on this timestamp field during parsing.
> However it break things in some cases as shown above. I have
> already developed one tool for working with AMBER restarts and it
> employs another approach. According to the AMBER Restart specs we
> have the following structure of plain text restart (/ denotes
> floor integer division and % denotes modulo operator; so for 1 and
> 2 atoms in system we have only 1 line; for 3 and 4 we have 2 lines
> and so on):
>
> HEADER
> NATOM TIME
> [NATOM / 2 + NATOM % 2] lines of X Y Z coordinates
> [NATOM / 2+ NATOM % 2] lines of X Y Z velocities (if any)
> PBC (if any)
>
> So we just should count total number of lines in file and then
> subtract 2 (header and metadata). Let's denote (NATOM / 2 + NATOM
> % 2) as N and total number of lines in file (not counting header
> and metadata) as T. Then we have the following possibilities:
>
> 1. T = N. We have restart file with coordinates only and without
> velocities and PBC.
> 2. T = N + 1. We have restart file with coordinates and PBC, but
> no velocities are presented.
> 3. T = 2N. We have restart file with coordinates and velocities
> but without PBC.
> 4. T = 2N + 1. We have restart file with coordinates, velocities
> and PBC.
>
> Using this scheme VMD will open any modern AMBER Restarts
> correctly not regarding timestamp at all (which is already
> optional). So what do you think about it? Also why it reads
> velocities twice if they are presented?
>
> Thank you!
>