From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Thu Dec 23 2021 - 06:16:31 CST

On Thu, Dec 23, 2021 at 6:37 AM Prathit Chatterjee <
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/
> 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/
> 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 try.nc
> <https://urldefense.com/v3/__https://www.researchgate.net/deref/http*3A*2F*2Ftry.nc__;JSUl!!DZ3fjg!s4l0YKd8042A-lu9EC_Ge0ivIbQHubrbVsdq4Ss512djRe9OJ_-0QSUUTM33xaUkEg$> beg
> 0 end $nf waitfor all sel $all
> ERROR) Unable to open file try.nc
> <https://urldefense.com/v3/__https://www.researchgate.net/deref/http*3A*2F*2Ftry.nc__;JSUl!!DZ3fjg!s4l0YKd8042A-lu9EC_Ge0ivIbQHubrbVsdq4Ss512djRe9OJ_-0QSUUTM33xaUkEg$> of
> type netcdf for writing frames.
> vmd >
> vmd > animate write netcdf try.nc
> <https://urldefense.com/v3/__https://www.researchgate.net/deref/http*3A*2F*2Ftry.nc__;JSUl!!DZ3fjg!s4l0YKd8042A-lu9EC_Ge0ivIbQHubrbVsdq4Ss512djRe9OJ_-0QSUUTM33xaUkEg$> 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  akohlmey_at_gmail.com  https://urldefense.com/v3/__http://goo.gl/1wk0__;!!DZ3fjg!rPtZGk-VYKRyZ78fWbjv9qHghs2XEvBIQ5Ey7LIeU4AjCOCXRYG9OrHit1qNP9cJrg$ 
College of Science & Technology, Temple University, Philadelphia PA, USA
International Centre for Theoretical Physics, Trieste. Italy.