From: John Stone (johns_at_ks.uiuc.edu)
Date: Sat Dec 25 2021 - 00:27:21 CST

Hi,
  Yes, as Axel has noted, VMD has a lot more readers among the molfile
plugins than writers. This is in part because it is (generally) much
harder to write a writer plugin that fulfills the expectations of
the original software that reads a given file format. While it is
frequently acceptable for VMD to simply ignore data fields it doesn't
understand or doesn't have a use for when reading, the same is generall
not true when writing files. That being said, something like the NetCDF
formats used by AMBER and other tools would seem to be an easier target
than most. When we do VMD user surveys we ask what issues people want
to see improved in VMD, and thus far this just wasn't something that
people had asked for.

Best,
  John Stone
  vmd_at_ks.uiuc.edu

On Thu, Dec 23, 2021 at 07:16:31AM -0500, Axel Kohlmeyer wrote:
> On Thu, Dec 23, 2021 at 6:37 AM Prathit Chatterjee
> <[1]pc20apr_at_remove_yahoo.co.in> wrote:
>
> Dear Experts,
> Kindly let me know how to write a netcdf file with VMD from a netcdf/dcd
> trajectory file.
> It seems that VMD can read a netcdf file but cannot write it, as
> follows:
>
> That is correct. In order to be able to write a trajectory in a given
> format the corresponding plugin must have write support functions
> included.
> The NetCDF plugin does not have them just like many other molfile plugins.
> From the source code:
> $ grep '\.open_file_write' molfile_plugin/src/*.{c,C} | wc -l
> 24
> $ grep '\.open_file_read' molfile_plugin/src/*.{c,C} | wc -l
> 84
> so only 24 out of 84 molfile plugins do support writing files.
> ¬
>
> Info) Using plugin netcdf for coordinates from file
> /data1/Prathit/APP/OnlyAPP/AlphaFold2/770_res/Charmm-Gui_Dimer-units/E1-E1_3189357573/windows/[2]smd.10_image.nc
> Info) Coordinate I/O rate 139.6 frames/sec, 470 MB/sec, 3.6 sec
> Info) Finished with coordinate file
> /data1/Prathit/APP/OnlyAPP/AlphaFold2/770_res/Charmm-Gui_Dimer-units/E1-E1_3189357573/windows/[3]smd.10_image.nc.
> 1
> vmd >
> vmd > molinfo top get numframes
> 500
> vmd > set nf [expr {[molinfo top get numframes]-1}]
> 499
> vmd > set all [atomselect top all]
> atomselect1
> vmd > animate write dcd try.dcd beg 0 end $nf waitfor all sel $all
> Info) Opened coordinate file try.dcd for writing.
> Info) Finished with coordinate file try.dcd.
> 500
> vmd >
> vmd > animate write netcdf¬ [4]try.nc¬ beg 0 end $nf waitfor all sel
> $all
> ERROR) Unable to open file¬ [5]try.nc¬ of type netcdf for writing
> frames.
> vmd >
> vmd > animate write netcdf¬ [6]try.nc¬ type netcdf beg 0 end $nf waitfor
> all sel $all (basically it did not write an .nc file, unlike the
> generated .dcd file above)
> vmd > ls
> Any comments regarding the same will be deeply appreciated.
> Thanks in advance.
> Prathit Chatterjee
>
> --
> Dr. Axel Kohlmeyer ¬ [7]akohlmey_at_gmail.com ¬ [8]http://goo.gl/1wk0
> College of Science & Technology, Temple University, Philadelphia PA, USA
> International Centre for Theoretical Physics, Trieste. Italy.
>
> References
>
> Visible links
> 1. mailto:pc20apr_at_remove_yahoo.co.in
> 2. https://urldefense.com/v3/__http://smd.10_image.nc__;!!DZ3fjg!rPtZGk-VYKRyZ78fWbjv9qHghs2XEvBIQ5Ey7LIeU4AjCOCXRYG9OrHit1p1LpwvpQ$
> 3. https://urldefense.com/v3/__http://smd.10_image.nc__;!!DZ3fjg!rPtZGk-VYKRyZ78fWbjv9qHghs2XEvBIQ5Ey7LIeU4AjCOCXRYG9OrHit1p1LpwvpQ$
> 4. https://urldefense.com/v3/__https://www.researchgate.net/deref/http*3A*2F*2Ftry.nc__;JSUl!!DZ3fjg!s4l0YKd8042A-lu9EC_Ge0ivIbQHubrbVsdq4Ss512djRe9OJ_-0QSUUTM33xaUkEg$
> 5. https://urldefense.com/v3/__https://www.researchgate.net/deref/http*3A*2F*2Ftry.nc__;JSUl!!DZ3fjg!s4l0YKd8042A-lu9EC_Ge0ivIbQHubrbVsdq4Ss512djRe9OJ_-0QSUUTM33xaUkEg$
> 6. https://urldefense.com/v3/__https://www.researchgate.net/deref/http*3A*2F*2Ftry.nc__;JSUl!!DZ3fjg!s4l0YKd8042A-lu9EC_Ge0ivIbQHubrbVsdq4Ss512djRe9OJ_-0QSUUTM33xaUkEg$
> 7. mailto:akohlmey_at_gmail.com
> 8. https://urldefense.com/v3/__http://goo.gl/1wk0__;!!DZ3fjg!rPtZGk-VYKRyZ78fWbjv9qHghs2XEvBIQ5Ey7LIeU4AjCOCXRYG9OrHit1qNP9cJrg$

-- 
NIH Center for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
http://www.ks.uiuc.edu/~johns/           Phone: 217-244-3349
http://www.ks.uiuc.edu/Research/vmd/