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

Konrad Hinsen hinsen at cnrs-orleans.fr
Fri Jan 23 14:30:10 UTC 2009

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 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/

More information about the mmtk mailing list