[MMTK] Convert LAMMPS MD trajectory to netCDF format with MMTK convention for nMoldyn analysis.

Jay Billings jayjaybillings at gmail.com
Fri Jan 23 15:17:01 UTC 2009

This email reminded me about a converter that I made for Materials Studio
xtd and trj files to MMTK/nMoldyn's nc format. I have attached it for anyone

It shows how to use the "snapshot" feature to build up the nc file and how
to insert time information into that snapshot.

If anyone is actually going to use it for MS->MMTK stuff, you'll need the
lxml package for python and you will need to convert your files to ASCII
using trj2ascii.exe. (trj2ascii.exe is a small program found in the MS root
directory on Windows.) You need to provide both the ascii trj file and the
xtd file. It worked fine for MS4.1, but I haven't tested it with other


On Fri, Jan 23, 2009 at 9:30 AM, Konrad Hinsen <hinsen at cnrs-orleans.fr>wrote:

> On Jan 23, 2009, at 2:50, Yi Liu wrote:
>  But I still do not understand why G3 works but G4 not? I essentially
>> created them in the same way. I considered the other differences
>> between these two systems:
>> (1) the number of atoms should not matter since the good G3 systems
>> have more atoms;
>> (2) the number of residuals (G3 only has one residual but G4 have
>> many). How this could cause the problem?
>> I can not get more hints by comparing the description strings in these
>> two cdl files. Do you have any idea about it?
> Since it is ncgen that complains about the description string, the problem
> cannot be related to its content. For ncgen, it is just some string. So
> there is either a syntactical problem with representing the string in cdl,
> or a bug in ncgen. I haven't use ncgen or cdl very much, so I cannot say
> more about this.
>  I attempted to extract the new description line generated from
>> SnapshotGenerator (convert nc to cdl and cut it out), and replaced the
>> description line in my cdl files and used the correct string length.
>> Nevertheless, it did not work.
> Something that you could try is running ncdump on a valid trajectory and
> then ncgen on the result. If that produces an error or an incorrect file,
> something is necessarily wrong with ncdump and/or ncgen.
>  Side notes: The way I got the current description line is quite
>> "dirty". I actually did a short run using NAMD, and convert the output
>> dcd to nc (then cdl) using dcd_to_nc converter. Then I am able to
>> extract the description line from cdl file and plug into my cdl files.
> Then why not take the dcd_to_nc converter and modify it to read your LAMMPS
> file instead of the DCD file? All you need to know to do that is the LAMMPS
> format, but apparently you have all that information. If there is something
> you don't understand in the dcd_to_nc converter, just contact me.
> This seems the best solution to me because in the end you'd have a general
> one-step LAMMPS-to-nc converter that is much easier to use.
>  I thought about the version of netCDF. I recently updated to 4.0. Even
>> though there are two new binary formats are introduced from 4.0, it
>> should be "classic format" by default. And I can get G3 working using
>> netCDF 4.0.
> There shouldn't be any problem with netCDF 4, as long as you use the
> classic format. The 64-bit format should work as well without changes, but
> you need ScientificPython 2.9 to be able to create such files. I haven't
> tested HDF5 format support yet, so I cannot say if it works.
> Konrad.
> --
> ---------------------------------------------------------------------
> Konrad Hinsen
> Centre de Biophysique Moléculaire, CNRS Orléans
> Synchrotron Soleil - Division Expériences
> Saint Aubin - BP 48
> 91192 Gif sur Yvette Cedex, France
> Tel. +33-1 69 35 97 15
> E-Mail: hinsen at cnrs-orleans.fr
> Web: http://dirac.cnrs-orleans.fr/~hinsen/<http://dirac.cnrs-orleans.fr/%7Ehinsen/>
> ---------------------------------------------------------------------
> _______________________________________________
> mmtk maillist  -  mmtk at starship.python.net
> http://starship.python.net/mailman/listinfo/mmtk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://starship.python.net/pipermail/mmtk/attachments/20090123/0915dccc/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: trj_to_nc.py
Type: application/octet-stream
Size: 5218 bytes
Desc: not available
URL: <http://starship.python.net/pipermail/mmtk/attachments/20090123/0915dccc/attachment.obj>

More information about the mmtk mailing list