From: Philippe Bopp (
Date: Sun Mar 19 2017 - 09:10:12 CDT

   Hi Aman

 your question i a bit unclear to me:

>I have a trajectory file from which I want to calculate the coordination no. of say type O atoms.

 OK. What do you call the coordination no ?   Usually it is defined as
 (in TeX notation)
 n(R) = 4 \pi \frac{N}{V} \int_0^R r^2 g(r) dr ar some value R, e.g. where g(r) has its first minimum.

VMD can compute g(r) and n(r) for you, Extensions -> Analysis -> Radial Pair Distribution
(with or without PBC if this is what you mean by 'surface' below)
>I can replicate a frame (using topotools command) and calculate the coordination no. exactly for all the atoms >including those which lie on the surface.

which surface ?

>But I want to do this over all the frames to get the average coordination no. of each one.>Is there any way to replicate a trajectory in VMD ?

 VMD lets you control exacly over what you average
>I tried it after displaying the system periodic in all +-x,y,z directions,
>but the command in the tcl script like "within 3 of index 10"  does not
>account for the atoms outside the original simulation box.    

 but the g(r) computation mentioned above does. (or use "pbwithin 3 of index 10")