From: Axel Kohlmeyer (
Date: Tue Aug 07 2007 - 08:46:49 CDT

On Tue, 7 Aug 2007, [iso-8859-7] Θωμας [iso-8859-7] Ευαγγελιδης wrote:


this does not work with .dcd at all, as john pointed out.
you'd have to write a single frame .dcd _and_ .psf for each
frame, since also VMD cannot handle that situation. see:
for a workaround.

the only file format that would handle what you describe
well is the LAMMPS atom style dump format, where each atom
index is archived with the position (which makes it nasty
to read in VMD, and requires the dumping of all atoms to
be compatible with VMD to begin with). if the number of atoms
per frame varies, you will for the time being have to find
a different visualization package and/or help to make VMD
handle this more gracefully (not easy, if you want to preserve
the current efficiency in handling large numbers of atoms).

the best way to reduce the size of a trajectory is to make
this selection rather generous. i'm currently working on some
script/plugin with GUI that will hook into the file loading
process and allow you to read only a selection. however this,
again, has the constraint that the number and index of the
atom does not change and is pretty tricky to begin with
(our group is working on huge coarse grained MD systems, where
it can be difficult to load only a few frames into regular
desktop). at the moment, you can do this pretty straight forward
in batch mode on a file by file basis.

if you want to visualize only the n-closest atoms out of that
reduced selection, see the suggestion in my other mail.


TE> Dear John,
TE> the concept was to write a plugin which creates smaller dcd files from bigger
TE> ones by taking into account only the water molecules & ions which surround
TE> the macromolecule. The user will give a cutoff distance, lets say 5 A, and the
TE> program will find which atoms are within 5 A in the first frame, lets say N.
TE> Then it will take frame No.2, find which N atoms are closer to the protein and
TE> write them in the new dcd. Then frame No.3 , etc... Probably the most atoms out
TE> of N will be the same in every frame, so those atomIDs writen in the dcd will be
TE> the same too, but there will be also some others which will be raplaced. Thus
TE> the program will have to write these new atomIDs in place of the others.
TE> Could it be possible for that new dcd file to hold a time-varying set of atoms
TE> if we would create in some way a new psf file - or even by keeping the initial-
TE> that will contain information about all the atoms seen in all the frames of the
TE> new dcd? Do you have anything else to propose?
TE> thanks,
TE> Tom
TE> Αρχικό μήνυμα από John Stone <>:
TE> > Hi,
TE> > Is there some specific reason you need to create a DCD file?
TE> > One of the problems you're going to have with attempting to write
TE> > out a time-varying set of atoms to a DCD is that you'll lose track
TE> > of which atom indices are which. Why not just emit your own file format
TE> > and use just the atoms you care about? The DCD format really isn't
TE> > suited to holding a time-varying set of atoms, even with a big hammer ;-)
TE> >
TE> > The internal code in VMD does not calculate minimums nor maximums,
TE> > but merely tests candidate atoms to see if they meet the distance
TE> > selection criteria or not, for the currently active timestep.
TE> > Calculating min, max, quantiles, or the histogram of distance for
TE> > each atom over all timesteps would have to be done with your
TE> > own script presently. If there is sufficient interest in adding
TE> > a new "measure" subcommand for computing distances we could add one,
TE> > but I haven't had any requests for such a feature thus far.
TE> >
TE> > Cheers,
TE> > John Stone
TE> >
TE> >
TE> > On Tue, Aug 07, 2007 at 12:52:34AM +0300, wrote:
TE> > >
TE> > > Hi,
TE> > > I am writing a plugin for VMD and I need some help. What I am trying to do
TE> > is to
TE> > > create dcd files which contain only the atoms that are within a given
TE> > cutoff
TE> > > distance from the protein. The problem is that each frame of a dcd must
TE> > contain
TE> > > the same number of atoms, so if frame No.1 contains N atoms then I have to
TE> > find
TE> > > which N atoms of frame No.2 are closer to the protein and write only them
TE> > in
TE> > > the new dcd file. My question is if the "atomselect top "exwithin $cutoff
TE> > of
TE> > > protein"" command calculates by default the minimum distance of each atom
TE> > it
TE> > > selects from the protein and if there is a way to retrieve it from the
TE> > source
TE> > > code. I tried to read the source code but I am not sure if it does what I
TE> > need.
TE> > > I just figured out that the "within" macro functions by creating grid cells
TE> > > enclosing the protein atoms (others) as well as the atoms which souround
TE> > them
TE> > > (flgs). I have also some other ideas but that would be the faster way to
TE> > find
TE> > > the atoms I need.
TE> > > I would appreciate any help,
TE> > > Thomas Evangelidis
TE> >
TE> > --
TE> > NIH Resource for Macromolecular Modeling and Bioinformatics
TE> > Beckman Institute for Advanced Science and Technology
TE> > University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
TE> > Email: Phone: 217-244-3349
TE> > WWW: Fax: 217-244-6078
TE> >

Axel Kohlmeyer
   Center for Molecular Modeling   --   University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582,  fax: 1-215-573-6233,  office-tel: 1-215-898-5425
If you make something idiot-proof, the universe creates a better idiot.