Dear Ben

  I'm not sure it can calculate bond-angles, (just because
you would have to indicate which atom triplets you want to use). But
if you can extract the relevant atom coordinates (using or
other scripts), writing a program to calculate the bond-angles would
be an good programming exercise. (In case you don't have time for
that, read on.) There's an example how to do this for a linear chain
of atoms at the end of this email.

I wrote two relevant programs: and

One of these programs is a tiny script which calculates bond-angles
between 3 atoms named "". (There's also a
"".) You can download it here, and click on the
"dlpdb" link. ("" is in the "extract_coords"

   ----- documentation for ----

    This program reads a 9-column numeric text file and prints a list
of bond-angles
The 9 numbers on each line represent the x,y,z coordinates of 3 atoms.
For each line this program computes the 3-body "bond-angle" between these atoms
and prints it to the standard out.
(When a line contains the wrong number of numbers, this program does not crash.
Instead an impossible value, -720, is printed.)

   ----- documentation for ----

   (Forgive me for forwarding this to the user's list.)
Although can extract atom coordinates, I'm too lazy to learn, so I'll tell you how to do everything using ""
which (like pizzapy), can extract atom coordinates, and save them as
either lammps DATA files or simple 3-column coordinate files ("RAW"
files). This program comes with moltemplate, so you should already
have it. If your LAMMPS dump file is named "traj.lammpstrj", you can
extract the coordinates this way: -raw < traj.lammpstrj > traj.raw

This generates a 3-column text file containing the xyz coordinates on
each line of each atom (sorted by atomid). -raw < traj.lammpstrj > traj.raw

It assumes you are using "atom_style full". If you are using some
other atom style (eg "hybrid bond dipole"), then you can run it this
way: -raw -atomstyle "hybrid bond dipole" \
           < traj.lammpstrj > traj.raw

There is a blank line separating different frames in the trajectory,
so the number of lines in the file will be N*(n+1), where n is the
number of atoms, and N is the number of rames in the trajectory. If
this generates too many frames, you can limit this using: -raw -interval 10000 < traj.lammpstrj > traj.raw

to indicate the desired interval between frames (must be a multiple of
the save interval).

  --- splitting text files and mergine lines ----

You will have multiple frames in your trajectory. You can use the
unix/linux "split" program:

For example, if you have 1000 atoms, then (including the blank line
separator), you will have 1001 lines per frame. Split these using:
split -d -l 1001 - traj_frame < traj.raw

The program "" expects 9 numbers per line, but the
coordinate files contain only 3 numbers per line (plus a blank line if
you use

IF you want to calculate angles between successive atoms (in a linear
chain, for example), use this command to put the coordinates of 3
consecutive latoms onto one line.

awk '{if (NF==3) {l3=l2;l2=l1;l1=$0} if (NR>2){print l3" "l2" "l1}}' \
   < traj_frame00 > angles_frame00.dat

awk '{if (NF==3) {l3=l2;l2=l1;l1=$0} if (NR>2){print l3" "l2" "l1}}' \
   < traj_frame01 > angles_frame01.dat


(Hopefully email did not split up those awk commands onto multiple
lines, or you get the idea anyway)

Hope this helps


I have a dump file of x y and z coordinates and want to generate bond angle
distribution. Do you think this is possible with

Dear Ben

  I'm not sure it can calculate bond-angles

I feel like a moron.
I should google your question before boasting about my own programs.
(and probably so should you)
Yes can do this. Check out:

It looks like the only my software can do which can not (yet)
do is calculate dihedral angles ("" in the
"extract_geometry" directory in the "dlpdb"), but that was not your
question (and it's trivial to modify the script which comes with to do this).

I hope I did not waste everybody's time.