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

Yi Liu yi at wag.caltech.edu
Thu Jan 22 07:10:22 UTC 2009

Hi, MMTKers,

I want to convert my MD trajectory obtained from LAMMPS to the netCDF
format that can be analyzed in nMoldyn. I first wrote a script (and
did some tricks) to convert LAMMPS trajectory to a file in a "cdl"
text format, and then used ncgen to generate a binary "nc" file. But I
encountered the following error:

ncgen -o G4-np2_nvt_trim_shrink.nc G4-np2_nvt_trim_shrink.cdl
ncgen: G4-np2_nvt_trim_shrink.cdl line 25: string too long, truncated

I guess it is related to the description line in the cdl file. Can
anyone have a look at the description line and see if it is correct?
Is there a easy way to get this description line correct?

I attach the cdl file and a pdb file for your analysis. My trajectory
have 21 frames. Each of them has 2244 atoms. You may note that my pdb
file is not as standard as that from protein data bank. But this
should not cause ncgen to crash.

I can provide further details on how did I create the cdl file if
necessary. At this moment I want to simplify the problem to how to
create the description line based on a given pdb file (may not be

Thanks for any comment and input.


p.s. Below is the header information of the nc file I created above
(ncdump -c G4-np2_nvt_trim_shrink.nc).

netcdf G4-np2_nvt_trim_shrink {
        step_number = UNLIMITED ; // (0 currently)
        atom_number = 2244 ;
        xyz = 3 ;
        box_size_length = 3 ;
        description_length = 43091 ;
        char description(description_length) ;
        int step(step_number) ;
        float time(step_number) ;
                time:units = "picosecond" ;
        float configuration(step_number, atom_number, xyz) ;
                configuration:units = "nanometer" ;
        float box_size(step_number, box_size_length) ;
                box_size:units = "nanometer" ;

// global attributes:
                :Conventions = "MMTK/Trajectory" ;
                :trajectory_type = 0 ;
                :history = "Created by lammps2nc.py" ;
                :comment = "Converted from G4-np2_nvt_trim_shrink.lammpstrj" ;

Dr. Yi Liu
Materials and Process Simulation Center (M/C 139-74)
California Institute of Technology
1200 East California Blvd.
Pasadena, California 91125
Phone: (626) 395-8137
E-mail: yi at wag.caltech.edu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: G4-np2_nvt_trim_shrink.cdl.gz
Type: application/x-gzip
Size: 589030 bytes
Desc: not available
URL: <http://starship.python.net/pipermail/mmtk/attachments/20090121/cdaad350/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: G4-np2-nw_namd.pdb.gz
Type: application/x-gzip
Size: 48236 bytes
Desc: not available
URL: <http://starship.python.net/pipermail/mmtk/attachments/20090121/cdaad350/attachment-0003.bin>

More information about the mmtk mailing list