1      subroutine argos_diana_chgdst(hist,xs,qs)
2c
3      implicit none
4c
5#include "argos_diana_common.fh"
6c
7      real*8 hist(2,ldist),xs(msa,3),qs(msa)
8c
9      integer i,j
10      real*8 range,drange
11c
12      do 1 i=1,ldist
13      hist(1,i)=0.0d0
14      hist(2,i)=0.0d0
15    1 continue
16c
17      range=xsmax(3)-xsmin(3)
18      do 2 i=1,nsa
19      j=int((dble(ldist)*(xs(i,3)-xsmin(3)))/range)+1
20      if(j.gt.0.and.j.le.ldist) then
21      if(qs(i).lt.0.0d0) then
22      hist(1,j)=hist(1,j)+qs(i)
23      else
24      hist(2,j)=hist(2,j)+qs(i)
25      endif
26      endif
27    2 continue
28c
29      drange=range/dble(ldist)
30      if(me.eq.0) then
31      write(lfnhis,1000) time,ldist
32 1000 format(f12.6,i5)
33      write(lfnhis,1001) (xsmin(3)+(dble(i)-0.5d0)*drange,
34     + hist(1,i),hist(2,i),hist(1,i)+hist(2,i),i=1,ldist)
35 1001 format(4f12.6)
36      endif
37c
38      return
39      end
40c $Id$
41